More Servers bringing total to 7
January 5th, 2008 by GregOK its been a fun week, server load was still high on the 3 servers I had and I couldn’t pin point the problem so I threw a 4th server at it.
This server was just a NFS server (file server), before this all files where stored on the web server and the database servers connect to that, now with a dedicated nfs server the load should reduce.
Yes it did but not by enough so I then ordered another web server and 2 database servers. I now have 4 db servers all using replication to keep them in sync and 2 web servers. I was going to use a load balancer but this proved costly after just a short test period so I opted to try a basic Round robin DNS, which although not a true form of load balancing it should work for my needs.
OK things not good, the webservers pick a random database to connect to each time they are accessed, this just does not work. You end up at times with one db server overloading which in turn overloads the web server so I needed an effective means of load balancing the db servers.
I then came up with a small script which runs on one of the web servers. This reads the load of each of of the db servers and writes the ip address of the db server with the lowest load to a file, each of the scripts on both web servers then ‘requires’ this file so they access the db server with the lowest load.
It’s early days yet but it seems to be working well, the required file is updated a couple of times a minute so the db servers should never end up with a high load and hence the same for the web servers.
In heinsite if I had done this a week ago then I might not have needed the extra servers but its better to have too much then too little and I do plan to get more traffic so the servers will be utalised.
Happy new year one and all


























