I'm converting a web app from CGI to FCGI. The application works fine
under FCGI, but it's being reloaded for every request, which makes FCGI
kind of pointless. I wrote a little FCGI app which prints when the program is
loaded and when it gets a request. And indeed, the program gets reloaded for
each HTTP request. Something is probably misconfigured. But what?
I'm using Apache with "mod_fcgid" , configured via Plesk. Plesk
sets up "/etc/httpd/conf.d/fcgid.conf" with:
# added by psa-mod-fcgid-configurator
<IfModule mod_fcgid.c>
IdleTimeout 3600
ProcessLifeTime 7200
MaxProcessCount 64
DefaultMaxClass ProcessCount 8
IPCConnectTimeo ut 30
IPCCommTimeout 45
DefaultInitEnv RAILS_ENV production
</IfModule>
which seems reasonable enough, even though I'm not using
Rails or Ruby.
On the Python side, I'm using Python 2.5 on Linux, with Alan
Saddi's "fcgi.py" module.
Everything seems to work correctly, and there are no errors in the Apache
error log. But performance is terrible because the Python code
is reloaded for each request. I can only get about five transactions
a second through, on an dedicated server, with each transaction
doing a simple MySQL request. All the time is going into program loading;
the database is mostly idle.
John Nagle 7 2461
John Nagle schrieb:
I'm converting a web app from CGI to FCGI. The application works fine
under FCGI, but it's being reloaded for every request, which makes FCGI
kind of pointless. I wrote a little FCGI app which prints when the
program is loaded and when it gets a request. And indeed, the program
gets reloaded for
each HTTP request. Something is probably misconfigured. But what?
The most likely reason is that your FastCGI server voluntarily choses
to exit after one request. Can you share the mainloop of your
application?
Regards,
Martin
Martin v. Löwis wrote:
John Nagle schrieb:
> I'm converting a web app from CGI to FCGI. The application works fine under FCGI, but it's being reloaded for every request, which makes FCGI kind of pointless. I wrote a little FCGI app which prints when the program is loaded and when it gets a request. And indeed, the program gets reloaded for each HTTP request. Something is probably misconfigured. But what?
The most likely reason is that your FastCGI server voluntarily choses
to exit after one request. Can you share the mainloop of your
application?
Regards,
Martin
It turns out that's not the problem.
What's actually happening is that FCGI isn't running at all.
My .fcgi file is being executed by Apache's CGI handler, and
"fcgi.py" recognizes this, then reads the parameters as if
a CGI program. So it works just like a CGI program: one
load per request. Not sure why Apache is doing that yet.
I'm looking at Apache configuration files now.
The main loop is in "fcgi.py", which calls the
user application as a function. The user app doesn't have the
option of exiting after one request, short of aborting without
returning a result.
John Nagle
John Nagle wrote:
>
What's actually happening is that FCGI isn't running at all.
My .fcgi file is being executed by Apache's CGI handler, and
"fcgi.py" recognizes this, then reads the parameters as if
a CGI program. So it works just like a CGI program: one
load per request. Not sure why Apache is doing that yet.
I'm looking at Apache configuration files now.
Are you running mod_fastcgi oder mod_fcgid?
Disclaimer: I don't claim to be an expert in that. My web2ldap source
distribution contains two examples configuration files for each of the
modules above for FastCGI over Unix Domain Socket( see directory
<web2ldap-dir>/etc/httpd/, comments of sample-mod_fcgid.conf
misleading). web2ldap can also be deployed as (multi-threaded)
FastCGI-server.
Ciao, Michael.
Michael Ströder wrote:
John Nagle wrote:
> What's actually happening is that FCGI isn't running at all. My .fcgi file is being executed by Apache's CGI handler, and "fcgi.py" recognizes this, then reads the parameters as if a CGI program. So it works just like a CGI program: one load per request. Not sure why Apache is doing that yet. I'm looking at Apache configuration files now.
Are you running mod_fastcgi oder mod_fcgid?
I'm using mod_fcgid.
This is running on a dedicated server at APlus.net,
running Red Hat Fedora Core 6, Python 2.5, and managed with Plesk 8.2.
I just turned on fcgid from the Plesk control panel ("Physical hosting
setup page for domain", checked "FastCGI"), and enabled the standard
FCGI configuration, which is actually mod_fcgid.
The Python app is launched from "cgi-bin" with a file ending in
".fcgi". It uses Alan Saddi's "fcgi.py" module to interface with
an FCGI server. Python programs that use "fcgi.py" will also run
as standard CGI programs, for debug purposes. And that's what's
happening. I modified my test Python program to patch
"fcgi.CGIreques t._end" with a version that logged its calls,
and that's being called. This indicates that "fcgi.py" is running
in CGI mode, not FCGI mode. My test program is reloaded for every
HTTP request, as indicated by debug output, so it really is running
in CGI mode, with the expected low performance.
What's wierd is that the ".fcgi" suffix files get executed at all.
I'd expect them to be either ignored or run properly with FCGI.
John Nagle
* John Nagle (Mon, 03 Sep 2007 21:26:01 -0700)
I'm converting a web app from CGI to FCGI. The application works fine
under FCGI, but it's being reloaded for every request, which makes FCGI
kind of pointless. I wrote a little FCGI app which prints when the program is
loaded and when it gets a request. And indeed, the program gets reloaded for
each HTTP request. Something is probably misconfigured. But what?
[...]
On the Python side, I'm using Python 2.5 on Linux, with Alan
Saddi's "fcgi.py" module.
Do you use fcgi.py or flup? Go for flup
"What's the difference between flup's fcgi module and your previous
fcgi.py?
Feature-wise, very little, as I do try to keep both implementations in
sync. The most significant difference is that flup's fcgi module uses
thread pooling, fcgi.py simply starts a new thread for each
connection/request. flup's code is refactored and modularized, to
minimize duplicated code between all 6 servers." http://trac.saddi.com/flup/wiki/Flup...cebetweenflups
fcgimoduleandyo urpreviousfcgi. py
Anything executable in the
cgi-bin directory is being launched as a CGI program. A file
named "example.fo o", if executable, will launch as a CGI program.
Nothing launches with FCGI.
Perhaps you have a SetHandler declaration somewhere that makes all
files CGI by default? I would advise against Sethandler, and
recommend AddHandler instead.
Regards,
Martin
John Nagle wrote:
This is running on a dedicated server at APlus.net,
running Red Hat Fedora Core 6, Python 2.5, and managed with Plesk 8.2.
I just turned on fcgid from the Plesk control panel ("Physical hosting
setup page for domain", checked "FastCGI"), and enabled the standard
FCGI configuration, which is actually mod_fcgid.
[..]
What's wierd is that the ".fcgi" suffix files get executed at all.
I'd expect them to be either ignored or run properly with FCGI.
Then I would ask APlus.net what's really going on there.
Ciao, Michael. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: aurora |
last post by:
I am looking for a way for reloading updated modules in a long running
server. I'm not too concerned about cascaded reload or objects already
created. Just need to reload module xxx if the corresponding xxx.py is
updated.
I found something useful in module.__file__. Would it work if I use it to
generate filenames xxx.py xxx.pyc and then compare their mtime? I'm not
too sure about the mechanism of generation of .pyc file. Would it be too...
|
by: Kevin T. Ryan |
last post by:
Hi All -
I'm trying to develop web applications using python / Cheetah. I'm also
trying to experiment with lighttpd (see www.lighttpd.net), which supports
fast-cgi. So, I downloaded Robin Dunn's fcgi.py file
(http://alldunn.com/python/fcgi.py), and everything is up and running
nicely. Except, I'm a complete dummy - totally new to fast-cgi
development. Therefore, when I run lighttpd and direct it to use fcgi as
my fast-cgi app, it...
|
by: Aspersion |
last post by:
I'm building an ASP page that has a lot of text and graphics.
There is a calculation facility on the page. The user enters several
numbers in a form and presses a button to see the calculated answer.
The problem is this: when the user presses the Calculate button, the
whole page is reloaded and, on a large page, this is very noticeable.
Is there any way that I can get the calculation done and the result
displayed without reloading...
|
by: Marcia Gulesian |
last post by:
Is there a way of reloading a page programatically - for example,
<script language="javascript>
document.location.reload()
</script>
BUT NOT HAVING TO MANUALLY CLICK A "RESET" BUTTOM.
|
by: Richard |
last post by:
Hey there,
I have a textbox and a listbox. When a user types a number in the textbox, I
want to get
all the records from a MS Access DB but without reloading the page. I now
have something manual
and a user first must press a button to get the listbox filled with records
but I want to have it done
automaticly without pressing a sumbit button. I know its prolly done with
javascript but thats one thing
| |
by: Daylor |
last post by:
hi.
i want to display page.
then check every 10 seconds from the client, if a value in the server is
changed WITHOUT RELOADING THE ALL PAGE.
if value has change, i want the client to reload the page again.
|
by: thorley |
last post by:
Does any one know of a fcgi SEVER implementation for python?
I've seen lots of great stuff for the client/application side, but not
a server. By server, I mean the program that accepts requests from the
browser and passes them to the web app over fcgi. Usaually this is done
by Apace or Lightttpd, but I'm trying to reduce dependancies, so a
(pure) python implementation would be really great!
thanks
--
|
by: Tamer |
last post by:
Hi!
Is there a way to change the protocoll type through Javascript without
reloading (or making a request from the webserver) via Javascript?
for example:
http://mydomain.com -https://mydomain.com
and backwards (if possible).
|
by: Joshua Kugler |
last post by:
bryan rasmussen wrote:
They might have ported a version for Python 2.6. Versions <= 2.5 didn't
have a socket.fromfd() on Windows, so FCGI and SCGI wouldn't work.
j
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |