logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: mod_python recompiling vs passing variables
Author
Teresa



Joined: 13 Mar 2007
Posts: 2
Location: California

PostPosted: Tue 08 May '07 21:15    Post subject: mod_python recompiling vs passing variables Reply with quote

Hi all,
I have a project that runs a Flash swf that passes a variable when it calls a python script that calls another swf...etc.

I loaded mod_python to speed up the python load and that worked...except that I seem to defeat that when the variable changes.

I don't want the python code to have to recompile everytime the variable changes. I also don't want it to skip the python if the variable doesn't change. I saw what seemed like a "caching" problem when the variable didn't change.

Can someone please recommend a good source to explain Apache caching for this kind of scenario or mod_python compiling versus variable handling on the http call. I have already checked the Apache doc's and the mod_python docs. And if it isn't already apparent, yes I am a newbie.

Thanks,
Teresa
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Wed 09 May '07 17:01    Post subject: Reply with quote

There is nothing in Apache (that I know of) which would cache responses differently for mod_python vs. a python script via cgi.

One possibility is that you have something in a python global variable.

With mod_python your global variables will retain their value between requests, unlike when you used cgi.
They wil also be shared among simultaneous requests.

Maybe this is tripping you up?

-tom-

p.s. What platform are you running on, and what version of Apache/Python/mod_python do you use? Just curious...

I built a mod_python v3.3.1 for Apache 2.2.4 (the VC8 variant - from Apache Lounge) and Python 2.5 on Windows.
I'll post a download link if you, or anyone else, is interested.
Back to top
Teresa



Joined: 13 Mar 2007
Posts: 2
Location: California

PostPosted: Wed 09 May '07 18:12    Post subject: mod_python recompiling vs passing variables Reply with quote

Hi Tom,
Thanks for the reply. I did figure out that I needed to be careful about initializing global variables.

I am on Widows XP, Apache 2.2.3, Python 2.4.3, mod_python 3.3.1

Here is another interesting part of the puzzle that I am working. I have a benchmark log with time stamps when the python gets loaded and when it really starts. It is twice as fast on my old single processor machine at home, as opposed to the quad processor at school. I personally configured the Apache and Python in both places the same. Any ideas where to look for the "lost time?" What would impact the loading time for about 11 modules? It would be a 6 second improvement for the user experience.

Thanks,
Teresa
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Wed 09 May '07 18:44    Post subject: Reply with quote

That's curious!

Slower disks on the machine at school?
Does the school machine store your .py files on a remote disk?

One possibility is that it is the additional overhead in Python to support multiple cpus, although this seems unlikely.
An experiment might be to re-boot the school machine and disable all but one cpu in the BIOS, if this is available in your BIOS.

There is a Set affinity feature in Windows Task Manager to restrict a process to a specific cpu, but this probably isn't such a good test.
Python starts up differently for single vs. multiple cpu systems.
Changing the affinity in Task Manager would only affect the httpd process after Python started up.

-tom-
Back to top


Reply to topic   Topic: mod_python recompiling vs passing variables View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules