NEW YORK — A hacker attack Thursday shut down the fast-growing messaging service Twitter for hours, while Facebook experienced intermittent access problems.

Twitter said it suffered a denial-of-service attack, in which hackers command scores of computers to a single site at the same time, preventing legitimate traffic from getting through.

The fact that a relatively common attack could disable such a well-known Web site shows just how young and vulnerable Twitter still is, even as it quickly becomes a household name used by celebrities, large corporations, small businesses and even protesters in Iran.

"Clearly they need a stronger infrastructure to be able to fight this kind of attack," said Graham Cluley, senior technology consultant at computer security firm Sophos. Twitter's tech support teams, he added, "must be frankly out of breath" trying to keep up with the site's enormous growth.

According to comScore, Twitter had 20.1 million unique visitors in the United States in June, some 34 times the 593,000 a year earlier.

For Twitter users, the outage meant no tweeting about lunch plans, the weather or the fact that Twitter is down.

"I had to Google search Twitter to find out what was going on, when normally my Twitter feed gives me all the breaking news I need," said Alison Koski, a New York public-relations manager. She added she felt "completely lost" without Twitter.

The Twitter outage began at about 9 a.m. and lasted a few hours.

Facebook, whose users encountered intermittent problems Thursday morning, was also the subject of a denial-of-service attack, though it was not known whether the same hackers were involved. Unlike Twitter, Facebook never became completely inaccessible. Facebook said no user information was at risk.

LiveJournal, a 10-year-old online diary and blogging site that has waned in popularity in recent years, was also the subject of a denial-of-service attack that lasted about an hour Thursday morning, the company said.

By early afternoon both Twitter and Facebook seemed to be functioning, as cubicle-bound social media addicts breathed a collective sigh of relief. Twitter warned, though, that "users will experience some longer load times and slowness."

Technology business analyst Shelly Palmer said that denial-of-service attacks are a reality of the information age.

"People tend to want to take sites that are very public and go after them," said Palmer, managing director of Advanced Media Ventures Group. "In fact you'd be surprised how many sites for major companies are really attacked on a daily basis. This is a crime, it's a real crime and it should be treated that way."

Denial-of-service attacks are typically carried out by "botnets" — armies of infected computers formed by spreading a computer virus that orders compromised machines to phone home for further instructions. They generally are used to send out spam or steal passwords, though some can be commanded to overwhelm Web sites.

"With these attacks, if you get enough infected machines ... you can take down anyone," said Dmitri Alperovitch, vice president of threat research at security vendor McAfee Inc.

Last month, dozens of U.S. and South Korean sites, including those of the White House and South Korea's presidential Blue House, were targeted in denial-of-service attacks.