Servlet request getparameter's performance
- by Bob
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())