-
Website
http://blog.jploh.com/ -
Original page
http://blog.jploh.com/2007/06/18/load-balancing-two-mysql-servers-for-php-applications/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
ARKOOOLZ
1 comment · 1 points
-
mc_hamer
3 comments · 1 points
-
barz
2 comments · 1 points
-
Craigslist Proxy
2 comments · -1 points
-
wildquaker
1 comment · 1 points
-
-
Popular Threads
I'm thinking of implementing cluster over two servers - could you tell me about the issues you found that make it require three machines ?
Thanks
Andy
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. :)
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...
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.
I also extended my daemon script that's running in production. I just wanted to give a basic idea of how it works.
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.
<img src="http://img458.imageshack.us/img458/4946/jppniccmysqlqueriesweekyi4.png" alt="QPS before/after"></img>
this link is not working.can you provide me any other link which has more information about algorithm.
http://rapidshare.com/files/88019396/03-11.pdf....
$stream = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
Put that above the socket_bind...