473,883 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FastCGI and DB connections / global variables?

When I'm using FastCGI do I need to code differently than I do when
using regular CGI? Because the PHP.exe processes don't go away do
global variables stick around from page request to page request,
creating the need for better managment / pooling of DB connections?

Josh

Jul 25 '06
37 4002
Chung Leong wrote:
I was just doing some testing on the SQLServer ODBC driver for
something I was working and I noticed that retrieving rows through the
odbc functions is incredibly slow compare to using the mssql functions.
We're talking about an order of magnitude difference. I wonder if your
script was simply running very slowly and hadn't actually stalled. Try
timing how long it takes to retrieve all rows from a particularly large
table in a couple test scripts, once with ODBC and then with the mssql
functions.
Thanks for the info. I will look into that and the "long query option".
I really appreciate the tips.

I'm going back and forth with my boss about what could be causing these
stranded processes. We're not sure if the problem comes before or after
the DB connection. The connections that can be viewed from SQL Server
seem to be recycled properly, even if they get into back log is seen of
them. They seem to go away after a maximum of about 10 min.

Conversely when a PHP process is stuck for longer than the max
execution time, I've never seen them be recycled. Though one of our
problems is that we don't know when the PHP processes were started
versus the start of the DB connect. So we don't know how long they have
been sitting, but we have highlighted some of them and waited 15 - 20
min without them going away. Do you know if the process start time
stored anywhere under the hood in Windows?

Aug 1 '06 #21

Joshua Ruppert wrote:
Chung Leong wrote:
I was just doing some testing on the SQLServer ODBC driver for
something I was working and I noticed that retrieving rows through the
odbc functions is incredibly slow compare to using the mssql functions.
We're talking about an order of magnitude difference. I wonder if your
script was simply running very slowly and hadn't actually stalled. Try
timing how long it takes to retrieve all rows from a particularly large
table in a couple test scripts, once with ODBC and then with the mssql
functions.

Thanks for the info. I will look into that and the "long query option".
I really appreciate the tips.

I'm going back and forth with my boss about what could be causing these
stranded processes. We're not sure if the problem comes before or after
the DB connection. The connections that can be viewed from SQL Server
seem to be recycled properly, even if they get into back log is seen of
them. They seem to go away after a maximum of about 10 min.

Conversely when a PHP process is stuck for longer than the max
execution time, I've never seen them be recycled. Though one of our
problems is that we don't know when the PHP processes were started
versus the start of the DB connect. So we don't know how long they have
been sitting, but we have highlighted some of them and waited 15 - 20
min without them going away. Do you know if the process start time
stored anywhere under the hood in Windows?
Wow, well what "..., even if they get into back log is seen of them."
should have said is just "..., even if they get into a backlog
situation."

Aug 1 '06 #22
Joshua Ruppert wrote:
Conversely when a PHP process is stuck for longer than the max
execution time, I've never seen them be recycled. Though one of our
problems is that we don't know when the PHP processes were started
versus the start of the DB connect. So we don't know how long they have
been sitting, but we have highlighted some of them and waited 15 - 20
min without them going away. Do you know if the process start time
stored anywhere under the hood in Windows?
Install ProcessExplorer by Mark Russinovich. It'll get you the info you
need. Here's the link:

http://www.sysinternals.com/Utilitie...sExplorer.html

Right click on the process and select properties. The start time is
near the bottom.

Aug 1 '06 #23

Chung Leong wrote:
Joshua Ruppert wrote:
Conversely when a PHP process is stuck for longer than the max
execution time, I've never seen them be recycled. Though one of our
problems is that we don't know when the PHP processes were started
versus the start of the DB connect. So we don't know how long they have
been sitting, but we have highlighted some of them and waited 15 - 20
min without them going away. Do you know if the process start time
stored anywhere under the hood in Windows?

Install ProcessExplorer by Mark Russinovich. It'll get you the info you
need. Here's the link:

http://www.sysinternals.com/Utilitie...sExplorer.html

Right click on the process and select properties. The start time is
near the bottom.
beautiful, thanks again!

Aug 1 '06 #24

Chung Leong wrote:
Joshua Ruppert wrote:
Conversely when a PHP process is stuck for longer than the max
execution time, I've never seen them be recycled. Though one of our
problems is that we don't know when the PHP processes were started
versus the start of the DB connect. So we don't know how long they have
been sitting, but we have highlighted some of them and waited 15 - 20
min without them going away. Do you know if the process start time
stored anywhere under the hood in Windows?

Install ProcessExplorer by Mark Russinovich. It'll get you the info you
need. Here's the link:

http://www.sysinternals.com/Utilitie...sExplorer.html

Right click on the process and select properties. The start time is
near the bottom.
Ok now I'm really confused. Yesturday I found some more stranded
processes (we usually get at least a few every few days). When I loaded
up the Process Explorer the properly running PHP processes were all
listed under w3wp.exe, which I'm assuming is the IIS worker process.
The processes that were stalled were all at the base level where you
would see the System Idle Process and Explorer. I'm not sure what this
means.

Could it mean that they are being triggered by something outside of
IIS?

Are the processes not imediately associated to IIS? (If that is true
then it seems that the processes are failing very early in their
execution.)

Aug 3 '06 #25
Joshua Ruppert wrote:
Ok now I'm really confused. Yesturday I found some more stranded
processes (we usually get at least a few every few days). When I loaded
up the Process Explorer the properly running PHP processes were all
listed under w3wp.exe, which I'm assuming is the IIS worker process.
The processes that were stalled were all at the base level where you
would see the System Idle Process and Explorer. I'm not sure what this
means.
No, the stalled processes are just "orphaned." The worker process that
had spawn them earlier has exited, leaving them without a parent. The
program shows my firefox.exe process in the same state, because the
Windows shell had crashed earlier.

Aug 3 '06 #26

Chung Leong wrote:
Joshua Ruppert wrote:
Ok now I'm really confused. Yesturday I found some more stranded
processes (we usually get at least a few every few days). When I loaded
up the Process Explorer the properly running PHP processes were all
listed under w3wp.exe, which I'm assuming is the IIS worker process.
The processes that were stalled were all at the base level where you
would see the System Idle Process and Explorer. I'm not sure what this
means.

No, the stalled processes are just "orphaned." The worker process that
had spawn them earlier has exited, leaving them without a parent. The
program shows my firefox.exe process in the same state, because the
Windows shell had crashed earlier.
But wouldn't that mean that IIS worker had crashed? Do you think IIS
would be able to restart the worker process if it crahes? When I
observed the orphaned processes I still had a working IIS worker
process.

Aug 3 '06 #27
Joshua Ruppert wrote:
But wouldn't that mean that IIS worker had crashed? Do you think IIS
would be able to restart the worker process if it crahes? When I
observed the orphaned processes I still had a working IIS worker
process.
No, I was just using that as an example. A process doesn't have to wait
for the termination of its children before exiting normally.

I don't know the internals of IIS. It's a fairly typical practice
though in server applications to respawn workers every now and then.

Aug 3 '06 #28

Chung Leong wrote:
Joshua Ruppert wrote:
But wouldn't that mean that IIS worker had crashed? Do you think IIS
would be able to restart the worker process if it crahes? When I
observed the orphaned processes I still had a working IIS worker
process.

No, I was just using that as an example. A process doesn't have to wait
for the termination of its children before exiting normally.

I don't know the internals of IIS. It's a fairly typical practice
though in server applications to respawn workers every now and then.
It seems like I might be back to having a monitoring process to look
for orphaned processes. One detail I may not have included in our
discussion so far is that the orphanded processes are always lower in
memory usage (~100K - ~6,000K) than properly working processes
(~10,000K - ~14,000K). This tells me that it's probably failing before
it even gets to the db connection. Does that make sense?

Aug 3 '06 #29
Joshua Ruppert wrote:
It seems like I might be back to having a monitoring process to look
for orphaned processes. One detail I may not have included in our
discussion so far is that the orphanded processes are always lower in
memory usage (~100K - ~6,000K) than properly working processes
(~10,000K - ~14,000K). This tells me that it's probably failing before
it even gets to the db connection. Does that make sense?
I wouldn't read too much into it. Memory management in Windows is quite
complex. I believe the memory usage reported in task manager is the
physical amount. A process that has stalled will have a smaller foot
print since the OS would divert memory previously allocated to it to
other processes.

You can figure out where the process is stalling through Process
Explorer. Go to properties then threads, select the php.exe thread and
press the stack button. The item at the bottom is the last function
called across a DLL. Somewhere in the chain you might see a function
name SQLxxxxxx. That'd be a function in the ODBC driver.

Aug 3 '06 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2200
by: Henri Vilminko | last post by:
I installed the Zend PHP enabler for Sun ONE Web Server which is basically a wrapper to run PHP in fastcgi mode. The interpreter runs fine but there's one nasty problem: PHP doesn't use the PHPRC environment variable I set in the config to assign each virtual server a different php.ini file. phpinfo() shows PHPRC correctly among the environment vars but for some reason PHP uses the default compiled-in ini path anyway. Any ideas what might...
0
2109
by: Andrew Crowe | last post by:
Hi guys, I've got 3 W2K Advanced Server machines here running PHP5.0.0 on IIS5. Two of them run perfectly using FastCGI. The third is unstable with FastCGI, after it's been running for a day or so it starts randomly printing out the error "-2147417842 (0x8001010e)" on a blank page. (Restarting IIS clears this for another day) If I try to use the built in ISAPI module it will give the "PHP has encountered an access violation" error at...
4
4178
by: Peter Otten | last post by:
Is there a way to limit both width and height of a canvas text item? My current workaround seems clumsy: import Tkinter as tk root = tk.Tk() canvas = tk.Canvas(root, width=400, height=200, bg="white") canvas.pack() # simulate a clipped text item - never transparent :-( s = "The long and winding road.."
2
2959
by: Mark | last post by:
When I develop a web app, I open and close connections on each page, executing multiple commands as necessary within the single open connection. However, I recently ran into a group of people that create a global connection for their web applications and share it across sessions/users/pages. Both models "work", but the second method makes me cringe ... unfortunately I can't seem to put my cringe into words as to why one should open and...
4
1592
by: Matt Anderson | last post by:
When I use Xcopy to deploy my changes to IIS, it seems to drop the user connections; i.e., empties out their Session variables, etc. I thought ASP.NET was supposed to use shadow deployment and gracefully have new connections use the new code, while the old code is cached for current connections. Anyone?
5
3563
by: howachen | last post by:
hi, which package you perfer? mod_php on apache is okay but some people said fastcgi version of php is faster, is it true? thanks...
7
25732
by: Vincent Delporte | last post by:
Hello I'm interested in hearing reflections by seasoned web app developpers about the different ways to write PHP apps, and especially how they compare in terms of performance, whether it's the PHP part or connections to MySQL. As far as I know, there are different ways to write a PHP application: - CGI, ie. the usual way : some PHP code in web pages, and the PHP interpreter is loaded each time a PHP page is called
0
1347
by: davidwalker611 | last post by:
Hi My server uses lighttpd and fastcgi. I am using htdigest to authenticate users wanting to access certain pages and I am trying to use $_SERVER to find out the name of the user who has logged into such pages. However it appears that $_SERVER is not being defined. I have read that there is a problem with fastcgi and _SERVER variables such as PHP_AUTH_USER, but I haven't come across a solution to this problem. Any help would be...
1
6013
by: jobs | last post by:
Re: Troubleshooting Timeout expired. All pooled connections were in use and max pool size was reached. New webservers. win2003. IIS6. asp.net 2.0/ sql server 2005 and Oracle 9i through a 64 bit Oracle client. Everything working fine until this. I started getting these errors as the new website activity started to heat up. Timeout expired. The timeout period elapsed prior to obtaining a
0
9796
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10860
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,...
0
10420
tracyyun
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...
0
9583
agi2029
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...
1
7975
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7134
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();...
0
5804
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6002
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.