Solved

How to configure apache for optimal execution of python programs

Posted on 2011-03-21
4
378 Views
Last Modified: 2012-05-11
How can the apache web server be configured for optimal execution of external python programs which include many libraries such as numpy and scipy and Gnuplot and home-grown python libs ?

Currently we simply use a CGI interface to launch the python programs in a bash shell script, but this is probably not optimal because it loads and initializes python and all the included python libs every time - unless apache somehow caches these things, I don't know.

Would it be enough to make sure the "mod_python" is linked in ? How can I do that? I am not the web sysadmin, but of course I can request info and changes.
0
Comment
Question by:Phazz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 5

Accepted Solution

by:
-Richard- earned 500 total points
ID: 35180072
It's not enough simply to make sure that mod_python is linked in.  Mod_python allows you to execute Python code in an extremely efficient manner that does not require reloading the interpreter on every call.  However, the Python code invoked has to follow all the usual conventions of Web programming.
0
 
LVL 5

Expert Comment

by:-Richard-
ID: 35180117
In other words, it has to process a request and format a response.  I presume that your external programs do not do this in their current form.  As a result, some effort would be required to rewrite these programs so that they could be callable as methods from front end programs which you would have to write, that would be web-aware and would perform necessary request and response processing.

The following article gives a good brief overview of how to interface Python modules with the Web and use mod_python to do it:  http://onlamp.com/pub/a/python/2003/10/02/mod_python.html.

So it would not be trivial to accomplish what you need, but I doubt the effort would be prohibitive either, and you would indeed end up with an efficient system that's way faster than CGI, which you have correctly recognized as being very slow.
0
 
LVL 5

Expert Comment

by:-Richard-
ID: 35180165
Addendum: I said  << I presume your external prgrams do not do this in their current form... >>,   but that was probably not exactly true.  As CGI programs they do perform request and response processing of a sort, but to work under mod_python they would require modifications.   For more details, refer to the mod_python documentation here:  http://www.modpython.org/live/current/doc-html/
0
 

Author Closing Comment

by:Phazz
ID: 35180740
Thanks for your helpful information.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing Python 2.7.3 version on Windows operating system For installing Python first we need to download Python's latest version from URL" www.python.org " You can also get information on Python scripting language from the above mentioned we…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question