Server processes, static variables

Discussions

Web tier: servlets, JSP, Web frameworks: Server processes, static variables

  1. Server processes, static variables (2 messages)

    Hi,
       I have a question regarding how the web server handles multiple jsp pages.
    Question 1 :
    ------------
    Is there just one process and multiple threads?
    Is this the rule? Wouldn't there be a problem at times of high load?

    Question 2:
    -----------
       I have a class which has a static variable. On first call, the static variable is initialised. After that, I don't. This works across JSP pages.
       Can I depend on this behaviour? Are there any exceptions?

    Thanks in advance!
    Manoj Joseph
  2. Server processes, static variables[ Go to top ]

    Question 1 :
    ------------
    Is there just one process and multiple threads?

    answer :
    ---------
    if you are not implementing single thread model
    it is one process & multiple threads...
    no there want be any load issue .. infact if you are
    going for single thread model .. there might be one..

     
    answer-2:
    ---------
    if you are using static or class level variables
    you need to ensure thread safety otherwise
    there might be an expected behaviour .
  3. Server processes, static variables[ Go to top ]

    if you are not implementing single thread model

    > it is one process & multiple threads...

    Let me get this straight. There is only one instance of the JVM - only one process no matter how many JSPs there might be. In other words, if I have N JSP pages, all of them are serviced by this process.

    Did I get this correct?

    Now my problem is, a process (on any OS) will have limits - max address space, files open... Wouldn't this be a problem? Does the JVM take care of managing these resources.

    Could someone answer?

    Regards,
    Manoj