Hi all.

Is there anyone out there who can explain to me on advanced level the cons of using a non persistent connection.

I currently use a non persistent connection on my site because i run php as a wrapper. I like the piece of mind of having apache run under my username and keep a 600 on most of my outside files.

I have heard alot about it is resource intesive to have to open up a new connection for each request. I just don't know what those resources exactly are that we are giving up.

Any guru out there wish to comment.

much appreciated.

From what I understand, there are no features gained or lost using connect() vs pconnect(). The difference is strictly related to how the server manages its memory resources. With connect(), every request from Apache to MySQL needs to open a new connection (and if you have your web and database servers on separate machines, this involves the whole network handshake thing). With pconnect(), you're keeping a persistent connection between Apache and MySQL open, along with multiple threads, which can eat up your RAM, but bypasses the overhead of constantly establishing and closing new connections with each request.

I use pconnect() simply because my web and db servers are on different machines, each with 2 gigs of ram.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.