like mod_python but in the kernel????

Discussion in 'Python' started by Camilo Olarte, Feb 5, 2004.

  1. Hi list,

    I was wondering :

    If python cgi scripts can be acceletaded by means of mod_python in apache
    (loading the python interpreter on apache) , then : ?Is there a way of doing
    the same but with linux kernel... and command line scripts ?

    I mean can python interpreter be loaded as module of the kernel and thus making
    execution of python scripts faster ???

    Is there something perverse in this way of thinking????

    I know that pypy is on the way , probably making python execution faster.

    Just daydreaming of this python kernel module stuff.


    NOTE: I have no problem with actual python speed. It's just that mod_python
    stuff calls my attention because it icrements the speed of execution of a cgi
    script from 4 Requests/second to aprox 140 Requests/second.


    Camilo Olarte






    Telesat, más fácil...más Internet.
    http://www.telesat.com.co/
    Camilo Olarte, Feb 5, 2004
    #1
    1. Advertising

  2. Camilo Olarte wrote:
    > If python cgi scripts can be acceletaded by means of mod_python in apache
    > (loading the python interpreter on apache) , then : ?Is there a way of doing
    > the same but with linux kernel... and command line scripts ?


    No. mod_python reduces startup speed because it performs all the import
    actions that occur when Python starts. The same is not possible with the
    command line, as memory that the kernel allocates is not accessible to
    applications.

    > I mean can python interpreter be loaded as module of the kernel and thus making
    > execution of python scripts faster ???


    No !!! Instead, to reduce startup time, you need to first find out why
    startup is slow. There are many theories; mine is that usage of shared
    libraries for extension module increases startup time.

    > Is there something perverse in this way of thinking????


    No!!!! Just in your usage of punctuation :)

    Regards,
    Martin
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=, Feb 6, 2004
    #2
    1. Advertising

  3. Camilo Olarte

    JanC Guest

    "Martin v. Löwis" <> schreef:

    > Camilo Olarte wrote:
    >> If python cgi scripts can be acceletaded by means of mod_python in
    >> apache (loading the python interpreter on apache) , then : ?Is there
    >> a way of doing the same but with linux kernel... and command line
    >> scripts ?

    >
    > No. mod_python reduces startup speed because it performs all the
    > import actions that occur when Python starts. The same is not possible
    > with the command line, as memory that the kernel allocates is not
    > accessible to applications.


    Then embed Python in the shell instead of in the kernel... ;-)

    --
    JanC

    "Be strict when sending and tolerant when receiving."
    RFC 1958 - Architectural Principles of the Internet - section 3.9
    JanC, Feb 6, 2004
    #3
  4. JanC wrote:

    > Then embed Python in the shell instead of in the kernel... ;-)


    That would work. Alternatively, you could make /usr/bin/python
    your login shell, in the first place.

    Regards,
    Martin
    =?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?=, Feb 7, 2004
    #4
  5. Re: like mod python but in the kernel????

    Camilo Olarte <> wrote...

    > I mean can python interpreter be loaded as module of the kernel and thus
    > making execution of python scripts faster ???


    > I know that pypy is on the way , probably making python execution faster.


    That's an interesting conclusion. :)


    > Just daydreaming of this python kernel module stuff.


    There is probably a lot of things you can check before assuming you
    need some sort of acceleration, eg. the basics: are all the packages &
    modules your application uses compiled? Are the pycs up to date?
    Google for compileall.py.

    Is the (your) application doing an insane amount of work at startup,
    like reading a massive XML configuration file? Perhaps you could speed
    that up by caching the loaded configuration as Python syntax in a new
    file, or some other means that would make loading faster.

    Etc.


    David.
    David M. Wilson, Feb 7, 2004
    #5
    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. blbmdsmith
    Replies:
    1
    Views:
    633
    Graham Dumpleton
    Dec 14, 2006
  2. yogesh
    Replies:
    3
    Views:
    574
    Kenny McCormack
    Feb 12, 2006
  3. C Erler
    Replies:
    3
    Views:
    124
    Ara.T.Howard
    Jun 28, 2005
  4. Replies:
    3
    Views:
    159
  5. Lars Gierth
    Replies:
    6
    Views:
    212
    David Masover
    Mar 20, 2010
Loading...

Share This Page