(Bloomberg) -- San Francisco’s Westfield mall was for decades the city’s premier shopping destination, a nine-story complex in the heart of downtown known for its iconic glass dome and spiral escalators.

These days, the property is struggling with empty storefronts and falling foot traffic — so much so that owners Unibail-Rodamco-Westfield and Brookfield Corp. are giving the mall up to lenders, underscoring the wider challenges for brick-and mortar retail. Last weekend brought a particularly deep blow: the anchor Nordstrom Inc. store closed after 35 years.

Just an hour’s drive south, Westfield has another shopping center in San Jose that’s booming. Located in the heart of Silicon Valley, it’s added new stores, including a three-story Eataly eatery and a luxury wing with brands like Tiffany & Co. and Versace. The mall’s sales have increased by 66% since 2019.

The contrast highlights the changing fortunes of the world’s tech epicenter at a time of industry upheaval and a post-pandemic recovery that has seen dense US downtowns struggle. 

San Francisco, a major beneficiary of the last decade’s boom as young workers flocked to a lively urban center, is floundering due to an exodus of people and empty office buildings. The suburban region of Silicon Valley, meanwhile, has seen its economy hold up relatively well from remote work and the fortunes of the likes of Nvidia Corp. and Apple Inc.

“Silicon Valley is a net winner from the pandemic,” said Nick Bloom, an economist at Stanford University who coined the term “donut effect” to describe how urban centers are losing their appeal while suburbs are flourishing. 

Read More: Tech’s Bust Delivers Bruising Blow to Hollowed-Out San Francisco

San Francisco’s downtown is lagging behind every other major US city in its post-pandemic recovery. Its office vacancy rate has surged to 30% as tech companies opt for remote work, downsize or move away. The city shed 40,000 residents during the pandemic and its population is projected to remain 3% smaller by 2060.

Silicon Valley has seen an even slower return of workers to its offices, according to security company Kastle Systems. But the area’s sprawling landscape made up of tech campuses and shopping plazas makes it less dependent on people filling downtown office towers. Property values are rising, three of its companies — Apple, Alphabet Inc. and Nvidia — have more than $1 trillion in market value each, and its population is set to grow over the longer run.

While Silicon Valley’s unofficial capital of San Jose — the Bay Area’s biggest city, with roughly 1 million residents — has long been overshadowed by its flashier neighbor, Mayor Matt Mahan envisions that it that can benefit as San Francisco’s economy reels.

The Bay Area’s center of gravity is shifting to areas that are more “business friendly, larger, and have a greater talent pool,” Mahan said in an interview. “I predict one day it will be the San Jose-Bay Area.”

Cities across the Bay Area are struggling with high housing costs — with the median home price in the region topping $1 million — along with a homelessness crisis and the departure of residents to cheaper areas. In a sign of frustration over mounting challenges as well as the tech industry’s deep roots in the region, a group of prominent investors are backing the purchase of thousands of acres of farmland to build a new urban oasis about 50 miles (80 kilometers) northeast of San Francisco.

Read More: Secret California City by Ex-Goldman Trader Faces Scrutiny

San Francisco, though, faces it’s own unique set of challenges as perceptions of rising crime and street squalor contribute to people staying away. Mayor London Breed says she’s working hard to revitalize the downtown, and she wants to reform business taxes and attract new companies to vacant office buildings. She has even proposed the idea of razing San Francisco’s Westfield mall and building a soccer stadium in its place. 

“This is not the first time we’ve gone through a financial downturn,” Breed said in an interview last month at City Hall. “We’ve rebounded and diversified and we have sought different industries. And that’s why people keep betting on San Francisco.” 

The shift of people in Bay Area is having an influence on the real estate market, which remains the most expensive in the country. The median sale price of a home in the Silicon Valley town of Santa Clara was $1.5 million in July, up 8% from a year ago, according to Redfin. In San Francisco, the price has dropped by 8% to $1.3 million as the city saw more listings and less demand.

The region’s public services are also feeling the strain. While Silicon Valley’s bus and train operator expects a 10-year surplus thanks to higher sales-tax revenue from local and online shopping, transit agencies serving downtown San Francisco have scrambled for funding to avoid service cuts. 

The transit crisis is just a symptom of the city’s larger fiscal woes. Overall, San Francisco is facing a $780 million budget shortfall and Moody’s in July lowered its credit rating outlook to negative.

Silicon Valley, encompassing more than a dozen cities, is the cradle of some of the world’s tech behemoths. Companies including Apple and Intel Corp. were born there, often starting in garages before expanding into sprawling campuses. Alphabet resides in Mountain View and Meta Platforms Inc. calls Menlo Park home. Cupertino is known for Apple’s Infinite Loop campus.

“You couldn’t have a least glamorous place on Earth,” said Mark Ritchie, a commercial real estate broker with offices in both areas. “But it is so productive it’s unbelievable.” 

Santa Clara Mayor Lisa Gillmor acknowledges that her city of about 130,000 residents may not offer the fine dining and nightlife found in San Francisco. But with plans to host the 2026 Super Bowl and the FIFA World Cup soccer tournament, the city is working to enhance its appeal. “Let’s be frank, San Francisco has fun,” she said. “That’s what we’re missing here.”

Her city represents the area’s boom-and-bust tendencies — home to both Nvidia and Silicon Valley Bank, the tech-favored lender that collapsed this year.

The bank’s failure rippled throughout the region and shows that Silicon Valley faces many of the same challenges as San Francisco, including a wave of layoffs and a pullback in venture-capital funding. Notable companies including Oracle Corp. and Hewlett Packard Enterprise Co. have moved their headquarters to Texas, and Google has paused a planned San Jose mega-campus. 

Silicon Valley’s office-vacancy rate has surpassed 18% — almost tripling from 2019 — but it’s still far less than San Francisco’s. 

As the tech industry recovers from the slump of 2022, San Francisco is looking to bounce back. Last week, the city’s first Ikea store opened less than a block away from the Westfield mall. Office attendance in San Francisco increased 38% in July from a year earlier, the biggest gain of any US city, according Breed’s office. And tenant demand for space jumped 16% in the second quarter, according to real estate firm Jones Lang LaSalle, buoyed by the booming artificial-intelligence industry.

“We get back on our feet and keep moving forward,” Breed said. “AI is starting to take flight in a whole other way.” 

©2023 Bloomberg L.P.