Thread: Page BUffer

    #1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0

    Page BUffer


    Hi,

    Are there any disadvantages in using Page Buffering ??? and i would also like to know what are the main advantages of using Buffers??

    tia,
    gaucho
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    What exactly do you mean? JSPs are already buffered, all you can do is play with the size of the buffer.
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0
    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!)

    thnx,
    sands
  6. #4
  7. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    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:
    http://www.webdevelopersjournal.com/...tion_pool.html
  8. #5
  9. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0
    hi,

    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..

    thnx
  10. #6
  11. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    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.

IMN logo majestic logo threadwatch logo seochat tools logo