Skip to main content
Participant
March 24, 2010
Question

IIS7 + CF8: 5+ second delays returning content to browser

  • March 24, 2010
  • 1 reply
  • 414 views

Howdy --

I've got a mystery.  I've been putting together this production server for a while and once I started moving sites over to it, I found that some sites were experiencing unacceptably long delays when rendering pages.  Some sites were not.  Here are the interesting bits:

  • Whenever a site experiences delays, normally all pages are affected.  HTML pages are not affected.
  • Whenever a page is affected, the delay is normally 5 seconds, but sometimes is a MULTIPLE of 5 (I've seen 10, 15, and 20s delays), but never anywhere in the middle.  A page's delay may normally be 5s, but if you reload it there's a chance it'll hit 10s for no reason at all.
  • I recently put together a page on a site which was experiencing delays, but the page itself was fine UNTIL I moved a <cfparam> tag to the top of the page.  At that point, the page was delayed 5 seconds.  When I moved it down farther in the page to where it would still execute but not be the first thing executed, the delay disappeared once again.
  • If I'm debugging a page and there's a compiler error, there is no delay before the server returns the compiler error.
  • The delay seems to be related to the amount of information returned from queries to a database.

My latest test has been to figure out how much data I can return from a database query without it causing a delay.  At one point the query that returned 105 characters of information over two fields did NOT cause a delay, and if I returned 106 characters, it induced a 5 second delay.  This was repeatable for about 20 minutes, until I went to make dinner.  When I came back, it changed and the delay was always present.  I reduced the number of characters returned further, to 54 over the same two fields, and the delay disappeared.  I then tried querying on a single field, and was able to return up to 110 characters (sometimes only 109) without the 5s delay, but 111 characters would cause the delay.  This particular field is in a SQL Server 2005 database defined as nvarchar(1500).  My current test code contains just 5 lines, and I've been modifying the 2nd parameter of left():

<cfquery datasource="#dsn#" name="q">

select left(eventdescription, 109) from events where eventid = 2

</cfquery>

<cfdump var="#q#">

done.

Also: the cfdump shows the EXECUTIONTIME value.  When there is no delay, this value is 0.  When there is a delay, it runs between 5100 and 5300ms.  At the same time as I'm doing this testing, I'm running a trace on my SQL Server, and each and every query shows a duration of 0, regardless of whether or not a delay is expressed by CF (or IIS, or whatever's causing it).

I'm running CF 8.0.1.195765 Standard Edition with Cumulative Hot Fix 4 and hotfix hf801-71557, Java version 1.6.0_04 on Windows Server 2008 SP2 Standard x86.  I've also tried looking at the IIS Failed Request Tracing -- I can set a rule that says for it to trigger an event if a page runs longer than 4s, and it does trigger, but it only records events at the beginning of the request; nothing at the end of the request accounts for the delay.  For example, if I start a request at 9:00:00, it will record events at 9:00:00.xxx, but not at 9:00:05.xxx when it says the event stopped.  This makes me think that whatever it is happens after IIS hands off the request to CF.  I've also tried packet inspection between the web server and the database server, and see no dropped packets or delays in that communication.

What can I do here to figure out where this delay is coming from?  Thank you so much for your thoughts on this matter.

chris.

    This topic has been closed for replies.

    1 reply

    Owainnorth
    Inspiring
    March 24, 2010

    Very quick thought after a quick skim-read between coffees - have you turned on all the CF debugging options? The Request Debugger often gives you more info than the query executiontimes.

    O.