like mod_python but in the kernel????

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Camilo Olarte

    like mod_python but in the kernel????

    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 acgi
    script from 4 Requests/second to aprox 140 Requests/second.


    Camilo Olarte






    Telesat, más fácil...más Internet.


  • Martin v. Löwis

    #2
    Re: like mod_python but in the kernel????

    Camilo Olarte wrote:[color=blue]
    > 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 ?[/color]

    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.
    [color=blue]
    > I mean can python interpreter be loaded as module of the kernel and thus making
    > execution of python scripts faster ???[/color]

    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.
    [color=blue]
    > Is there something perverse in this way of thinking????[/color]

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

    Regards,
    Martin

    Comment

    • JanC

      #3
      Re: like mod_python but in the kernel????

      "Martin v. Löwis" <martin@v.loewi s.de> schreef:
      [color=blue]
      > Camilo Olarte wrote:[color=green]
      >> 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 ?[/color]
      >
      > 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.[/color]

      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

      Comment

      • Martin v. Löwis

        #4
        Re: like mod_python but in the kernel????

        JanC wrote:
        [color=blue]
        > Then embed Python in the shell instead of in the kernel... ;-)[/color]

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

        Regards,
        Martin

        Comment

        • David M. Wilson

          #5
          Re: like mod python but in the kernel????

          Camilo Olarte <colarte@telesa t.com.co> wrote...
          [color=blue]
          > I mean can python interpreter be loaded as module of the kernel and thus
          > making execution of python scripts faster ???[/color]
          [color=blue]
          > I know that pypy is on the way , probably making python execution faster.[/color]

          That's an interesting conclusion. :)

          [color=blue]
          > Just daydreaming of this python kernel module stuff.[/color]

          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.

          Comment

          Working...