I’ve been building an app that uses CFDocument to build out some FlashPaper and PDF’s. Everything was working great on my local development box, but when I pushed it to my production box, generation of both the FlashPaper and PDF files was taking forever. Processing time went from 4-5 seconds to 3-6 minutes.
Eventually, I tracked down this newsgroup post, which suggested moving all the CF processing out from between the CFDocument tags. I used CFSaveContent to save my output to a variable, and put just that variable between the CFDocument tags, and my performance problems went away.
The funny thing is, my server wasn’t CPU, Memory or Disk bound. In fact, the stack trace in SeeFusion said that the thread generating the CFDocument was actually waiting. So, that thread was basically sitting there doing nothing for minuets at a time. Hopefully this saves someone else an hour or so looking for the problem and solution.