0

I am running a Tomcat/Spring server on my local machine, and I'm running another program which sends POST requests to the server one after the other in quick succession. Each request causes an update on a remote Postgresql database, and finishes (flushes a response code) before the next one is sent.

After about 100 requests, the server starts taking longer to respond. After about 200 requests, the server stops responding and takes all the available processing until I manually kill it, either in Eclipse or the Windows Task Manager.

At one point the server spat out an error about garbage collection, but I haven't seen it the last few times I've tried this. When I saw this garbage collection error, I added a 5-second pause every 20 requests to try to give the server time for garbage collection, but it doesn't seem to have helped.

How can I track down and resolve the cause of this server overload?

Mar
  • 7,765
  • 9
  • 48
  • 82
  • 1
    You have a memory leak. – seenukarthi Oct 11 '16 at 17:30
  • @KarthikeyanVaithilingam- that was actually helpful, pointed me in the right direction, thanks. I'm looking at http://stackoverflow.com/questions/40119/how-to-find-a-java-memory-leak now... – Mar Oct 11 '16 at 18:37
  • Using JVM Explorer profiling, I tracked the problem down to sessions being created for each request, but never disposed of. By invalidating each session at the end of its associated request, the memory problem went away. – Mar Oct 11 '16 at 20:38

1 Answers1

0

Did you monitored memory usage? But here are some ways to track down the problem:

  1. Track its memory usage with time in task manager.

  2. Try take thread dumps from time to time.

  3. Use visualVM to track cpu usage.

  4. See if DB connections are getting closed.

    There could be many more things that can cause it but visualVM can be your tool to start diagnosing these issues.

Community
  • 1
  • 1
Prateek Jain
  • 2,738
  • 4
  • 28
  • 42