Mailing List Archive

High performance Python on NT
Hi!

I am about to start a project where I will need to do some high performance
Web CGI scripts on WinNT ... I have no choice ... I know it's not the best
combination. It's not my decision ;-) I am looking for some advice. Is it
better if I use some kind of Active Python Scripting Page (ASP but with
Python)? Or just doing CGI with threads it will be fine... ?

I know this is a very vague question... I just want to know if someone had
to take a similar decision... The app I will be doing should support several
hundred users connecting to the Web server and doing some serious CGI
activity ... Almost all hits that the server will receive will be scripts.
The hardware is no problem in this case... When can scale up to Quad PII
Xeon with 1GB RAM ... U2W SCSI discs...

I know exactly what to do in a UNIX env... but I am not sure of the
decision to take regarding win32...

TIA

/B

Bruno Mattarollo <bmatt@acm.org>
... proud to be a PSA member <http://www.python.org/psa>
<http://starship.python.net/crew/bmatt/>
High performance Python on NT [ In reply to ]
In article <000301beb3b7$4f973810$6eba0ac8@kuarajy.infosys.com.ar>,
Bruno Mattarollo <bmatt@acm.org> wrote:
>Hi!
>
> I am about to start a project where I will need to do some high performance
>Web CGI scripts on WinNT ... I have no choice ... I know it's not the best
>combination. It's not my decision ;-) I am looking for some advice. Is it
>better if I use some kind of Active Python Scripting Page (ASP but with
>Python)? Or just doing CGI with threads it will be fine... ?
>
> I know this is a very vague question... I just want to know if someone had
>to take a similar decision... The app I will be doing should support several
>hundred users connecting to the Web server and doing some serious CGI
>activity ... Almost all hits that the server will receive will be scripts.
>The hardware is no problem in this case... When can scale up to Quad PII
>Xeon with 1GB RAM ... U2W SCSI discs...
>
> I know exactly what to do in a UNIX env... but I am not sure of the
>decision to take regarding win32...
.
.
.
ASP is likely to perform a lot better than CGI in
the situation you describe.

It depends on details, though. It's possible that
there will be enough constraints elsewhere in your
system that users won't notice the difference. If
CGI is much easier for you, start with that.

I don't understand "CGI with threads". I suspect
there's a misconception, or at least a vocabulary
mismatch, afoot.
--

Cameron Laird http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com +1 281 996 8546 FAX
High performance Python on NT [ In reply to ]
Bruno Mattarollo wrote:
>
> Hi!
>
> I am about to start a project where I will need to do some high performance
> Web CGI scripts on WinNT ... I have no choice ... I know it's not the best
> combination. It's not my decision ;-) I am looking for some advice. Is it
> better if I use some kind of Active Python Scripting Page (ASP but with
> Python)? Or just doing CGI with threads it will be fine... ?
>
> I know this is a very vague question... I just want to know if someone had
> to take a similar decision... The app I will be doing should support several
> hundred users connecting to the Web server and doing some serious CGI
> activity ... Almost all hits that the server will receive will be scripts.
> The hardware is no problem in this case... When can scale up to Quad PII
> Xeon with 1GB RAM ... U2W SCSI discs...
>
> I know exactly what to do in a UNIX env... but I am not sure of the
> decision to take regarding win32...
>
> TIA
>
> /B
>
> Bruno Mattarollo <bmatt@acm.org>
> ... proud to be a PSA member <http://www.python.org/psa>
> <http://starship.python.net/crew/bmatt/>

Run, don't walk, to http://www.zope.org. You'll think you've died and gone to
heaven.

--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com
High performance Python on NT [ In reply to ]
Tres Seaver wrote:
> Run, don't walk, to http://www.zope.org. You'll think you've died and gone to
> heaven.

I looked at Zope a little while ago, and it did seem rather exciting.
Depends a little bit on your constraints, though, whether it's the
right solution. I had a project that needed to be hosted via a commercial
hosting provider, and nobody was willing to run Zope unless I rented
a dedicated server. (Actually, not really nobody, but with web hosting
providers it can be devastatingly bad to become dependent on a single
hosting service unless you've got a lot of prior positive experience
with them.)

I chose instead to go with a solution using the Java "servlet" interface
(instead of CGI), and writing JPython (http://www.jpython.org/) servlets
instead of Java servlets. Don't know if this could be considered a
"high-performance" solution; it avoids the process creation and
DB connection overhead of CGI solutions, but JPython is inherently
slower than Python. So, depends what sort of performance matters.
I expect JPython to be fine as long as I'm not too compute-intensive;
we'll see. In this model, if I run into performance bottlenecks
I can improve things by selectively rewriting code into Java.

(I did have a few other concerns about Zope: I wanted to do some
non-hierarchical design, and found that the limited documentation
made attempting such a thing difficult. Still, I hope to have
an excuse to learn/use Zope someday in the future.)

Robert Wentworth
High performance Python on NT [ In reply to ]
"Bruno Mattarollo" <bmatt@acm.org> writes:

> I am about to start a project where I will need to do some high
> performance Web CGI scripts on WinNT ... I have no choice ... I know
> it's not the best combination. It's not my decision ;-) I am looking
> for some advice. Is it better if I use some kind of Active Python
> Scripting Page (ASP but with Python)? Or just doing CGI with threads
> it will be fine... ?

CGI is simply not high performance. If you throw enough hardware at it,
I can be OK, but if you are getting a large amount of hits, the overhead
of starting Python interpreter (or Perl or whatever) every time a script
is head, is going to kill you.

PHP as an Apache module is a speed demon.

As was suggested already, look closely at Zope (www.zope.org) or the
components Zope is built from. It uses a daemon for the python
interpreter, thus elimiting the overhead of CGI.

I was doing a test last night on Zope, and it easily handled several
hits per second on my old P133 linux box.

--
Alex Rice | alrice@swcp.com | http://www.swcp.com/~alrice
Current Location: N. Rio Grande Bioregion, Southwestern USA
High performance Python on NT [ In reply to ]
R Wentworth <rhww@erols.com> writes:

> Tres Seaver wrote:
> > Run, don't walk, to http://www.zope.org. You'll think you've died and gone to
> > heaven.

Agreed, I just used Zope for a project here to replace some java servlet code
which was under-performing. After convincing my bosses to let me demo it,
I got the go ahead. A month later I am running a web based administration
system that is nice and fast, and pretty bullet proof to boot. I actually
used the ZPublisher part of the system and pretty much ignored the templates
and IDE just because I like the hands on approach, and also I wanted to use
the existing Java Servlet templates, which used a different mark-up to the
DTML stuff in Zope.

It was a dream to develop in.

>
> I looked at Zope a little while ago, and it did seem rather exciting.
> Depends a little bit on your constraints, though, whether it's the
> right solution. I had a project that needed to be hosted via a commercial
> hosting provider, and nobody was willing to run Zope unless I rented
> a dedicated server. (Actually, not really nobody, but with web hosting
> providers it can be devastatingly bad to become dependent on a single
> hosting service unless you've got a lot of prior positive experience
> with them.)

Zope can run in a number of ways though. We use it as a back end to an
existing web-server (in fact website pro since we are using NT as the
OS, the work I did was developed in Linux though because I prefer the
taste of it :-). You do need to run it has a process (UNIX) or a
service (NT) but apart from this and a suitable re-direct on an existing
web server, it has fairly minimal impact.

>
> I chose instead to go with a solution using the Java "servlet" interface
> (instead of CGI), and writing JPython (http://www.jpython.org/) servlets
> instead of Java servlets. Don't know if this could be considered a
> "high-performance" solution; it avoids the process creation and
> DB connection overhead of CGI solutions, but JPython is inherently
> slower than Python. So, depends what sort of performance matters.
> I expect JPython to be fine as long as I'm not too compute-intensive;
> we'll see. In this model, if I run into performance bottlenecks
> I can improve things by selectively rewriting code into Java.

Well, the Java servlet stuff did not perform as we wanted it too which was
why we started this in the first place. In fairness it was not the servlet
framework itself that was the problem, but rather some of the support
libraries which would not perform quickly or reliably enough.

>
> (I did have a few other concerns about Zope: I wanted to do some
> non-hierarchical design, and found that the limited documentation
> made attempting such a thing difficult. Still, I hope to have
> an excuse to learn/use Zope someday in the future.)

Agreed, it took me about a week of playing to really "get it" but after
I did, it was smooth sailing from there. I would recommend looking into
using ZPublisher directly, as it helps with understanding the rest of
the system better (at least it did for me).

>
> Robert Wentworth


Cheers

Dick