|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Streaming PDF in ColdFusion 8 / Performance Issues
Jeff,Jake Churchill 08/01/12 07:41 P You could maybe try reading the pdf as a binary with cffile into aByron Mann 08/01/12 08:03 P Have you looked into an X-sendfile-mod for your web server?Dan G. Switzer, II 08/01/12 08:38 P I am doing some performance test on a site running on ColdFusion 8 using FusionReactor. There is one script that consistently ends up on the top of the long running requests list. The script is very simple - it grabs a PDF file that already exists on the files system and streams it to the user. <cfif fileExists( filePath & fileName ) > <cfheader name="Content-Disposition" value="attachment; filename=#fileName#"> <cfcontent type="application/pdf" file="#filePath##fileName#"> <cfelse> <cfheader statuscode="410" statustext="Gone" /> <p>We're sorry, but the page you have requested no longer exists on our site.</p> </cfif> The PDF files in question are pretty small ... 1 to 2 MB. In some cases (but not all), the request logs in FusionReactor are showing this script running for 200+ seconds. Does anybody have any ideas why this would be happening and is there a better way to stream PDF files that are not web accessible (i.e. the user has to register, then they get the file streamed to them)? I am not looking to change the workflow - i.e. copying the file and sending a link by email etc. I have streamed files like this before and have never seen these kinds of performance issues. Thanks for any input! Jeff, I've read there are issues with file/directory operations in CF when files are really large or the directory contains TONS of files. You might try a java alternative. I'm mobile right now, but I think it's something like this: createObject("java", "java.io.File").init( filePath & fileName ).exists(); -Jake On Wed, Aug 1, 2012 at 5:45 PM, Jeff Chastain <jeff.chastain@admentus.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- You could maybe try reading the pdf as a binary with cffile into a variable and outputting it that way with <cfcontent ... variable="#x#"> Could be cfcontent is opening the file and not closing all the way or something. ----- Excess quoted text cut - see Original Post for more ----- Have you looked into an X-sendfile-mod for your web server? That will allow you to validate the request in CF, but pass the request back to the webserver to serve the file. The file does not have to be in a web accessible directory. -Dan ----- Excess quoted text cut - see Original Post for more -----
|
May 21, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||