<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Are PHP persistent connections evil ?</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/</link>
	<description>Percona&#039;s MySQL &#38; InnoDB performance and scalability blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:45:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Nikhil Mohan</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-787527</link>
		<dc:creator>Nikhil Mohan</dc:creator>
		<pubDate>Fri, 17 Dec 2010 07:37:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-787527</guid>
		<description>&lt;a href=&quot;http://www.lightrains.com&quot; rel=&quot;nofollow&quot;&gt;Lightrains Technolabs&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://www.lightrains.com" rel="nofollow">Lightrains Technolabs</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikhil Mohan</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-787526</link>
		<dc:creator>Nikhil Mohan</dc:creator>
		<pubDate>Fri, 17 Dec 2010 07:36:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-787526</guid>
		<description>Here&#039;s a nifty little class which will load balance across multiple replicated MySQL server instances, using persistent connections, automatically removing failed MySQL servers from the pool.

You would ONLY use this for queries, never inserts/updates/deletes, UNLESS you had a multi-master situation where updates to any database serverautomatically replicate to the other servers (I don&#039;t know whether that&#039;s possible with MySQL).

Using this class, you get a connection to a MySQL server like this:
    $con = MySQLConnectionFactory::create();

Here is the class (you&#039;ll need to customize the $SERVERS array for your configuration -- note that you would probably use the same username, password and database for all of the servers, just changing the host name, but you&#039;re not forced to use the same ones):

// &#039;myHost1&#039;,
        &#039;username&#039; =&gt; &#039;myUsername1&#039;,
        &#039;password&#039; =&gt; &#039;myPassword1&#039;,
        &#039;database&#039; =&gt; &#039;myDatabase1&#039;),
    array(
        &#039;host&#039; =&gt; &#039;myHost2&#039;,
        &#039;username&#039; =&gt; &#039;myUsername1&#039;,
        &#039;password&#039; =&gt; &#039;myPassword2&#039;,
        &#039;database&#039; =&gt; &#039;myDatabase2&#039;)
    );

    public static function create() {
    // Figure out which connections are open, automatically opening any connections
    // which are failed or not yet opened but can be (re)established.
    $cons = array();
    for ($i = 0, $n = count(MySQLConnectionFactory::$SERVERS); $i //


&lt;a href=&quot;http://www,lightrains.com&quot; rel=&quot;nofollow&quot;&gt;Lightrains Technolabs&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a nifty little class which will load balance across multiple replicated MySQL server instances, using persistent connections, automatically removing failed MySQL servers from the pool.</p>
<p>You would ONLY use this for queries, never inserts/updates/deletes, UNLESS you had a multi-master situation where updates to any database serverautomatically replicate to the other servers (I don&#8217;t know whether that&#8217;s possible with MySQL).</p>
<p>Using this class, you get a connection to a MySQL server like this:<br />
    $con = MySQLConnectionFactory::create();</p>
<p>Here is the class (you&#8217;ll need to customize the $SERVERS array for your configuration &#8212; note that you would probably use the same username, password and database for all of the servers, just changing the host name, but you&#8217;re not forced to use the same ones):</p>
<p>// &#8216;myHost1&#8242;,<br />
        &#8216;username&#8217; =&gt; &#8216;myUsername1&#8242;,<br />
        &#8216;password&#8217; =&gt; &#8216;myPassword1&#8242;,<br />
        &#8216;database&#8217; =&gt; &#8216;myDatabase1&#8242;),<br />
    array(<br />
        &#8216;host&#8217; =&gt; &#8216;myHost2&#8242;,<br />
        &#8216;username&#8217; =&gt; &#8216;myUsername1&#8242;,<br />
        &#8216;password&#8217; =&gt; &#8216;myPassword2&#8242;,<br />
        &#8216;database&#8217; =&gt; &#8216;myDatabase2&#8242;)<br />
    );</p>
<p>    public static function create() {<br />
    // Figure out which connections are open, automatically opening any connections<br />
    // which are failed or not yet opened but can be (re)established.<br />
    $cons = array();<br />
    for ($i = 0, $n = count(MySQLConnectionFactory::$SERVERS); $i //</p>
<p><a href="http://www,lightrains.com" rel="nofollow">Lightrains Technolabs</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikhil Mohan</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-787525</link>
		<dc:creator>Nikhil Mohan</dc:creator>
		<pubDate>Fri, 17 Dec 2010 07:35:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-787525</guid>
		<description>Here&#039;s a nifty little class which will load balance across multiple replicated MySQL server instances, using persistent connections, automatically removing failed MySQL servers from the pool.

You would ONLY use this for queries, never inserts/updates/deletes, UNLESS you had a multi-master situation where updates to any database serverautomatically replicate to the other servers (I don&#039;t know whether that&#039;s possible with MySQL).

Using this class, you get a connection to a MySQL server like this:
    $con = MySQLConnectionFactory::create();

Here is the class (you&#039;ll need to customize the $SERVERS array for your configuration -- note that you would probably use the same username, password and database for all of the servers, just changing the host name, but you&#039;re not forced to use the same ones):

 &#039;myHost1&#039;,
        &#039;username&#039; =&gt; &#039;myUsername1&#039;,
        &#039;password&#039; =&gt; &#039;myPassword1&#039;,
        &#039;database&#039; =&gt; &#039;myDatabase1&#039;),
    array(
        &#039;host&#039; =&gt; &#039;myHost2&#039;,
        &#039;username&#039; =&gt; &#039;myUsername1&#039;,
        &#039;password&#039; =&gt; &#039;myPassword2&#039;,
        &#039;database&#039; =&gt; &#039;myDatabase2&#039;)
    );

    public static function create() {
    // Figure out which connections are open, automatically opening any connections
    // which are failed or not yet opened but can be (re)established.
    $cons = array();
    for ($i = 0, $n = count(MySQLConnectionFactory::$SERVERS); $i 

&lt;a href=&quot;http://www,lightrains.com&quot; rel=&quot;nofollow&quot;&gt;Lightrains Technolabs&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a nifty little class which will load balance across multiple replicated MySQL server instances, using persistent connections, automatically removing failed MySQL servers from the pool.</p>
<p>You would ONLY use this for queries, never inserts/updates/deletes, UNLESS you had a multi-master situation where updates to any database serverautomatically replicate to the other servers (I don&#8217;t know whether that&#8217;s possible with MySQL).</p>
<p>Using this class, you get a connection to a MySQL server like this:<br />
    $con = MySQLConnectionFactory::create();</p>
<p>Here is the class (you&#8217;ll need to customize the $SERVERS array for your configuration &#8212; note that you would probably use the same username, password and database for all of the servers, just changing the host name, but you&#8217;re not forced to use the same ones):</p>
<p> &#8216;myHost1&#8242;,<br />
        &#8216;username&#8217; =&gt; &#8216;myUsername1&#8242;,<br />
        &#8216;password&#8217; =&gt; &#8216;myPassword1&#8242;,<br />
        &#8216;database&#8217; =&gt; &#8216;myDatabase1&#8242;),<br />
    array(<br />
        &#8216;host&#8217; =&gt; &#8216;myHost2&#8242;,<br />
        &#8216;username&#8217; =&gt; &#8216;myUsername1&#8242;,<br />
        &#8216;password&#8217; =&gt; &#8216;myPassword2&#8242;,<br />
        &#8216;database&#8217; =&gt; &#8216;myDatabase2&#8242;)<br />
    );</p>
<p>    public static function create() {<br />
    // Figure out which connections are open, automatically opening any connections<br />
    // which are failed or not yet opened but can be (re)established.<br />
    $cons = array();<br />
    for ($i = 0, $n = count(MySQLConnectionFactory::$SERVERS); $i </p>
<p><a href="http://www,lightrains.com" rel="nofollow">Lightrains Technolabs</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-766115</link>
		<dc:creator>Kyle</dc:creator>
		<pubDate>Thu, 03 Jun 2010 21:16:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-766115</guid>
		<description>I would read this, updated recently.  It seems mysqli has added this option back.  It does cleanup automatically by calling mysql_change_user() every time a connection is reused.

http://php.net/manual/en/mysqli.persistconns.php</description>
		<content:encoded><![CDATA[<p>I would read this, updated recently.  It seems mysqli has added this option back.  It does cleanup automatically by calling mysql_change_user() every time a connection is reused.</p>
<p><a href="http://php.net/manual/en/mysqli.persistconns.php" rel="nofollow">http://php.net/manual/en/mysqli.persistconns.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-702738</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Mon, 28 Dec 2009 13:09:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-702738</guid>
		<description>Contrary to Brian&#039;s comment of 3 years ago, it&#039;s in a well-designed web application where persistent connections are beneficial. Badly-designed applications don&#039;t use them either because they have other, bigger performance bottlenecks to worry about, or because they succumb to the gotchas. 

And the potential gotchas of pconnect are all symptoms of bad design themselves: having far too many client processes (think mod_php); forgetting to unlock tables and not cleaning up temporary tables; poor use of session variables, etc. 

I have been running a high-concurrency app on Apache with the worker mpm (up to 3000 threads), with fastCGI + PHP (1 process, 24 children), connecting to mysql via Unix sockets with persistent connections. I have not had any problems. Even if the benefits are small, there is no cost. Net win.</description>
		<content:encoded><![CDATA[<p>Contrary to Brian&#8217;s comment of 3 years ago, it&#8217;s in a well-designed web application where persistent connections are beneficial. Badly-designed applications don&#8217;t use them either because they have other, bigger performance bottlenecks to worry about, or because they succumb to the gotchas. </p>
<p>And the potential gotchas of pconnect are all symptoms of bad design themselves: having far too many client processes (think mod_php); forgetting to unlock tables and not cleaning up temporary tables; poor use of session variables, etc. </p>
<p>I have been running a high-concurrency app on Apache with the worker mpm (up to 3000 threads), with fastCGI + PHP (1 process, 24 children), connecting to mysql via Unix sockets with persistent connections. I have not had any problems. Even if the benefits are small, there is no cost. Net win.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MySQL: Ð±Ð»Ð¾ÐºÐ¸Ñ€Ð¾Ð²ÐºÐ¸ Ð¸ persistent connection &#171; Oracle mechanics</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-591018</link>
		<dc:creator>MySQL: Ð±Ð»Ð¾ÐºÐ¸Ñ€Ð¾Ð²ÐºÐ¸ Ð¸ persistent connection &#171; Oracle mechanics</dc:creator>
		<pubDate>Sat, 20 Jun 2009 23:00:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-591018</guid>
		<description>[...] &#8211; ÑÐ¼., Ð½Ð°Ð¿Ñ€Ð¸Ð¼ÐµÑ€, Ð¾Ð±ÑÑƒÐ¶Ð´ÐµÐ½Ð¸Ðµ Ð² Ð±Ð»Ð¾Ð³Ðµ Peter Zaitsev Are PHP persistent connections evil ?. Ð”Ð»Ñ Ñ€ÐµÑˆÐµÐ½Ð¸Ñ Ð¿Ñ€Ð¾Ð±Ð»ÐµÐ¼Ñ‹ Ð¸ ÑƒÑ‡Ð¸Ñ‚Ñ‹Ð²Ð°Ñ, Ñ‡Ñ‚Ð¾ Ð² ÑÐ»ÑƒÑ‡Ð°Ðµ Ñ MySQL [...]</description>
		<content:encoded><![CDATA[<p>[...] &#8211; ÑÐ¼., Ð½Ð°Ð¿Ñ€Ð¸Ð¼ÐµÑ€, Ð¾Ð±ÑÑƒÐ¶Ð´ÐµÐ½Ð¸Ðµ Ð² Ð±Ð»Ð¾Ð³Ðµ Peter Zaitsev Are PHP persistent connections evil ?. Ð”Ð»Ñ Ñ€ÐµÑˆÐµÐ½Ð¸Ñ Ð¿Ñ€Ð¾Ð±Ð»ÐµÐ¼Ñ‹ Ð¸ ÑƒÑ‡Ð¸Ñ‚Ñ‹Ð²Ð°Ñ, Ñ‡Ñ‚Ð¾ Ð² ÑÐ»ÑƒÑ‡Ð°Ðµ Ñ MySQL [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: oscar duron</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-503395</link>
		<dc:creator>oscar duron</dc:creator>
		<pubDate>Thu, 12 Mar 2009 10:36:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-503395</guid>
		<description>I you are only reading data, persistent connection is a good option if not the best. If you are updating data, think twice and undertand the risks and problems using a persistent connection. If you are using transactions, persistent connections do not apply.</description>
		<content:encoded><![CDATA[<p>I you are only reading data, persistent connection is a good option if not the best. If you are updating data, think twice and undertand the risks and problems using a persistent connection. If you are using transactions, persistent connections do not apply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michel Van Hof</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-503346</link>
		<dc:creator>Michel Van Hof</dc:creator>
		<pubDate>Thu, 12 Mar 2009 09:28:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-503346</guid>
		<description>Hi, I have a situation (although not with php) that has been troubeling me a long time now.

I have a Server Application (in-house) which in turn let&#039;s a bunch of clients connect to it. These clients give feebdack.. A LOT of feedback, (think in terms of narrowcasting players which tell me what image they have played at what time and which screen.. such an image is displayed for 10 seconds and then goes to the next.. these are 8460 records per day per screen per player.. ). Next to this, they query data (are there new files, ads etc) and they log certain events..

Now i tryed doing this with the Mysql.NET connector and opening and closing the connection but up until now, i haven&#039;t got this working yet.. so for now, i&#039;m using a concurrent connection per client that is connected to my server. Performance has never been fantastic though.

So my question is: Per query connection of keep a concurrent connection per client that is connected ?</description>
		<content:encoded><![CDATA[<p>Hi, I have a situation (although not with php) that has been troubeling me a long time now.</p>
<p>I have a Server Application (in-house) which in turn let&#8217;s a bunch of clients connect to it. These clients give feebdack.. A LOT of feedback, (think in terms of narrowcasting players which tell me what image they have played at what time and which screen.. such an image is displayed for 10 seconds and then goes to the next.. these are 8460 records per day per screen per player.. ). Next to this, they query data (are there new files, ads etc) and they log certain events..</p>
<p>Now i tryed doing this with the Mysql.NET connector and opening and closing the connection but up until now, i haven&#8217;t got this working yet.. so for now, i&#8217;m using a concurrent connection per client that is connected to my server. Performance has never been fantastic though.</p>
<p>So my question is: Per query connection of keep a concurrent connection per client that is connected ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: oscar duron</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-379182</link>
		<dc:creator>oscar duron</dc:creator>
		<pubDate>Fri, 14 Nov 2008 20:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-379182</guid>
		<description>Please help! in PHP mySQL, the use of SELECT FOR UPDATE and SELECT LOCK IN SHARE MODE, How to use it? They don&#039;t make any sense to me in a web application, because when you first read the data (SELECT FOR UPDATE)the script ends once it sends the filled form to be updated on the client, so there is an auto mysql_close.(Which would rollback your transaction in the SELECT)
With a persistent connection, may be it would keep the transaction pending, but there is no way to store the connection persistent link resource in a session or anywhere else, so there is no way to open the updater script with the same link resource to UPDATE and then COMMIT, or how does it works?</description>
		<content:encoded><![CDATA[<p>Please help! in PHP mySQL, the use of SELECT FOR UPDATE and SELECT LOCK IN SHARE MODE, How to use it? They don&#8217;t make any sense to me in a web application, because when you first read the data (SELECT FOR UPDATE)the script ends once it sends the filled form to be updated on the client, so there is an auto mysql_close.(Which would rollback your transaction in the SELECT)<br />
With a persistent connection, may be it would keep the transaction pending, but there is no way to store the connection persistent link resource in a session or anywhere else, so there is no way to open the updater script with the same link resource to UPDATE and then COMMIT, or how does it works?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RubÃ©n Ortiz &#187; Apache. MaxClients y mÃ¡s&#8230;</title>
		<link>http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/comment-page-1/#comment-298300</link>
		<dc:creator>RubÃ©n Ortiz &#187; Apache. MaxClients y mÃ¡s&#8230;</dc:creator>
		<pubDate>Tue, 13 May 2008 08:46:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/#comment-298300</guid>
		<description>[...] http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/" rel="nofollow">http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/</a> [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

