How can I force flushing an ERB output?

I have a report that yields a very big HTML table that can take hours to finish processing depending on input params.

I would like to flush the already generated output to the browser even if the result is not complete. The idea is send the table lines once they are generated. Waiting for the entire output to be generated also could consume a lot of RAM, although it is not a major problem now, but flushing the output from time to time would allow less memory usage.

Just in case some of you have some experience with JRuby or could enlight me understanding another problem, let me ask you another question. The calculations I'm performing for generating this table are quite heavy and I'm using some Java libraries to help me performing them. I'm not using ActiveRecord to talk to the database, but Sequel instead in the Ruby part. I'm also using warbler to generate a war file to be deployed in a Java servlet container, such as Tomcat.

I would like to understand better why isn't Rails thread-based. I mean, why there is a need for multiple instances of Rails for dealing with concurrent connections? If this limitation is specific for ActiveRecord or MRI Ruby implementation, it shouldn't be a problem for my application, since it uses JRuby (with real threads) and does not depend on ActiveRecord. Is there anything I could do to allow multiple concurrent connections in a single Rails instance?

Thanks in advance,

Rodrigo.

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to