This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

heap size problem with web application

 
nitin varshney
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All...,
I am making an web application in which i m sending ajax requests to my api methods in every 2 seconds for getting updates.
i am using a no. of maps and lists to retrive data.and i am using tomcat web sever.what the main problem is that i m facing heap size problem in some hours
after starting my application.
Actually my methods returns maps and lists and Garbage Collector is not able to remove them from memory rapidly.

please give me solution if anyone had worked on such type of application.....i am waiting for a right solution.........


thanks and regards

Nitin Varshney
 
Deepak Rajkiran
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing same problem nitin...
 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ideally, you shouldn't post this here, may be, moving this question to Tomcat, or Performance related section will help to get good reply..

Now, I think form what you wrote is "heap size problem" as "OutOfMemoryExcption" after some request to server, If that's what you mean, then firstly check out whether you left opened some precious resources like db connection , file stream, etc, then close them properly, and increase the memory allocated to tomcat (There is an option for this, refer tomcat docs).
 
nitin varshney
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
thanks for giving solution..
but i have checked all the possibilities that you have told me in forum.
I am using Singleton Pattern in My D.A.O (managers).
i have given 64 megabyte memory to tomcat.
should i have to give more memory.
and don't you think so that we are trying to prevent from the problem instead of doing right solution by doing this.

please give me some more guidance

thanks and regards

Nitin Varshney

 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Whats the exact error/exception you got ?
Also, post the logs stating the problem .
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If 64MB is the maximum memory, then that's too little. Try 256MB for starters.

Also, polling every 2 seconds sounds like a lot. Is the previous request even finished by the time the next request goes out? Can you change this to every 10 seconds or so?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic