Coffee chains built on razor-thin margins face mounting pressure from volatile markets and record-high bean costs.