By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,985 Members | 1,574 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,985 IT Pros & Developers. It's quick & easy.

like mod_python but in the kernel????

P: n/a
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, ms fcil...ms Internet.
http://www.telesat.com.co/

Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

Jul 18 '05 #2

P: n/a
"Martin v. Lwis" <ma****@v.loewis.de> 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
Jul 18 '05 #3

P: n/a
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

Jul 18 '05 #4

P: n/a
Camilo Olarte <co*****@telesat.com.co> 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.
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.