i have a web application running on oracle 9i database and tomcat 5 with jdk 1.4. everything was doing fine until the # of users using the application increased (about 300 users) sessions started mixing. so i used single thread model in my servlets . sessions sttopped mixing but the application (at the peak hour) is very slow. could someone please tell me what to do? i want to get rid of the single threadmodel and keep my sessions away from mixing. does changing to another application server help? JBOSS or tomcat 6??? is there is something wrong with my code??? F1 help help
You're putting the request, response, and session into instance variables. There is only one instance of the servlet. So *every single request* is using the *same* request, response, and session values: overwriting them, reading from them, etc.
See here for more information; this is very basic Java web app stuff. There are a lot of other resources on the web covering this topic, this just happens to be among the first I found on Sun's website.
Samar: As a rule, never code instance fields in servlets. Furthermore, with servlets (and any kind of programming) you should not use an instance field as a way of "passing" data. I.e., don't have routine A place something in an instance field because you're about to call method B, which needs that value. Instead, simply pass the value to B as a parameter. In your code, pass the request object to performTask(). (And it should pass the request to any routines it calls that need it.)
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...