Small businesses reliant on the coffee trade are feeling the effects of a rise in the price of coffee, and for some, it's amounted to more than just a caffeine headache.

Bad weather in South America and an increased demand for coffee worldwide has driven the price of coffee to a 13-year high. In the last few months, the price has shot up dramatically, which has put many coffee retailers and wholesalers in a bind: how does one keep prices affordable amidst soaring costs?

Donald Schoenhaldt, the president of Gillies Coffee, one of New York's oldest specialty coffee wholesalers, experiences this conundrum on a daily basis. "Whenever you have a run-up in costs at a time when the whole economic structure is under strain, it puts pressure on small businesses," he says. Gillies Coffee was founded in 1840 in New York City, when the U.S. coffee trade was in its infancy. In the last 25 years, though, the specialty coffee trade has grown from one perent of the total coffee market to 20 about percent, according to the Tea & Coffee Trade Journal.

While the price of coffee has risen, some wonder why coffee buyers hadn't predicted the rise and scooped up bulk coffee beans while they were cheap. Schoenhaldt explains that stockpiling coffee isn't so easy. Over a long period of time, he says, coffee beans will lose water weight, since they are essentially seeds of a coffee plant. Aside from the lost weight, there are more intangible alterations, like changing tanginess or acidity. Generally, though, the coffee becomes duller—or "fades," as its known in the trade. "Coffees that bring high premiums lose that edginess that people like," Schoenhaldt says. "They lose their value."

Buying ahead also presents other risks. Coffee is a commodity just like gas or cotton, so its future value is under constant speculation by commodity traders and coffee buyers alike. "It's bad enough to buy expensive coffee now, but what if it goes down and I'm sitting with high coffee and my competitor isn't?" Schoenhaldt says. "That could be even more aggravating."

But for Oren Bloostein, founder of Oren's Daily Roast in New York City, buying ahead would have saved his business money. Bloostein imports most of his company's coffee from Colombia, directly from farmers, which makes the process of buying coffee fairly instantaneous.  By buying up contracts far in advance, Bloostein could have hedged the price for the coffee, but he chose not to this year.

"In this run-up I kept thinking 'oh no, this can't keep going up, it's got to come down,'" he says. "I basically got caught with my pants down, because the price had been so low…so I didn't do much. But then it moved like a shot from March over the summer."

Bloostein opened his first Manhattan shop in a Upper East Side hole-in-the-wall (almost literally—it was nine feet wide) in 1986. The business has since expanded to nine locations in Manhattan, making it one of the largest independent coffee houses in the city. Due to increased costs, Bloostein raised prices in September, and that given the current situation, he says he'll likely increase again.

"I have to say that I learned the hard way," he says. "If we don't raise prices soon enough, we lose money. It's just that simple."

Other retailers have relied on relationships with farmers to parry the rising costs of the product.  The Roasterie, a 17-year-old company in Kansas City, Missouri, for example, sent out a small price increase a couple months ago, according to Paul Massad, the company's director of supply chain and self-described "bean hunter." But since the company has long-term contracts with multiple farmers, The Roasterie hasn't been hit nearly as hard as companies buying directly off the market. "If we didn't have these relationships, we'd be hit a lot harder," Massad says.

Martin Diedrich, founder of the popular Kean Coffee in Orange County, California, says that he can go years without actually checking the official price of coffee due to his close, almost familial, ties with farmers. He also notes that for specialty coffee purveyors, like Kean, customers rarely balk at small price increase.

Of course a price hike is never welcome, and some coffee companies have simply acquiesced.

"We can't avoid it," says Russ Lumsden, the founder of Coffee & Tea Warehouse, an online wholesaler and retailer based in Blaine, Washington. "We're all in the same boat. The price of coffee goes up for everybody."

While retailers struggle with questions of prices, Schoenhaldt says there will always be someone who wants to buy better-tasting coffee, despite that rising costs put the specialty coffee in a precarious position. "I am concerned for the trade as it currently exists because I think what's happening has really rocked the boat," he says. "There's going to be a shakeout."