[mod_python] Questions about PSP vs other solutions

Jim Gallacher jpg at jgassociates.ca
Fri Feb 17 11:57:20 EST 2006


Luis M. Gonzalez wrote:
> Hi there,
> 
> I would highly appreciate if someone sheds some light over these 
> questions I have...
> I've been reading an old post from 2003, where Sterling Hughes, Rimon 
> Barr and others were discussing about
> the convenience, advantages and disadvantages of including PSP into 
> mod_python ("supporting modular mod_python extensions vs."folding" 
> mod_psp")
> There were many parts that seemed to contradict each point of view, but 
> I selected two paragraphs that best illustrate the issue:
> 
> 
> Sterling Hugues:
> "PSP is a very small, very fast alternative, it doesn't preclude you from
> using any of the listed solutions.  In fact you can use PSP in
> conjunction with any of the solutions listed, or you can even ignore its
> existence altogether and use something else, or code directly with
> req.write().  There is *zero* performance loss if you choose to use
> another option, like spyce."
> 
> Rimon Barr:
> "I saw that you were working on a C-based
> parser for psp, and I asked you whether you were interested in working
> on such a parser for the Spyce language. The rationale is that although
> the parser does not matter much for performance, because the compiled
> files are cached, it would be nice as an option for developers, since
> the current Spyce parser is implemented in Python and is relatively
> slow. I also, thinking that you work with the Apache Foundation, I
> offered to donate Spyce to the AF. Donating to the AF does not mean, in
> my mind, merging the Spyce and mod_python projects."
> 
> 
> So both seem to agree in that being PSP a c-based parser is a good 
> thing, because it is very fast.
> However, both of them consider also that it doesn't matter, because the 
> compiled files are cached (?)
> and there's *zero* performance lost when choosing another option.
> Hence, what's the advantage of using PSP?
> If using any other solution has zero performance lost, why bother in 
> writing a c-based parser?
> 
> Maybe I lost some important detail of the discussion, or my limited 
> english played against me, but isn't it contradictory?

It does seem contradictory, so I guess your english is just fine. :)

I haven't read the thread, but I think Sterling means that there is no 
performance penalty if the psp parser is included in mod_python but not 
actually used by the application developer.

On the other hand, Rimon seems concerned about the actual parser 
performance so I think the subject of the thread may have diverged at 
some point.

I don't agree that there is no performance penalty. You need to parse 
the file at least once when it is first encountered. Depending on your 
cache implementation, you may have one cache per intepreter, so for a 
prefork mpm you'll need to parse the file once for each apache child 
process. Also, a cache may have some sort of size limit, so less 
frequently used files may be removed from the cache and need to be 
parsed on the next encounter.

The impact of these factors will likely differ between websites and it's 
probably a mistake to make any sweeping generalizations. The only way to 
tell if the parser speed is important to you is to profile your website. 
For example, I would guess that the parser performance would be 
important on a website with a large number of pages which are not viewed 
frequently, such as 50,000 pages each visited once a day. On the other 
hand the cache performance will be much more significant if you have 10 
pages that are visited 5000 times in a day.

Jim


More information about the Mod_python mailing list