Multi-threading in a Python ASP page

Don Dwiggins dwig at advancedmp.net
Wed May 30 21:01:29 EDT 2001


I've inherited an ASP page (currently written in VBScript) that calls a COM
object that in turn spawns several computations in parallel, using a
jury-rigged setup written in multiple VB modules (based on the MSDN "Coffee
Watch" example).  While it works, it's complex and seems to be occasionally
unstable.  (The context is IIS 4.0 under Windows NT 4.0.)

I've implemented the functionality of the computation manager object in
Python (it spawns off threads for the parallel computations, and gets
results from them via a shared queue), and now would like to fold it into
the application.  The question is, where to put it?

One option that seems attractive on the surface, is to rewrite the ASP page
in Python (it's not large), putting the manager code directly in the page.
While it seems as though it should work, I suspect there may be downsides.
In particular, there could be as many as 10 threads going for a single
request, and there may be many requests in process simultaneously; am I
likely to run into IIS' thread pool limit or some other resource problem?
(Execution time isn't an issue; the manager spends most of its time waiting
for queued data from the worker threads, which in turn are waiting for
results from out-of-process COM objects.)

In general, what are the considerations and limitations for Python programs
in the ASP context?  For example, could I write a large application as a
Python package, then import it into an ASP page and run it there (UI issues
aside)?

-- 
Don Dwiggins                    "Solvitur Ambulando"
Advanced MP Technology
dwig at advancedmp.net





More information about the Python-list mailing list