BEIJING (MarketWatch) — One doesn’t appreciate the magnitude and importance of the role pork plays in the Chinese diet until you spend a bit of time here. The meat is so widely consumed, and such an integral part of so many beloved Chinese dishes, that one begins to take for granted that the default protein on menus is pork. Restaurants often feature only brief lists of chicken and beef dishes alongside their page-length selections of pork-based specialties.

So the African swine fever that has wiped out half the country’s herds has been especially excruciating — for consumers, restaurateurs, farmers and the government. Domestic Chinese pork prices have skyrocketed. And the crisis has begun to affect global markets, both positively and negatively.

China is the world’s largest consumer and importer of pork, so much so that it “has become the major influence on the price and availability of pork worldwide,” according to a study commissioned by the U.S. National Pork Board.

“But today’s countrywide [African swine fever] debacle is not just creating shockwaves. It’s an earthquake that is changing the very structure of the pork chain both inside and outside of China,” the report said.

That structural change has meant a windfall for big meat producers in Brazil, Australia and Europe. American producers have benefited less, due to Chinese tariffs and the trade war.

Even before the crisis, China was Brazil’s largest market for pork, beef and chicken exports. But the South American country’s pork exports to China have soared an additional 40% since the beginning of the year, according to data from both countries’ agriculture ministries. Even Brazil’s beef and chicken exports have risen, as China seeks to fill an overall protein gap caused by the pork shortage.

But while Brazil’s pork producers may be reaping the benefits of Chinese demand, this has caused domestic pork prices to rise some 30%, according to the University of São Paulo.

Last week China gave the green light to Brazil to export swine offal to the Chinese market, a subcategory that had been off-limits previously.

Meanwhile, Australian supermarket group Coles said it is exploring plans to sell of millions of dollars’ worth of premium beef to China’s consumers, and its meat sales to the country have reached record numbers this year, due in large part to vastly reduced Chinese pork supplies.

While the trade developments will be a boon for pork exporters in the near term, it may wipe out their ability to compete with China’s domestic production in a matter of years, as the country rapidly remakes how its pork producers raise, slaughter and sell.

Half of China’s pork production still takes place on small-scale farms. But these production houses have been decimated as China emerges from the epidemic, according to the National Pork Board study, which says “the backyard and semi-formal sectors are finished in China, and pig production from this sector will be insignificant probably as early as 2025.”

That is because the country is being forced to rapidly modernize its industry.

Don’t miss: Trump agriculture secretary says during Wisconsin visit that family-run dairy farms may not survive

“China, the country that has built by far the world’s largest high-speed train network from scratch in just 10 years, will also create probably the world’s largest-scale and most efficient pig supply chain, probably in just five,” the study says.

China’s Agriculture Ministry sought to put a positive spin on the crisis last month, noting that recent pig-herd numbers had stabilized. But a broader measurement of 400 counties across the country continued to show declines for the same period.

The country’s shift from pork to beef and chicken consumption may not take place overnight — but it is happening rapidly.

Read on:U.S. farmers, battered by low commodity prices and trade war, brace for things to get worse

Tanner Brown is a contributor to MarketWatch and Barron’s and producer of the Caixin-Sinica Business Brief podcast.