• Post Reply Bookmark Topic Watch Topic
  • New Topic

Application Server freezes and not responses temporarily  RSS feed

 
anil cinar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web site which provides photos like Instagram. I use jsp and Sun One 6.1 web server. I detected a situation that when the system is used for couple of minutes, it suddenly waits, not responses, the browser stays as loading for couple of seconds, and then continues to work with acceptable speed.

I tested the jsp code and measured the load time using currentTimeMilis method, but I think my java codes are not the reason of this situation. It can get the image IDs about 10-15msecs and there is not any extra codes.

I use the following JVM options : -Xss96k -Xmx892m -XX:ReservedCodeCacheSize=256m

Is it possible that the problem is the disk read speed of the server ? I have 50 folders which include almost 2000 images for each and the web instance gets the images from there.

Here is the FireBug data of the case that I mention :





Sometimes it happens to JPG loading too.

What should I do to have the best performance?
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hello,

1) Don't buffer the whole image in memory before sending it to the browser, stream it. This will save on garbage collection time which might cause your application to freeze.

2) If you use a database connection pool. Make sure you release your connection when done with them. Otherwise the server might freeze until finalize is called on the pooled connection wrapper.

3) Similarly, make sure you close you image files when done reading from them. Otherwise the server might freeze until finalize is called on the file descriptors because your application runs out of file descriptor.

4) If your application is under very heavy load, you might have to fine tune the resources (file descriptors, threads or what not) that the OS makes available to your application. On linux, this is typically done with ulimit. I had to raise the file descriptor limit on some linux versions only to be able to run eclipse!

 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, make sure you have enough spare memory on the server so image files are cached in memory by the OS as much as possible, thus saving physical disk access.

On linux this is buffers/cache. You can see that I currently have about 1.3GB of disk content cached into memory on this server:



If you do not have enough spare memory on your server, the OS won't be able to cache your image files into memory. Best scenario: you have so much spare memory on your server that the OS is able to cache all your image files into memory! ;-)


 
anil cinar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I tried all you mentioned but it still same.

My server machine got 32 GB ram and my application server uses (and needs) max 400mb.

I tested my system and concluded that data gathering is not slow. When the situation is happening, I measured the page load and it was 4 seconds. However getting image ids, generating image paths and all logical jobs finishes 16msecs.

Sometimes even calling a simple jsp can take 2-3 secs.

I use windows server 2012 r2 and jdk 1.8.0.

Is it possible that the problem is the operating system ? a conflict between OS and Application Server ?

I really need help guys :)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!