<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>iRant - Latest Comments in Load Balancing Two MySQL Servers for PHP Applications</title><link>http://jploh.disqus.com/</link><description></description><language>en</language><lastBuildDate>Sun, 21 Jun 2009 10:32:22 -0000</lastBuildDate><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-11529809</link><description>Thanks for posting the code. It's really helpful although this was posted 2 years ago.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tieh</dc:creator><pubDate>Sun, 21 Jun 2009 10:32:22 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-8321695</link><description>For anyone trying this.. don't forget &lt;br&gt;$stream = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);&lt;br&gt;&lt;br&gt;Put that above the socket_bind...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chris</dc:creator><pubDate>Sat, 18 Apr 2009 02:05:16 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-963501</link><description>hfgh</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">fgh</dc:creator><pubDate>Tue, 22 Jul 2008 01:08:57 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-723661</link><description></description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">  _</dc:creator><pubDate>Sat, 21 Jun 2008 21:58:03 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343761</link><description>I found your site on &lt;a href="http://faves.com" rel="nofollow"&gt;faves.com&lt;/a&gt; bookmarking site.. I like it ..gave it a fave for you..ill be checking back later</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Php Database Script</dc:creator><pubDate>Mon, 02 Jun 2008 03:49:40 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343755</link><description>You're lucky I still have the PDF file stored somewhere. Here it is:&lt;br&gt;&lt;a href="http://rapidshare.com/files/88019396/03-11.pdf.html" rel="nofollow"&gt;http://rapidshare.com/files/88019396/03-11.pdf....&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jploh</dc:creator><pubDate>Thu, 31 Jan 2008 04:15:28 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343754</link><description>&lt;a href="http://davh.dk/projects/mysql-load-balance/" rel="nofollow"&gt;http://davh.dk/projects/mysql-load-balance/&lt;/a&gt;&lt;br&gt;&lt;br&gt;this link is not working.can you provide me any other link which has more information about algorithm.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sam</dc:creator><pubDate>Wed, 30 Jan 2008 20:19:58 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343753</link><description>The link I gave in my last comment is for clustering. But the one used in my post is replication.&lt;br&gt;&lt;br&gt;I also extended my daemon script that's running in production. I just wanted to give a basic idea of how it works.&lt;br&gt;&lt;br&gt;For performance, refer to the image below. The one in blue was when it wasn't rotating between servers. The one in red, when rotation was in effect.&lt;br&gt;&lt;br&gt;&amp;lt;img src="http://img458.imageshack.us/img458/4946/jppniccmysqlqueriesweekyi4.png" alt="QPS before/after"&amp;gt;&amp;lt;/img&amp;gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jploh</dc:creator><pubDate>Wed, 20 Jun 2007 16:29:01 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343752</link><description>Hi, i wanna know how much about performance do you get with this trick?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">fred</dc:creator><pubDate>Wed, 20 Jun 2007 12:42:05 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343751</link><description>There is a difference between MySQL Cluster and MySQL replication.  What you seem to be describing is replication, in which case I don't think that the linked article will help you.&lt;br&gt;&lt;br&gt;It seems to me that your approach should work out just fine.  Just don't try to get into master-master replication... it's a pain and it can only lead to tears. :)&lt;br&gt;&lt;br&gt;If you want to make it more robust, you could add a couple of features to your daemon.  For example, you should pull your config information from a file.  Then you could implement a simple protocol.  For example, the client could send "REQ" to request a DB handle.  Or the client to send "RELOAD" to cause the daemon to reload it's config file.  This way you wouldn't have to stop the daemon...  &lt;br&gt;&lt;br&gt;Then again, PHP probably isn't the best language to use for the daemon, since it will block on each request.  If you have two requests coming in at the same time, the second one will have to wait for the first to get done.  This might be an issue over time.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus</dc:creator><pubDate>Wed, 20 Jun 2007 11:55:26 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343750</link><description>It's possible to have a cluster with two servers. You'll initially need three servers then you can turn off the third one once it's running (not recommended). See &lt;a href="http://dev.mysql.com/tech-resources/articles/mysql-cluster-for-two-servers.html" rel="nofollow"&gt;this article&lt;/a&gt;.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jploh</dc:creator><pubDate>Tue, 19 Jun 2007 08:11:41 -0000</pubDate></item><item><title>Re: Load Balancing Two MySQL Servers for PHP Applications</title><link>http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/#comment-2343749</link><description>"I found out that a MySQL cluster needs to have at least three servers to get full redundancy."&lt;br&gt;&lt;br&gt;I'm thinking of implementing cluster over two servers - could you tell me about the issues you found that make it require three machines ?&lt;br&gt;&lt;br&gt;Thanks&lt;br&gt;&lt;br&gt;Andy</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Andrew Blake</dc:creator><pubDate>Tue, 19 Jun 2007 07:56:11 -0000</pubDate></item></channel></rss>