Loading ...
Sorry, an error occurred while loading the content.

SessionSerialize and MaxClients

Expand Messages
  • Philip Mak
    If the httpd only serves Apache::ASP requests and SessionSerialize is 1, then should MaxClients also be set to 1 to save memory since only one script can run
    Message 1 of 4 , Jan 9, 2004
    • 0 Attachment
      If the httpd only serves Apache::ASP requests and SessionSerialize is
      1, then should MaxClients also be set to 1 to save memory since only
      one script can run at a time anyway?

      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Josh Chamas
      ... Hi Philip, SessionSerialize only serializes access to the $Session object, so you would want to have at least as many MaxClients as there are possible
      Message 2 of 4 , Jan 11, 2004
      • 0 Attachment
        Philip Mak wrote:
        > If the httpd only serves Apache::ASP requests and SessionSerialize is
        > 1, then should MaxClients also be set to 1 to save memory since only
        > one script can run at a time anyway?

        Hi Philip,

        SessionSerialize only serializes access to the $Session object, so you would
        want to have at least as many MaxClients as there are possible concurrent
        web clients you want to support.

        I think instead if you did something like $Application->Lock in Script_OnStart,
        that would create a situation more what you are talking about where you would
        then only need MaxClients of 1 or 2, but I would still have it higher in that
        case to deal with bandwidth limited web clients that tie up the httpd process
        for longer than the script takes to execute.

        Regards,

        Josh
        ________________________________________________________________
        Josh Chamas, Founder phone:925-552-0128
        Chamas Enterprises Inc. http://www.chamas.com
        NodeWorks Link Checker http://www.nodeworks.com


        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Philip Mak
        ... Oh, so if I do $Session- {count}++; in my script, for example, then all other scripts are blocked while that line is executing, but otherwise they can
        Message 3 of 4 , Jan 11, 2004
        • 0 Attachment
          On Sun, Jan 11, 2004 at 07:40:16PM -0800, Josh Chamas wrote:
          > SessionSerialize only serializes access to the $Session object, so
          > you would want to have at least as many MaxClients as there are
          > possible concurrent web clients you want to support.

          Oh, so if I do "$Session->{count}++;" in my script, for example, then
          all other scripts are blocked while that line is executing, but
          otherwise they can execute concurrently?

          > I think instead if you did something like $Application->Lock in
          > Script_OnStart, that would create a situation more what you are
          > talking about where you would then only need MaxClients of 1 or 2,
          > but I would still have it higher in that case to deal with bandwidth
          > limited web clients that tie up the httpd process for longer than
          > the script takes to execute.

          Ahh, I see. (If the httpd process is proxied by mod_accel or something
          similar which slurps the mod_perl output and spoonfeeds it to a slow
          client, then I assume the mod_perl httpd's MaxClients could be 1 when
          Script_OnStart calls $Application->Lock?)

          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Josh Chamas
          ... Only scripts executing with the same $Session object ( referenced by session-id ) would be blocked. When SessionSerialize is set, the $Session object is
          Message 4 of 4 , Jan 11, 2004
          • 0 Attachment
            Philip Mak wrote:
            > On Sun, Jan 11, 2004 at 07:40:16PM -0800, Josh Chamas wrote:
            >
            >>SessionSerialize only serializes access to the $Session object, so
            >>you would want to have at least as many MaxClients as there are
            >>possible concurrent web clients you want to support.
            >
            >
            > Oh, so if I do "$Session->{count}++;" in my script, for example, then
            > all other scripts are blocked while that line is executing, but
            > otherwise they can execute concurrently?
            >

            Only scripts executing with the same $Session object ( referenced by session-id )
            would be blocked. When SessionSerialize is set, the $Session object is locked
            during script execution allowing for only one concurrent script executing at
            a time for the web client sending the session-id. Without SessionSerialize set,
            the command $Session->{count}++ only locks the $Session object for the duration
            of the read & write operations as applicable. This would *not* be an atomic operation,
            and the only way to do this to ensure it atomic would be to:

            $Session->Lock;
            $Session->{count}++;
            $Session->UnLock;

            unless you had SessionSerialize set.

            So, with SessionSerialize set, scripts can be executed concurrently assuming
            that all the web clients coming in have different session-ids which they should.

            >
            > Ahh, I see. (If the httpd process is proxied by mod_accel or something
            > similar which slurps the mod_perl output and spoonfeeds it to a slow
            > client, then I assume the mod_perl httpd's MaxClients could be 1 when
            > Script_OnStart calls $Application->Lock?)
            >

            Yes, but even then, to get maximum capacity, I would probably have 2 MaxClients,
            since part of the request stage is handled outside the Apache::ASP handler.
            But doing something like $Application->Lock is probably a bad idea generally,
            so I hope this is just a theoretical discussion :-)

            Regards,

            Josh
            ________________________________________________________________
            Josh Chamas, Founder phone:925-552-0128
            Chamas Enterprises Inc. http://www.chamas.com
            NodeWorks Link Checker http://www.nodeworks.com


            ---------------------------------------------------------------------
            To unsubscribe, e-mail: asp-unsubscribe@...
            For additional commands, e-mail: asp-help@...
          Your message has been successfully submitted and would be delivered to recipients shortly.