Hi is there any cache or settings of the jvm to speed up methods call?
e.g: I do have a web service and when I call it once per 10minutes or so it's quite slow processing takes around 8-10s in comparison to calling it once per 20seconds-the result is roughly around 5s.
Nothing else except this is running on the server. Is there a way to speed it up? (I cannot cache any objects or so.)
I used JProfiler, I call it with the same parameters. It's doing exatly the same thing. The difference is between times when I call it. How long the server is idle. 1 or 30minutes is difference.
EDIT: platform is: AIX java: IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc64-64 .. server: tomcat
Factors which could explain such behavior:
-serveroption is basically a preset configuration for the JVM.
Investigating such kind of issue can be hard. I would suggest you try to correlated OS-level information with JVM-level information. A profiler is maybe not the best tool, try with
Try also to identify the deviation between different typical scenario, e.g. first request after startup, request under heavily load, request under medium load, etc. Try to identify when the response time change.
Use a Profiler.
JProfiler would be a good choice.
Using a profiler you can identity hotspots in your code. Once you have indentified those hotspots you can think about various way to improve those hot spots in terms of space and time.
Apart from improving the code itself, make sure the JVM that runs the server is the server vm and not the client vm. Use the -server parameter.
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
To find out what you run on production you can programmatically do:
which should give you something like: Java HotSpot(TM) 64-Bit Server VM
Otherwise (if you don't want to touch the code) you can do a thread dump and have a look at the top for something like: Full thread dump Java HotSpot(TM) Server VM (16.0-b13 mixed mode)
Slowness after an idle period is usually caused by the process being swapped out to disk. Modern systems are never idle, and systems like Windows aggressively swap background processes out (non-focus os enough) which frequently happened to Eclipse users.
Please edit your question with information about your platform.
How much load is the server under? After 10 minutes a heavily loaded server has probably swapped out your service to disk or (depending on the server software) shut down the instance of your service that served the last request. This means spooling up the service for your new request is really slow.
A couple of ways you could solve this: