Servlet request getparameter's performance

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2010-04-03T12:02:41Z Indexed on 2010/04/03 12:13 UTC
Read the original article Hit count: 315

Filed under:
|
|

Hi,

I noticed that my app is very slow sometimes, so I've done some tests. It's a very simple web app. One servlet gets some parameters than stores them. Everything's fine except one thing. It takes too long to get a parameter for the first time. It doesn't matter which parameter I try to get, but for the first time it is very slow. The strange thing is this doesn't happen always. Sometimes getting a parameter for the first time is not slow.

My code looks like this

request.getParameter("paramName");
request.getParameter("paramName2");
request.getParameter("paramName3");

Getting "paramName" is slow. Getting the others is very fast.

By slow I mean : 200-800 millisec By very fast I mean: ~0 millisec (in the code snippet, I didn't write the performance test, but I'm using System.currentTimeMillis())

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets