We're speaking at
CFUnited 2008:
CFUnited - The Premiere ColdFusion Technical Conference

Search

Calendar

SunMonTueWedThuFriSat
    123
45678910
11121314151617
18192021222324
25262728293031

Subscribe Enter your email address to subscribe to this blog. You'll receive an email when we write a new post.

Recent Entries Come On In, Rails-The Water's Warm
Shan's Simple Examples: File uploads with Flex and ColdFusion

Recent Comments Google Calendar API - Creating a new Calendar with ColdFusion
Steve Julian said: When and where are you going to post the finished CFC's ? Thanks [more]

Three Phases of Programmer Development
Pat Branley said: I normally think of those phase 2 people as 'programmers' and the phase 3 people as 'developers'. I... [more]

New Job Title: Front End Engineer
Sean Corfield said: Well, there's always the excellent Fusion Authority Quarterly Journal... [more]

Down To The Wire: HTTP Sniffers
Brian M said: I second the mention of the Charles Web Debugging Proxy that Tariq mentioned. It is fantastic. It s... [more]

New Job Title: Front End Engineer
Patrick said: Heya Sean. Good point. I never understood how they did things over there at SysCon, and I understand... [more]

Archives By Subject Business of Software (4) [RSS]
ColdFusion (318) [RSS]
Conferences (6) [RSS]
Databases (87) [RSS]
Flex & Flash (109) [RSS]
Fusebox (87) [RSS]
General Development (29) [RSS]
Google (9) [RSS]
Hardware (5) [RSS]
JVM & Java (132) [RSS]
Linux (20) [RSS]
Miscellaneous (254) [RSS]
Performance (8) [RSS]
SeeFusion (36) [RSS]
Shan's Simple Examples (6) [RSS]
User Interface (3) [RSS]
Windows (5) [RSS]

Archives By Poster Daryl Banttari (10)
Nat Papovich (29)
Patrick Quinn (36)
Shannon Hicks (22)
Steve Nelson (21)
Tyson Vanek (3)


bottom corner

CFDocument performance

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.

Comments
Was the production server on Standard or Enterprise edition?
# Posted By Sean Corfield | 2/18/07 12:39 PM
The production server is running Enterprise, J2EE on JRun. The dev server is running Enterprise (Developer), Standalone.
# Posted By Shan | 2/18/07 2:30 PM
Just another note in case you don't already know:

If you have images in the CFDocument that are being accessed on the same server...make sure to use a "file:/" url to access them instead of a regular HTTP url because it will force a web request to the server for each one instead of just quickly loading the file from disk.

This helped me a lot on a few reports.

Mike.
# Posted By Mike Kelp | 2/18/07 7:32 PM
Can't remember where I heard this but I'll say it anyway and hopefully someone will tell me if I'm wrong or right.

When styling a documents with CFDOCUMENT always use the @import to include the css. For some odd reason not only does this give better performance, it will take care of the problems most people have with CFDOCUMENT not rendering the style correctly.
# Posted By Tony Petruzzi | 2/18/07 7:54 PM
@Tony: the <link> tag for external styles will work too, but again you need to use the "file:///" + path type of absolute URL for the href attribute pointing to the stylesheet.
# Posted By Julian Halliwell | 2/21/07 12:41 PM
After a long and tiring effort to track down why cfdocument was performing so badly - and even starting down the path of interacting with iText directly - we pinpointed the performance problems we were having to JPEGs. Yeah... weird.

The short story is we converted any images to png's (using CFX_ImageCR3) and our performance problems disappeared. In fact, generating a PDF is now 8 or 9 times faster.

Macromedia/Adobe must mangle the jpeg conversion/resample/resize when they add them to the PDF.
# Posted By Steve | 3/14/07 1:43 PM
This is beyond stupid of me, but can someone give me an example of adding an image call using the local file reference notation? All I get are X's when I do a <img src="file://C/... Just figure on a fully qualified file location off the C drive (on Windows) and I can take it from there.
# Posted By yetti | 11/8/07 10:36 AM
file:///C:/Users/Shan/Pictures/MyMousey1.jpg
# Posted By Shan | 11/8/07 11:17 AM
Thanks Shan!
# Posted By yetti | 11/11/07 12:15 PM
file:///C: works great when the files are mapped, but something like:
file:///misc2/images/ does not work. Surely, this is possible without having to map the drive
# Posted By Drew | 3/19/08 7:46 PM
Unless the ColdFusion (and maybe IIS, I'm not sure) service is running under a user account that has the mapped drive already assigned, you will not even be able to use mapped drives.
# Posted By Shan | 3/19/08 9:39 PM

bottom corner