Supporters of Democratic presidential candidate Sen. Bernie Sanders (I-Vt.) cheer at a campaign rally in Portland, Maine. (Robert F. Bukaty/AP)

Aides to Sen. Bernie Sanders thought they had found the perfect place for his rally in Portland, Maine: a glass-enclosed building on the waterfront that could hold up to 700 people.

Then came the RSVPs — more than 1,000 the first day, even before the campaign began promoting the event on social media.

“I was panicked and scrambling,” recalled national field director Phil Fiermonte. “It was like, ‘Oh my gosh, get me the names of every other venue in Portland.’ ”

In the end, more than 7,500 people turned out at the new site.

This is what happens when a presidential candidate is surging. In recent weeks, buzz surrounding Sanders’s audiences has been feeding upon itself, prompting more and more people to check out the self-described democratic socialist who has become Hillary Rodham Clinton’s chief challenger for the Democratic nomination.

In politics, this qualifies as a good problem — but it is creating headaches for Sanders’s staff. Besides venue choices, crowd predictions affect everything from how much bottled water to have on hand to how many T-shirts to make available for sale.

An event planned for Boston last Sunday was postponed because aides to the Vermont senator couldn’t find a facility large enough that was reasonably priced.

For a rally in Phoenix this Saturday, Sanders’s staff booked a 5,000-seat downtown theater. But with more people than that signed up by Monday, they were looking at the possibility of moving the event to a place twice the size: the basketball arena where the Arizona State Sun Devils play. That didn’t pan out, because of a scheduling conflict. The event has been moved to the Phoenix convention center.

Sanders drew nearly 10,000 people to a rally in a Madison, Wis.; more than 5,000 in Denver; and more than 3,000 in Minneapolis.

Crowds in Iowa and New Hampshire — early nominating states whose residents know they will have multiple chances to see candidates in person — have been smaller, but also robust. A rally in Council Bluffs, Iowa, that was touted as the largest event for a 2016 candidate in the state so far attracted more than 2,500 people, a good chunk of them from across the river in Omaha, Neb.

A campaign rally in Portland, Maine, early this month drew much larger crowds than originally expected. (Robert F. Bukaty/AP)

Aides in some rival camps have scoffed at the amount of time Sanders spends visiting states where voters won’t have a say early in the nominating process. But the senator’s boosters argue that the headlines Sanders is getting elsewhere are helping him in Iowa and New Hampshire.

The 73-year-old’s audiences are a mix of devotees — many wearing “Bernie for President” T-shirts and carrying “Feel the Bern” signs — and the curious. Some confess they only recently heard of Sanders and want to see what the fuss is about.

“When people hear the buzz, it draws them to it,” said Burt Cohen, a former state senator in New Hampshire who is supporting Sanders. “Wherever I go in the state, people ask, ‘When’s Bernie coming back up here? I want to see him.’ ”

Sanders is not the first Democratic presidential hopeful to use the strategy of holding large-scale rallies in liberal enclaves around the country to get noticed.

Barack Obama drew big crowds the summer before the 2008 contests, and Howard Dean, the former Vermont governor, built momentum during a Sleepless Summer tour leading up to the 2004 primaries.

“When you get media coverage in those places and then you go to Cedar Rapids, Iowa, people want to come see you and find out what it’s all about,” said Joe Trippi, a veteran Democratic strategist who managed Dean’s 2004 campaign. “That was the whole goal of going to those places.”

Trippi said that most of Dean’s large events were held outside, eliminating some of the space constraints the Sanders campaign is experiencing. Fiermonte, however, said Sanders aides are hesitant to hold many outdoor events, for fear of bad weather. Nailing down a rain location, he said, makes things “just logistically more complex.”

One casualty of Sanders’s large crowds has been a tradition he maintained during his Vermont Senate races of providing food for his audiences. He served lunch at some events early in the presidential race, but that kind of generosity is no longer always possible. At his stop in Minneapolis, the campaign promised coffee and bagels — but ran out.

A half-dozen aides at campaign headquarters in Burlington steer the planning of the candidate’s major appearances around the country. Their methods have become more refined in recent weeks. When looking for rally locations, Sanders staffers typically take into account both the size of the city and the number of supporters from the area who are in a database the campaign maintains.

Once a venue is booked, the campaign sets up a Web page with details and a button for people to RSVP. A flurry of e-mails and text messages from the campaign — as well as postings on Facebook and other social media — steer people to the Web site. Labor unions and other progressive groups have also helped promote upcoming appearances, aides to Sanders say. On a couple of occasions, a flood of early RSVPs has prompted a venue change.

For the Portland stop, Fiermonte enlisted help from Brandon Maheu, a veteran Maine-based grass-roots organizer. Maheu said he initially presented Fiermonte with three options for a venue, including the “cool space” on the waterfront, known as Ocean Gateway, which is popular for wedding receptions and business gatherings.

The campaign had created the event Web page but had not otherwise promoted the rally when the RSVPs started streaming in. Maheu said it soon became clear that “there was only one choice in Portland” big enough: Cross Insurance Arena.

But there was a potential hitch. Singer-songwriter James Taylor was performing in the arena the day after the rally, and his road crew was planning to start setting up the stage ahead of time. Taylor’s people turned out to be very accommodating, and Sanders’s show went on.

Fiermonte said large venues can cost as much as $15,000 to rent, an expense that organizers believe is offset by collecting contact information from those in attendance and using that information to build Sanders’s donor base. Sanders announced earlier this month that he raised about $15 million during the first two months of his campaign, with an average donation of $33.51.

With all the guesswork involved, plans for overflow audiences are key. In Denver, for example, after Sanders filled a 3,000-seat university gymnasium, attendees were directed to an adjacent atrium, where speakers were set up, and to a nearby lacrosse field, where the speech was streamed on the scoreboard.

Fiermonte said the campaign has improved its prediction skills in recent weeks.

Aides were confident enough in their initial Madison calculations that they booked a 10,000-seat arena, even though local Democrats were skeptical Sanders could fill the place. He did.

“Whoa,” Sanders said upon taking the stage. “In case you haven’t noticed, there are a lot of people here.”