October 18th, 2002, 10:09 AM
Are there any disadvantages in using Page Buffering ??? and i would also like to know what are the main advantages of using Buffers??
October 18th, 2002, 12:52 PM
What exactly do you mean? JSPs are already buffered, all you can do is play with the size of the buffer.
October 21st, 2002, 05:04 AM
ok.. heres the situation!
Our JSP application has connections to both Oracle and MySQL... In each page there are nearly a dozen queries executing on a MySQL db. at the begining of each page, a connection is opened and at the end they are close.. Ideally, if the user waits for the page to load completely and then hit the button Next or Cancel, the connection is freed..
But what happens often is that soon after entering the page, many users just click on Next resulting in the connection not getting closed...and soon, the no of connections exceed the allotted number (because they dont get freed automatically) and thus crashes the application..
the scripts are all wrapped with try, catch, finally blocks but to no avail...
I want to implement 2 more measures..
1. set a pageBuffer size such that the pafe is flushed only at the end of generating the entire page..
2. use a connection pool for all the databases (another issue where i need u guys help!)
October 21st, 2002, 10:19 AM
You change the page buffer in a page directive, like
<%@ page buffer="64k" %>
The default is 8k. You can also set autoFlush="false", but it will raise an exception if you overflow the buffer before flushing manually. Keep in mind that the jsp1.1 spec says that the buffer has to be flushed before executing a <jsp:include> tag. So if you have any of those, changing the buffer size isn't going to help.
Here's an article on connection pooling:
October 21st, 2002, 12:13 PM
thnx for the link.. hv u implemented it by any chance.. I am facing some trouble with it...
had earlier tried using the connection pool configuration provided on the tomcat´s site but that too didnt work out well..
October 21st, 2002, 12:24 PM
Haven't worked with connection pools, sorry.
You might look into using tomcat to create the pool, though. I think 4.1 has a nice web interface to allow you to set one up.