House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Streaming PDF in ColdFusion 8 / Performance Issues

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jeff Chastain
08/01/2012 06:45 PM

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!

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jake Churchill
08/01/2012 07:41 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Byron Mann
08/01/2012 08:03 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dan G. Switzer, II
08/01/2012 08:38 PM

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 -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 21, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference