cfflush problem

535 views
Skip to first unread message

Armando Leite

unread,
Aug 18, 2011, 1:27:52 PM8/18/11
to ra...@googlegroups.com
Guys,

I tried the following script:

<cfsetting requesttimeout="900" />
<cfset intStart = GetTickCount() />

<cfloop from="1" to="100" index="i">

<cfsleep time="1000">

<cfoutput>
<pre>
#GetTickCount()#
</pre>
</cfoutput>

<cfflush/>

</cfloop>

<cfset totaltime = (GetTickCount() - intStart) />

<cfoutput> TOTAL: #totaltime# </cfoutput>


But the cfflush not working as it should, instead of printing
information gradually, it prints everything in the end, after processing
the request.
I also tried with cfhttp, without success.

Armando

Peter Boughton

unread,
Aug 18, 2011, 1:43:02 PM8/18/11
to ra...@googlegroups.com
I just tested the supplied code in Railo 3.3.0.022 and Railo 3.2.3.000
and it works fine in both of these.

Tried it in both Chrome and Firefox, and again same behaviour.


Seems most likely to be something up with the way your environment is
configured. Maybe you have a web-server in front that is not passing
the content back immediately?

Michael Offner

unread,
Aug 18, 2011, 1:54:08 PM8/18/11
to ra...@googlegroups.com
<cfflush> just calls the flush method from object ServletOutputStream, this object is provided by the servlet container and Railo has no influence on how this call is interpreted by the servlet container.
many servlet container have defined a buffer itself.

/micha



2011/8/18 Armando Leite <bob...@gmail.com>

Armando Leite

unread,
Aug 18, 2011, 1:57:23 PM8/18/11
to ra...@googlegroups.com
Peter,

Thanks for the quick reply.

I'm testing in Railo 3.2.3.000 (stable) in LAN, without proxy and firewall.
It should print the info every 1 second, but prints everything after 100
seconds.

Armando

Peter Boughton

unread,
Aug 18, 2011, 2:02:11 PM8/18/11
to ra...@googlegroups.com
As Micha says, this may be an issue with the servlet container -
Jetty/Resin/Tomcat/etc.

You'll need to check the documentation for whatever you're using to
see if it has an internal buffer, and if it can be configured to a
smaller size.

(My tests were with Jetty, so - at least with the version of that
which Railo bundles - there's no issue; can't guarantee other Jetty
versions don't have the problem though.)

Armando Leite

unread,
Aug 18, 2011, 2:03:16 PM8/18/11
to ra...@googlegroups.com
It's a fresh default install using railo.run (Apache/Tomcat/Railo) without making any changes.

Armando

Carl Von Stetten

unread,
Aug 18, 2011, 2:13:52 PM8/18/11
to ra...@googlegroups.com
My recollection with ACF was that if you didn't have enough characters
in the buffer, flush wouldn't work (Railo may be the same in this
respect). I had to add a bunch of whitespace to fill the buffer before
flush would work properly.

Carl

Armando Leite

unread,
Aug 18, 2011, 2:33:39 PM8/18/11
to ra...@googlegroups.com
Carl,

I increased considerably the number of characters that are printed by
the loop, yet keep getting up after the request completed.


Att,

Armando Leite Junior
GrupoBWS
www.grupobws.com.br

Jay

unread,
Aug 18, 2011, 2:41:49 PM8/18/11
to ra...@googlegroups.com
it's probably an Apache or Tomcat thing.  my bet is on Apache httpd.  see if you have a setting for "buffer", "buffering", or "chunking"


Justin Edwards

unread,
Aug 18, 2011, 2:41:35 PM8/18/11
to ra...@googlegroups.com
I tested with apache httpd / tomcat, and it has the same behavior for me.  I don't think it has anything to do with railo.  

Justin Edwards

unread,
Aug 18, 2011, 2:45:12 PM8/18/11
to ra...@googlegroups.com
Apache has to have mod_buffer for it to buffer.  I think I narrowed it down to tomcat.  


There are a few buffer settings.  Here's the one I think it is.

socketBuffer

The size (in bytes) of the buffer to be provided for socket output buffering. -1 can be specified to disable the use of a buffer. By default, a buffers of 9000 bytes will be used.

Justin Edwards

unread,
Aug 18, 2011, 3:14:49 PM8/18/11
to ra...@googlegroups.com
Solved it.  

Add this to your apache2.conf where Jk Options are.

    JkOptions +FlushPackets
    JkOptions +FlushHeader

Justin Edwards

unread,
Aug 18, 2011, 3:16:50 PM8/18/11
to ra...@googlegroups.com
Someone might want to add these options to the installation.  If they aren't enabled, railo won't behave properly.

Armando Leite

unread,
Aug 18, 2011, 3:37:50 PM8/18/11
to ra...@googlegroups.com
Justin,

thanks a lot!
problem solved.


Armando

Jay

unread,
Aug 18, 2011, 3:56:49 PM8/18/11
to ra...@googlegroups.com
when you say "someone" you mean "Jordan" :)

he is the one who created/maintains the installers.

Li, Da

unread,
Apr 24, 2013, 9:35:03 PM4/24/13
to ra...@googlegroups.com
I met the same problem as Armando. But my Railo was installed by the installer. I have problem locating apache2.conf inside the folder C:\Railo\tomcat.  I installed ColdFusion 10 and tested Armando's code, and ColdFusion behaved just as desired without any modification. 

I'm using Railo 4.0.3.006 final + Tomcat + Windows 7 + IIS + Boncode.

I'd appreciate if you can get my cfflush working.  :) 

Bilal

unread,
Apr 25, 2013, 9:08:36 PM4/25/13
to ra...@googlegroups.com
Armando:
since you mentioned that you use IIS, I know that the flush settings for the connector are disabled by default.
If you want to target flushing from that angle you can change the setting in the BonCodeAJP13.settings file:
<FlushThreshold>20000</FlushThreshold>

In ACF for flush to work out of the box, Adobe had to give up on any buffer management by the webserver, i.e.this removes any network optimization that IIS could perform between client and server. 

HTH,
Bilal

andrew

unread,
Aug 29, 2014, 2:23:44 PM8/29/14
to ra...@googlegroups.com
For those who come across this post and are trying to get cfflush working on their site using bonCodeAJP13 v1.0.19 and above, the setting attribute is now <FlushThresholdTicks>20000</FlushThresholdTicks>
Reply all
Reply to author
Forward
0 new messages