[python-win32] Question on server architecture

Mark Hammond mhammond@skippinet.com.au
Thu, 16 Jan 2003 10:31:56 +1100


[Don]
> Oddly enough, when I ran stress tests on this setup, it was
> able to handle
> many simultaneous requests.  The difference is that the
> stress test was
> using anonymous web clients, while in production the site
> uses integrated
> authentication.  I'm not sure why this should make a
> difference, but it
> does.  The result is long wait and execution times for the
> ASP requests.

This is odd, and may be worth trying to track down.

> Question:
> I'm thinking of replacing the per-request process by a
> long-running process
> that takes requests by registering itself as a COM server.
> The problem is,
> I'm not sure that this approach will work.  The idea is that
> the client
> would instantiate an object to make the initial request, then
> dismiss the
> object.  The ping requests would operate similarly.  Thus,
> between requests,
> the server would continue (presumably in different threads)
> running the
> request processes.  Can anyone give insight as to whether
> this can/can't
> work?  (I'll probably experiment with it, so I may have more to say if
> anyone's interested.)

This is likely to work fine.  ASP will never actually unload Python, so a
long-lived server may not even need to be an issue - if your COM object uses
a module global to keep the state, then each new instance should be able to
efficiently reuse whatever you need.  This will only work if you have an
InProc server.  As Jens mentions, you may also be able to exploit an
out-of-process COM object to give you some alternative advantages.

Mark.