|
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. | NEI PREFERITI | .:: | RSS Forum | RSS News | NEWS web | NEWS software | |
| PUBBLICITA' | | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | | CERCA nel FORUM » | |
11-05-2001, 17.33.27 | #1 |
WT programmer
Registrato: 05-01-2001
Loc.: Siena
Messaggi: 523
|
----- This has to do with the way web servers work. There are three ways in which your web server can utilize PHP to generate web pages. The first method is to use PHP as a CGI "wrapper". When run this way, an instance of the PHP interpreter is created and destroyed for every page request (for a PHP page) to your web server. Because it is destroyed after every request, any resources that it acquires (such as a link to an SQL database server) are closed when it is destroyed. In this case, you do not gain anything from trying to use persistent connections -- they simply don't persist. The second, and most popular, method is to run PHP as a module in a multiprocess web server, which currently only includes Apache. A multiprocess server typically has one process (the parent) which coordinates a set of processes (its children) who actually do the work of serving up web pages. When each request comes in from a a client, it is handed off to one of the children that is not already serving another client. This means that when the same client makes a second request to the server, it may be serviced by a different child process than the first time. What a persistent connection does for you in this case it make it so each child process only needs to connect to your SQL server the first time that it serves a page that makes us of such a connection. When another page then requires a connection to the SQL server, it can reuse the connection that child established earlier. The last method is to use PHP as a plug-in for a multithreaded web server. Currently this is only theoretical -- PHP does not yet work as a plug-in for any multithreaded web servers. Work is progressing on support for ISAPI, WSAPI, and NSAPI (on Windows), which will all allow PHP to be used as a plug-in on multithreaded servers like Netscape FastTrack, Microsoft's Internet Information Server (IIS), and O'Reilly's WebSite Pro. When this happens, the behavior will be essentially the same as for the multiprocess model described before. ----- ditemi se le mie conclusioni sono giuste...nel caso di PHP+Apache il pconnect apre una connessione permanente per OGNI singolo processo che Apache lancia vero?? quindi e' facile se un server e' sotto un forte carico che Apache lanci molti processi, la machina si potrebbe ritrovare con molte connessioni permanenti aperte delle quali solo una piccolissima parte utilizzate... ho testato con uno script che mi sono fatto, e le conclusioni mi sembrano giuste...voglio provare con IIS per vedere se si comporta in maniera diversa... comunque per ora il consiglio e' evitate le pconnect, almeno con apache...come sono realizzate ora in PHP non hanno molto senso perche' servono per ridurre il carico sul server del DB, ma molto facilmente quando si usa Apache lo portano a livelli piu' alti...mah...
___________________________________
Wintricks.it script programmer vuoi un sito internet professionale??? www.hor-net.com ! ...the Penguin Power |
11-05-2001, 17.44.55 | #2 |
WT programmer
Registrato: 05-01-2001
Loc.: Siena
Messaggi: 523
|
ebbene si, con IIS tutto cio' non si verifica, infatti IIS e' monolitico, non si spezzetta come Apache.
Questo mi porta a pensare che il sistema delle connessioni permanenti si PHP si basi sul PID del processo che chima lo script...devo indagare...
___________________________________
Wintricks.it script programmer vuoi un sito internet professionale??? www.hor-net.com ! ...the Penguin Power |
11-05-2001, 18.54.32 | #3 |
WT Assistant
Registrato: 19-12-2000
Loc.: Cambiano (Torino)
Messaggi: 591
|
Non c'entra niente, ma ho sentito oggi che la Debian è tornata al PHP3 perché con PHP4+Apache (solo su Debian) c'era un bug terribile... di più nin so, per ora...
|
13-05-2001, 09.56.35 | #4 |
Newbie
Registrato: 13-05-2001
Messaggi: 38
|
E' un problema un pò oscuro.
Il nodo dovrebbe essere nella diversa gestione delle attività tra i WS. Apache è descritto come multiprocess server, ossia non sembra in grado di aprire un nuovo thread per ogni istanza richiesta al server di database. Può invece aprire un nuovo processo al di fuori del propio spazio di indirizzamento e prenderne il controllo. Quindi una volta portata a termine la query il nuovo processo così generato può essere eliminato, come avviene nelle cgi, oppure può essere mantenuto "in vita" in modo da essere utilizzato per richieste successive... Perchè? Potrebbe essere (forse) un sistema per gestire il load balancing, con l'amministratore che si fa carico di gestire attraverso gli script il numero massimo di istanze al motore di database, evitando il sovraccarico del server a causa di un numero troppo elevato di processi contemporanei. In ogni caso il problema è alla radice, ossia nel modo in cui l'interprete Perl gestisce le connessioni. Passando per l'api di Apache, al pari di isapi e nsapi, non ci dovrebbero essere difficoltà, a parte la creazione stessa del programma (in C). E'comunque strano che non sia indicata questa possibilità. IIS e NWS, attraverso le loro api, supportano le richieste in-process, ma dovrebbero comportarsi nello stesso modo utilizzando uno script Perl; nuovo processo e nuova allocazione di risorse. A meno che l'implementazione dell'interprete non sia diversa... Se (tolgiamo il se, mettiamo siccome) ho detto qualche stupidaggine, chiedo scusa in anticipo! Ciao. |
13-05-2001, 13.18.53 | #5 |
Hero Member
Registrato: 09-04-2000
Messaggi: 1.104
|
sarebbe bello fare un porting di iis per linux
l'altro giorno leggevo di un programma che fa il contrario...adatta programmi per linux per win....mah... |
14-05-2001, 18.40.28 | #6 |
WT programmer
Registrato: 05-01-2001
Loc.: Siena
Messaggi: 523
|
mi sono fatto una pippa mentale stupida...il punto e' che si php collega ogni connessione al DB direttamente con il processi di apache che l'ha aperta, pero' e' anche vero che in httpd.conf posso definire il numero minimo e massimo di processi contemporanei che apache deve girare, come altresi' posso definire il timeout delle connessioni permaneti.
Il problema quindi e' molto minore rispetto alla situazione precedente, resta il fatto che l'implementazione delle connessioni permanenti in php lasci un po a desiderare, dovrebbe esistere sempre una sola connessione permanente aperta, o la limite il numero impostato in qualche varibile di configurazione, altrimenti il concetto di connection pooling va a farsi friggere...
___________________________________
Wintricks.it script programmer vuoi un sito internet professionale??? www.hor-net.com ! ...the Penguin Power |
Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti) | |
Strumenti discussione | |
|
|
Discussioni simili | ||||
Discussione | Autore discussione | Forum | Risposte | Ultimo messaggio |
[LINUX] Eseguire script PHP con Apache | Downloader | Linux e altri Sistemi Operativi | 3 | 16-11-2005 17.09.09 |
[MDK] PHP e Apache | GiulioCesare | Linux e altri Sistemi Operativi | 1 | 27-10-2004 11.24.22 |
[RH] 7.3 - Aggiornamento Apache e PHP | Doomboy | Linux e altri Sistemi Operativi | 3 | 07-10-2004 16.16.18 |
Estensioni di PHP 5 sotto windows + apache 2 | realtebo | Programmazione | 4 | 05-10-2004 10.59.15 |
Apache 2 e PHP 5 | realtebo | Internet e Reti locali | 2 | 07-09-2004 09.16.14 |