Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2010
    Messaggi
    36

    mysql_connect o mysql_pconnect?

    Stavo leggendo un po' su php.net che c'è anche questo mysql_pconnect.
    Sono però un po' impedito in inglese... non è che capisca proprio tutto tutto.
    Ma questa connessione persistente quindi vale come le sessioni?
    Ho capito che non si chiude con la chiusura dello script, quindi al refresh della pagina rimane l'handle della connessione? e rimane anche per tutte le altre pagine?
    è un un po' un risparmio di risorse quindi? non deve stare quindi lì a connettersi e chiudere continuamente alla fine di ogni script, ma controlla se la connessione è già aperta e nel caso utilizza quella?

  2. #2
    Utente di HTML.it L'avatar di Laxus
    Registrato dal
    Oct 2010
    Messaggi
    251
    quindi al refresh della pagina rimane l'handle della connessione?
    non del tutto,
    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 a request comes in from 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 served by a different child process than the first time. When opening a persistent connection, every following page requesting SQL services can reuse the same established connection to the SQL server.
    in breve, si potrebbero aprire anche una decina di connessioni che poi verrebbero riutilizzate successivamente. non ti è dato sapere quale di queste connessioni ti capiterà.
    sottolineo questa parte:
    n particular, they do not give you an ability to open 'user sessions' on the same link, they do not give you an ability to build up a transaction efficiently, and they don't do a whole lot of other things. In fact, to be extremely clear about the subject, persistent connections don't give you any functionality that wasn't possible with their non-persistent brothers.
    non utilizzatele.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.