Anyone having issues with the cfflush tag in ColdFusion 11? We have a routine that updates a live record count as it is processing a loop. In ColdFusion 10, this works fine. In ColdFusion 11, it waits until the end of the loop to update the screen. Not really what we expected.
Edited to add code as requested...
<script language="javascript">
addOutputLine('<br /><span id="insertCount">Records Inserted: 0</span>')
</script>
<cfset insertCount = 0>
<cfset updateCountAfter = 1>
<cfif qry.recordcount gt 5000>
<cfset updateCountAfter = 10>
</cfif>
<cfoutput query="qry" startrow="#DATASTART#">
<!---do some stuff here that is not important to this issue--->
<cfset insertCount = insertCount + 1>
<cfif updateCountAfter gt 1>
<cfif insertCount mod updateCountAfter eq 0>
<script language="javascript">document.getElementById('insertCount').innerHTML = 'Records Inserted: #insertCount#';</script>
</cfif>
<cfelse>
<script language="javascript">document.getElementById('insertCount').innerHTML = 'Records Inserted: #insertCount#';</script>
</cfif>
<cfflush>
</cfoutput>
Promoted from the comments
There is a configuration setting that is necessary for the <cfflush>
tag to work properly with the web server. On the Configuring web servers in Windows documentation page, under the Configure IIS for ColdFusion in Windows section, among other things it states:
To disable webserver buffer, change the
is_buffer_enable
[sic] tofalse
in the cfroot\config\wsconfig\1\isapi_redirect.properties file. Disable webserver buffer if you want cfflush to work over an IIS connector. If your application does not use cfflush, set it to true for increase in the performance.
Note that there is a typo in the Adobe documentation that I referenced above. It should state iis_buffer_enable
, not is_buffer_enable
(missing an 'i'). Thanks to KrunchMuffin for pointing that out.
You will need to restart IIS for this change to take affect.
I'm not sure what the performance ramifications are of disabling this setting. You will need to do some load testing for your particular environment to see.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With