[Tutor] Python fast enough for ad server?

Eric Walstad eric at ericwalstad.com
Sat May 12 17:53:48 CEST 2007


Hi OkaMthembo,

Again, are you sure you need it?  Have you done any benchmarking yet?
It looks like you have to run Psyco on 32 bit x86 architecture.  That
may limit other parts of your system design that you want to speed up by
running on x86-64, for example.  OTOH, it's easy to add/remove psyco (at
least it was easy to add it to one of my Django projects in the past).

I think it's good to consider possible bottle necks at design time.
Just remember that your assumptions may be wrong yielding your premature
optimizations useless.  Psyco may help, it may not.  I suspect that you
won't need it because Python is pretty darned fast already and the
Python web-framework guys are *really smart* and have done the much of
the optimization for you already.

Best regards,

Eric.

OkaMthembo wrote:
> Hi guys,
> 
> I stumbled upon a tool called Psyco (http://psyco.sourceforge.net/) sounds
> like what i need.
> 
> Thanks again,
> 
> Lloyd
> 
> On 5/10/07, OkaMthembo <zebra05 at gmail.com> wrote:
>>
>> Thanks for all your contributions. i think i will do it all in Python, it
>> seems to me that the advantages far outweigh any negatives.
>>
>> Maybe once its a working project, we can then benchmark the code and see
>> what gives.
>>
>> Thanks again,
>>
>> Lloyd
>>
>> On 5/9/07, Eric Walstad <eric at ericwalstad.com> wrote:
>> >
>> > Hey OkaMthenbo,
>> >
>> > OkaMthembo wrote:
>> > > Hi guys,
>> > >
>> > > I need to write an ad-serving application and i'm using Win XP as my
>> > dev
>> > > platform. Naturally, i want it to be as painless as possible and i
>> was
>> > > thinking of writing it 100% in Python. However, i have not written
>> any
>> >
>> > > big apps in the language and i wonder if Python would have the
>> > > performance or scale fast enough to a large user base.
>> > Most certainly for some definitions of 'large'  :)
>> >
>> > Most web apps these days are not written in a single
>> language/technology
>> >
>> > and are often not running on a single piece of hardware.  If you search
>> > the archives of your favorite Python web application framework I'm
>> > pretty sure you'll find a discussion on how to scale your app to handle
>> > a 'large' user base.  At the risk of oversimplification, but in
>> hopes of
>> > avoiding premature optimization, I'd focus first on achieving working
>> > code, then benchmark it, then optimize if optimization is still needed.
>> >
>> > Many others have achieved high volume Python web apps using a mix of
>> all
>> > the wonderful open source tools available.  If your content doesn't
>> > change quickly and the ratio of GETs/POSTs is high, a caching server in
>> > front of your python app might be just the trick (memcached,
>> squid,etc).
>> > But don't waste your time if you don't need to.  Define 'too slow' and
>> > then prove to yourself that your app passes that threshold.  If so,
>> then
>> >
>> > figure out why it's slow and optimize the slow parts.
>> >
>> > Good luck,
>> >
>> > Eric.


More information about the Tutor mailing list