Re: Recommendation for small, fast, Python based web server

Discussion in 'Python' started by Antoine Pitrou, Dec 11, 2009.

  1. Hello,

    > I've looked at the web servers that come bundled with the Python
    > standard library[1] and they are too slow.


    Apparently you have debugged your speed issue so I suppose you don't have
    performance problems anymore. Do note, however, that Python is generally
    not as fast as C -- especially for low-level stuff -- and a Python Web
    server will probably serve around 10x less requests per second than a C
    Web server like Apache (this will still give you hundreds of simple
    requests per second on a modern machine).

    In any case, as far as functionality, robustness, portability and
    community support are concerned, you probably can't go wrong with Twisted.

    Regards

    Antoine.
     
    Antoine Pitrou, Dec 11, 2009
    #1
    1. Advertising

  2. On 11-12-2009 14:52, Antoine Pitrou wrote:
    >
    > Hello,
    >
    >> I've looked at the web servers that come bundled with the Python
    >> standard library[1] and they are too slow.

    >
    > Apparently you have debugged your speed issue so I suppose you don't have
    > performance problems anymore. Do note, however, that Python is generally
    > not as fast as C -- especially for low-level stuff -- and a Python Web
    > server will probably serve around 10x less requests per second than a C
    > Web server like Apache (this will still give you hundreds of simple
    > requests per second on a modern machine).


    I don't think that number is fair for Python. I think a well written
    Python web server can perform in the same ballpark as most mainstream
    web servers written in C. Especially Apache, which really isn't a top
    performer. And I'm pretty sure a well written Python server can
    outperform a badly written C based server easily.

    -irmen
     
    Irmen de Jong, Dec 11, 2009
    #2
    1. Advertising

  3. Le Fri, 11 Dec 2009 19:40:21 +0100, Irmen de Jong a écrit :
    >
    > I don't think that number is fair for Python. I think a well written
    > Python web server can perform in the same ballpark as most mainstream
    > web servers written in C. Especially Apache, which really isn't a top
    > performer. And I'm pretty sure a well written Python server can
    > outperform a badly written C based server easily.


    The order of magnitude I gave is based on real-world testing. You are
    under-estimating how much of an impact Python's interpretation speed has
    on low-level code. Even Apache *is* a top performer compared to Python
    web servers.
     
    Antoine Pitrou, Dec 12, 2009
    #3
  4. Antoine Pitrou

    Aahz Guest

    In article <>,
    Antoine Pitrou <> wrote:
    >
    >Apparently you have debugged your speed issue so I suppose you don't have
    >performance problems anymore. Do note, however, that Python is generally
    >not as fast as C -- especially for low-level stuff -- and a Python Web
    >server will probably serve around 10x less requests per second than a C
    >Web server like Apache (this will still give you hundreds of simple
    >requests per second on a modern machine).


    For static pages or dynamic pages? Once you get into dynamic pages, I
    sincerely doubt that the smaller Apache overhead makes lots of
    difference.
    --
    Aahz () <*> http://www.pythoncraft.com/

    Looking back over the years, after I learned Python I realized that I
    never really had enjoyed programming before.
     
    Aahz, Dec 25, 2009
    #4
  5. Antoine Pitrou

    mdipierro Guest

    This is a new wsgi web server implemented in a single file.

    http://code.google.com/p/web2py/source/browse/gluon/sneaky.py

    I could use some help with testing.

    Here is a version for Python 3.0

    http://code.google.com/p/web2py/source/browse/gluon/sneaky.py


    Massimo

    On Dec 25, 12:38 pm, (Aahz) wrote:
    > In article <>,
    > Antoine Pitrou  <> wrote:
    >
    >
    >
    > >Apparently you have debugged your speed issue so I suppose you don't have
    > >performance problems anymore. Do note, however, that Python is generally
    > >not as fast as C -- especially for low-level stuff -- and a Python Web
    > >server will probably serve around 10x less requests per second than a C
    > >Web server like Apache (this will still give you hundreds of simple
    > >requests per second on a modern machine).

    >
    > For static pages or dynamic pages?  Once you get into dynamic pages, I
    > sincerely doubt that the smaller Apache overhead makes lots of
    > difference.
    > --
    > Aahz ()           <*>        http://www.pythoncraft.com/
    >
    > Looking back over the years, after I learned Python I realized that I
    > never really had enjoyed programming before.
     
    mdipierro, Dec 25, 2009
    #5
  6. Le Fri, 25 Dec 2009 10:38:19 -0800, Aahz a écrit :
    > In article <>,
    > Antoine Pitrou <> wrote:
    >>
    >>Apparently you have debugged your speed issue so I suppose you don't
    >>have performance problems anymore. Do note, however, that Python is
    >>generally not as fast as C -- especially for low-level stuff -- and a
    >>Python Web server will probably serve around 10x less requests per
    >>second than a C Web server like Apache (this will still give you
    >>hundreds of simple requests per second on a modern machine).

    >
    > For static pages or dynamic pages? Once you get into dynamic pages, I
    > sincerely doubt that the smaller Apache overhead makes lots of
    > difference.


    For static pages. Yes, I guess the difference for dynamic pages would
    indeed be quite small. Especially if database activity is also involved.

    Regards

    Antoine.
     
    Antoine Pitrou, Dec 26, 2009
    #6
  7. Antoine Pitrou

    Guest

    , Dec 27, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel
    Replies:
    1
    Views:
    330
    clintonG
    Jul 10, 2004
  2. Michele Simionato

    Python is darn fast (was: How fast is Python)

    Michele Simionato, Aug 23, 2003, in forum: Python
    Replies:
    13
    Views:
    590
  3. mir nazim
    Replies:
    7
    Views:
    570
    Brian Kelley
    Nov 24, 2003
  4. John Benson
    Replies:
    0
    Views:
    315
    John Benson
    Nov 22, 2003
  5. excord80
    Replies:
    17
    Views:
    859
    J Kenneth King
    Jan 29, 2009
Loading...

Share This Page