Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

memory problems on the server!!!

 
pankaj kak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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..
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :

  1. Using Connection Pooling
  2. Avoiding use of synchronized blocks, as much as possible.Use local instances instead
  3. If objects are huge in size , consider serializing and storing the object into an external resource like a file or even DB

  4. This seems to be an interesting topic.Please provide us with more inputs.
    Regards,
    Sandeep Desai
    vgdesai@vsnl.com

    1. Sun Certified Java Programmer Scored 93 per cent
    2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
    3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
    4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

    5. [This message has been edited by Desai Sandeep (edited April 14, 2001).]
 
pankaj kak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,


------------------
Sandeep Desai
vgdesai@vsnl.com

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

------------------
author of:
 
prashant patel
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ivan paniagua
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
id_ramallo@hotmail.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic