Eric Vanstrom stuck by his dairy cows through a recession, a trade war and a global pandemic that forced him to dump milk into manure pits. This year, though, he’s finally had enough. The thing that’s putting him over the edge: exorbitant grain prices.

One weekend in early June, the Kennedy, N.Y., farmer and his wife loaded 46 milking cows into livestock trailers and sent them off to an auction house. Some went to other dairies. Others ended up at slaughterhouses, to be turned into ground beef. They were so expensive to feed and so unprofitable that he wasn't even sad to see them go.

Vanstrom’s predicament is an increasingly common one. The corn and soybeans that dairy cows eat are seeing a historic rally, fueled by drought in key producing countries and China’s massive purchases of grain to feed a rapidly expanding hog herd. From the United States to Australia, farmers say soaring costs are putting their businesses in peril, to the point that they’re thinking of exiting altogether.

“For a lot of cows, they’ll just have a career change, from happy cow to happy meal,” said Mary Ledman, global dairy strategist at Rabobank.

Pricey feed is imparting renewed force to the industry’s transformation, fueling the growing dominance of megadairies, which milk tens of thousands of cows and are better positioned to weather the volatility of an increasingly global market. Though consolidation may boost efficiency and keep consumer prices in check, it’s also forcing small and mid-sized operations around the world out of business.

President Joe Biden’s executive order to promote competition across American industries likely won’t have a major impact on dairy companies, according to broker StoneX Group Inc., with many of the agriculture-related directives aimed at the meat and poultry industries.

“If you see feed prices shooting up as they are now, that might be the thing that pushes you over to say, ‘It’s probably not a good idea to keep going,’” said James MacDonald, an agricultural economist and visiting professor at the University of Maryland.

The small dairy is an iconic symbol of American rural life and such values as honesty and hard work. Marketers have eagerly tied the wholesomeness of such a life to milk itself, with idyllic scenes of pastures and cows on packaging. With consumers increasingly willing to pay a premium for dairy products with organic and sustainable credentials, milk from megafarms faces competition on grocery shelves. Still, there’s little doubt that small operations are becoming rarer.

Low milk prices have long plagued dairy farmers, and thousands have left the industry in the last five years. The pandemic, however, turned out to be a lifeline for many. As COVID-19 forced schools and restaurants to shut down, leading to canceled orders, governments around the world swooped in with emergency aid and bought up dairy products. Prices rebounded, and the farms that survived came out of the crisis better than expected.

Now, though some long-running aid programs are still in place, others have ended. With soaring feed prices, more dairy farmers are calling it quits again. Wisconsin, a bellwether for the industry and state known for having thousands of smaller operations, has already lost 177 dairy herds this year and sits at a record low in data going back to late 2003.

In the U.S., the number of licensed dairy herds had already more than halved between 2002 and 2019, according to MacDonald’s analysis of USDA figures, with the decline of small operations concentrated in Pennsylvania, Minnesota, New York, and Wisconsin. He expects that the country will lose dairy farms at a rate of 5% to 6% this year, faster than the historical trend of about 4%.

Though Biden’s executive order aims to help small farmers whose profits have dwindled as multinational companies increasingly dominate, there’s little in the directive that would aid the dairy industry specifically, according to Nate Donnay, director of dairy market insight at StoneX Group.

Pricey feed isn't the only cost becoming more burdensome for dairy farmers. Pretty much everything that goes into running a farm has become more expensive, from labor to fertilizers, and wild weather bringing everything from drought to floods isn't helping.

Cody Nicholson Stratton and his husband run a fifth-generation family farm in Humboldt County, Calif. Because the region's usually lush green fields have been parched this year, the couple knows they'll be short on feed. They've sold off about 20 of their 120 cows and cut their sheep flock in half. More cuts could be in the horizon.

“It’s a beautiful mess to have a drought coming on top of all of the struggles that went with COVID,” Nicholson Stratton said.

Meanwhile, bigger farms are also getting even larger and more productive. So even as small farms flee the industry, consumers may see a benefit in the form of lower dairy prices. The U.S. Department of Agriculture expects milk production to reach 228.2 billion pounds this year — up 2.2% from 2020 — as more cows toil away at larger operations.

Consolidation is also underway in Asia. China’s dairy cow inventories have fallen to less than six million from a high of 14 million in 2013 as small farms were replaced by larger farms, many of which are run by major corporations such as Yili Group and China Mengniu Dairy Co.

In places such as Australia, other business lines are just proving more attractive. Despite a more favorable production outlook for the country’s agricultural industry at large, record high beef prices have prompted some producers to transition away from dairy into the meat industry, while robust land values have encouraged others to sell their farms altogether, national services body Dairy Australia said in its latest outlook.

Back in upstate New York, Vanstrom is moving on, even though he grew up milking cows and for years all roads led him back to them.

He and his wife are selling meat from their beef cattle directly to consumers at farmers' markets, bringing in $30,000 in 2020 and projecting more for this year. Although he's turned the page, he keeps tabs on neighbors still battling to make ends meet.

“I see no future for small dairy farmers. To work that hard, seven days a week, 365, never get time off and to have nothing to show for it,” Vanstrom said, “it’s horrible.”