Coffee stocks are piping hot these days

— -- Looks like coffee is starting to perk up on Wall Street.

While the broad market is struggling to hold its recent gains, shares of five of the largest publicly traded coffee companies are on a high boil.

Shares of Diedrich Coffee DDRX are up 4,525% this year, Green Mountain gmcr has doubled and even Starbuckssbux is up 50%.

That shows that investors think consumers, despite the recession, still crave their coffee fix, though they're looking for ways to spend less, says Michael Podhorzer of research firm Sidoti. "Coffee is recession-resistant," he says. "Whether they go out for it or go to a grocery story, people will still buy their coffee."

Behind the coffee stock boom:

•Do-it-yourself. Green Mountain is at the center of the make-your-own trend, as it makes popular single-serve coffeemakers under the Keurig brand name. Consumers drop a small coffee-filled pod in a machine, and coffee flows into a cup.

Green Mountain makes money selling the machines, but the replacement coffee pods, called K-Cups, are even more lucrative, says Jon Andersen at William Blair. Green Mountain's earnings in the first quarter doubled from a year earlier to $13 million.

Meanwhile, Green Mountain licenses other coffee companies to make K-Cups. Diedrich's stock has benefited because it is one licensed to make K-Cups, he says.

•Cost control and better store traffic. Starbucks rose 3.3% to $14.16 Tuesday after Robert W. Baird analyst David Tarantino upgraded it to outperform, saying advertising helped boost coffeehouse visits. And a close eye on cutting costs improved profit upside for Starbucks, says Cowen analyst Colin Guheen.

•Low share prices. It didn't take much confidence to make investors willing to take a shot on the stocks, because they were priced for disaster. Diedrich and Caribou Coffee cbou, for instance, started this year at less than $1.50 a share.

Some fear investors are in a caffeine-induced frenzy. Podhorzer is neutral on Peet's Coffee & Tea, peet saying, "We don't really see any big problems, but we think it's fairly to slightly overvalued."