i'm facing serious memory problems on the site we had build using Servlets. the site gives certain unknown errors due to the heavy traffic. what can be done to minimise the memory leaks??? is there a way to minimise these loses through your code.. please suggest.... the server is Apache server and its ram is aroung 1GB..
Hi Pankaj, Could you elaborate on the kind of web application you are hosting? There are some performance hits that might occur in your web applications.Some of the troubleshooting could be done by :
Using Connection Pooling
Avoiding use of synchronized blocks, as much as possible.Use local instances instead
If objects are huge in size , consider serializing and storing the object into an external resource like a file or even DB
This seems to be an interesting topic.Please provide us with more inputs. Regards, Sandeep Desai email@example.com
Sun Certified Java ProgrammerScored 93 per cent
Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
IBM Enterprise Connectivity with J2EE Scored 72 per cent
Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
[This message has been edited by Desai Sandeep (edited April 14, 2001).]
<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
Joined: Apr 14, 2001
we had launched a site on the apache web server using the postgres database... the site was going fine for quite some time but due to the increasing rush on the site..there have been some problems on the site..the site is taking lots of Server RAM. the pages get blank some times. probably there are some memory leakages.. as the rush on the server gets less..it works perfectly fine... are there ways to reduce these memory leakages..or is there any other possible reason for such behaviour of the site.. ofcourse we r using the Connection pooling and it seems to work fine...beacuase i counted them..they r always less than the maximum limit of 32. do we need to increase the number of connections..? please suggest.. thank you.
Joined: Apr 02, 2001
Hi Pankaj, I feel your project involves lot of Object Creation with considerable size.I assume you are putting that in the session or application implicit object. Just check your design, if : 1. You could put the objects like Connection, at the application Level.In case it is at session level, it would be created for every instance of the browser.This could hog your memory resources. 2. You could also use a GC mechanism, if required to nullify the unwanted references. 3. Use local instances instead of synchronized blocks to serve the requests faster Let me know if the above points help you for this performance hit Regards,
There is a lot that can be done to optimize typical servlet CPU and memory use. There was a Thread about books on the topic just this last week. I have found it very helpful to have a special servlet for administrator use only that can query current available memory, number of connections in use, etc. - If you are using sessions, you can have a HttpSessionBindingListener to help you keep track of the number of active sessions. Bill
Hi Pankaj, I would like to know if you have solved the problem. Also you have not mentioned which application server you are using. We have also tried to implemented connection pooling but,with websphere 3.5 the performance for very poor. could you pls share your know how with us.
Hi Pankaj, If you are using apache with servlet maybe you are using tomcat (this assumption because you are using apache and postgresql, open products) and if this is the case with version 3.2 of tomcat you can use thread pool similar to connection pool but reusing threads. The default configuration is in average for 10-40 concurrent request and you should modify this configuration in the archive server.xml in the section of <Connector>. Well, this is an specific and restrictive response only for tomcat but if you are using other servlet container or if you are using other application server more sophisticated, maybe have similar mechanism (for exmaple Weblogic attempts to use HTTP persistent connection). I really want know if you using tomcat or not and if this advice help you. If you have any question or suggestion just write me and sorry for my english. Ivan Paniagua. firstname.lastname@example.org