This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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..
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).]
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