• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP and Bean best practise!

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am working with JSP on JavaWebServer /Unix / Oracle9i background.


I have to analyse the performance of the website that uses JSPs and Bean.


The present structure is as follows.

->The Bean is having Connection pool to manage 100 connections.
->It also has a method to take a 'procedure name' as input and return the RESULTSET (object).
->All JSPs
-get connection from pool
-cal gc.
-call the above method, casts the RESULTSEt and using the resultset to display the data.
-return connection to pool
-call gc.

Now wht the problem is when 10s of our branches are updating the data on our website,
atleast once in a day JavaWebServer goes down!!!

We checked for the memory leakage but i think there is no problem with it as in the beggining of the JSP and at the end of JSP Java's free memory is the same ...


So wht i can think is the other way of using Bean and JSP that is,
Instead of getting RESULTSET Object from bean we can have M*N matrix of String type which we can directly use in JSPs...
(Return the data only not the resultset object, getting my point no?)
**** Will this idea make the performance better or this is the problem of JavaWebServer...



PLEASE correct me if i m wrong somewhere!
And let me know yr views too... this will help me to start the journey again... i m new in the organization...

Thanks to all,
Sejal
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IMO, you should consider the following points:
1. I'm not sure how you handle the connections from the connection pool, but I assume that you are ensuring that they are closed after use. Calling close() on Connection object would release the resources held up during it's creation. I do think you have a proper connection handling logic.
2. I don't think calling GC would help. It doesn't ensure release of resources/freeing of memory.
3. I don't think using a multidimensional array (matrix) is a good idea of fetching data from the resultset. You could use Collection objects like ArrayList, containing objects of some bean to hold the data.
4. Since you mention all JSPs, I would suggest you to have some plain Java classes which would separate the processing logic from the presentation logic. The purpose of a JSP is to have an easy presentation logic.

These are just suggestions and all of them do on actually boost the performance. But they would certainly make life easier while maintaining code.
 
reply
    Bookmark Topic Watch Topic
  • New Topic