Re: [newbie] Small question about FastCGI [message #179414 is a reply to message #179412] |
Tue, 23 October 2012 13:12 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 10/23/2012 7:12 AM, Gilles wrote:
> Hello
>
> I just installed Lighttpd and mod_fastcgi to improve performance when
> running PHP scripts over CGI.
>
> Am I correct in understanding the following about what mod_fastcgi
> does:
> 1. loads severals instances of the PHP interpreter, each in its own
> process (hence the numerous instances of /usr/bin/php5-cgi in "ps aux"
> and the "php.socket-" pseudo-files in /tmp)
> 2. translates between HTTP requests/responses and the PHP scripts
> 3. does nothing about the PHP scripts, which are loaded, parsed,
> compiled, ran, and unloaded every time they are called
> ?
>
> I'm especially concerned about the last point: If I make a lot of
> calls to the database, does it mean that FastCGI doesn't provide
> persistent connections to it, so I'll have to investigate other ways
> to avoid opening/closing DB connections every time? Or is
> opening/closing DB connections a non-issue and the main issue is
> actual commands sent to the DB?
>
> Thank you.
>
Why do you think you need persistent connections? Do you have a
performance problem you've traced down to connecting to the database?
Persistent connections can improve performance in *very heavily* used
websites (i.e. hundreds of hits per second), but also lock system
resources even when the connections are not being used.
In most cases persistent connections will have little or no impact on
performance, and can actually degrade performance (as well as causing
other problems like having left-over data from the previous usage of the
connection).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|