<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Brain dump - Latest Comments in Load Balancing Two MySQL Servers for PHP Applications</title><link>http://jploh.disqus.com/</link><description></description><atom:link href="https://jploh.disqus.com/load_balancing_two_mysql_servers_for_php_applications/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 09 Aug 2010 03:09:33 -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-67326487</link><description>&lt;p&gt;thanks dude!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sylar</dc:creator><pubDate>Mon, 09 Aug 2010 03:09:33 -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-65646994</link><description>&lt;p&gt;"For anyone trying this.. don't forget&lt;br&gt;$stream = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);&lt;/p&gt;&lt;p&gt;Put that above the socket_bind..." - Thanks for that bud!&lt;/p&gt;&lt;p&gt;---&lt;br&gt;Ricky, &lt;a href="http://www.magicjackspoker.com/" rel="nofollow noopener" target="_blank" title="http://www.magicjackspoker.com/"&gt;magicJack&lt;/a&gt; Researcher&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sprained Ankle</dc:creator><pubDate>Sun, 01 Aug 2010 21:15:10 -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-60357325</link><description>&lt;p&gt;I like your method, I'm gonna implement it on my server.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">The Magic Jack</dc:creator><pubDate>Fri, 02 Jul 2010 19:28:29 -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-45573293</link><description>&lt;p&gt;As the MySQL cluster management server does not use many resources, and the system would just sit there doing nothing, we can put our first load balancer on the same machine, which saves us one machine, so we end up with four machines.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Payday Loans</dc:creator><pubDate>Mon, 19 Apr 2010 20:42: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-13872496</link><description>&lt;p&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.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">club penguin</dc:creator><pubDate>Tue, 04 Aug 2009 05:11:59 -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-11529809</link><description>&lt;p&gt;Thanks for posting the code. It's really helpful although this was posted 2 years ago.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">boston moving companies</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>&lt;p&gt;For anyone trying this.. don't forget &lt;br&gt;$stream = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);&lt;/p&gt;&lt;p&gt;Put that above the socket_bind...&lt;/p&gt;</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>&lt;p&gt;hfgh&lt;/p&gt;</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>&lt;p&gt;  &lt;/p&gt;</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>&lt;p&gt;I found your site on &lt;a href="http://faves.com" rel="nofollow noopener" target="_blank" title="faves.com"&gt;faves.com&lt;/a&gt; bookmarking site.. I like it ..gave it a fave for you..ill be checking back later&lt;/p&gt;</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>&lt;p&gt;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 noopener" target="_blank" title="http://rapidshare.com/files/88019396/03-11.pdf.html"&gt;http://rapidshare.com/files...&lt;/a&gt;&lt;/p&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;p&gt;&lt;a href="http://davh.dk/projects/mysql-load-balance/" rel="nofollow noopener" target="_blank" title="http://davh.dk/projects/mysql-load-balance/"&gt;http://davh.dk/projects/mys...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;this link is not working.can you provide me any other link which has more information about algorithm.&lt;/p&gt;</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>&lt;p&gt;The link I gave in my last comment is for clustering. But the one used in my post is replication.&lt;/p&gt;&lt;p&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;/p&gt;&lt;p&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;/p&gt;&lt;p&gt;&amp;lt;img src="&lt;a href="http://img458.imageshack.us/img458/4946/jppniccmysqlqueriesweekyi4.png" rel="nofollow noopener" target="_blank" title="http://img458.imageshack.us/img458/4946/jppniccmysqlqueriesweekyi4.png"&gt;http://img458.imageshack.us...&lt;/a&gt;" alt="QPS before/after"&amp;gt;&amp;lt;/img&amp;gt;&lt;/p&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>&lt;p&gt;Hi, i wanna know how much about performance do you get with this trick?&lt;/p&gt;</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>&lt;p&gt;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;/p&gt;&lt;p&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;/p&gt;&lt;p&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;/p&gt;&lt;p&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.&lt;/p&gt;</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>&lt;p&gt;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 noopener" target="_blank" title="http://dev.mysql.com/tech-resources/articles/mysql-cluster-for-two-servers.html"&gt;this article&lt;/a&gt;.&lt;/p&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>&lt;p&gt;"I found out that a MySQL cluster needs to have at least three servers to get full redundancy."&lt;/p&gt;&lt;p&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;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;&lt;p&gt;Andy&lt;/p&gt;</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>