Handling heavy load: multiple servers by Latitude.
Posted: Sat Jan 03, 2015 9:09 am
Hi,
Although I have no idea how popular my website could become since it is not live yet and won't be until about April 2015, I am almost certain that one server will not be able to handle the load if the website become popular (for sure there will be a problem if it becomes very popular). I figure even if I move to a $400 per month dedicated machine there could be a problem if it becomes very popular. So I have many times tried to figure out how I might deal with this situation by distributing the work across multiple servers (does not help when I have no knowledge or experience with this). I can't give away my website just yet but I have outlined probably the best idea I have come up with so far for dealing with this potential problem. Bearing in mind I have no experience with this problem (let along actual live website experience yet - LOL) maybe someone with this experience might find this approach interesting and might know how this approach might fit in with the real world of dealing with this situation. So here is my idea.
Any thoughts would be greatly appreciated and hopefully this idea or suggestions regarding it may help others.
Thanks,
John
Although I have no idea how popular my website could become since it is not live yet and won't be until about April 2015, I am almost certain that one server will not be able to handle the load if the website become popular (for sure there will be a problem if it becomes very popular). I figure even if I move to a $400 per month dedicated machine there could be a problem if it becomes very popular. So I have many times tried to figure out how I might deal with this situation by distributing the work across multiple servers (does not help when I have no knowledge or experience with this). I can't give away my website just yet but I have outlined probably the best idea I have come up with so far for dealing with this potential problem. Bearing in mind I have no experience with this problem (let along actual live website experience yet - LOL) maybe someone with this experience might find this approach interesting and might know how this approach might fit in with the real world of dealing with this situation. So here is my idea.
So that is it. I suspect I need to do some reading on this topic over the next 5 to 10 years to be sure of what to do. I have often wondered if a large RAID setup could avoid needing to do such a distribution of power across machines (with significant programming changes to make it work) or if this type of an idea might be useful for pushing a RAID system to its limits. At this point I may be thinking ahead too much. Right now I am primarily concerned with finishing the website and getting ready to take it live on the cheapest server I can find to test it in the real world with a significant celebration for just having done it to the point that things are running smoothly. The website will be member based. Some of the processing will involve multiple loops through a few files and I have to do some locking so the PHP server could get busy at times. Such activity in each time zone will occur between 4pm and 7pm all days of the week but on weekends it will also be busy between 10am and 1pm. So initially distribution of activity by time zone will naturally occur and will help delay the need to move to multiple servers. So when the excessive load does come I am thinking of continuing to use this time zone distribution by having different computers for different latitudes with the idea that each latitude computer will have its load distributed by time zones. I had to look up the difference between Latitude and Longitude and I placed what I needed to know in the next paragraph.
Latitude are the lines that go around the world. Degrees of latitude are 69 miles apart. Latitude starts as 0° at the equator and ends as 90° at the poles. Degrees are divided like a clock into 60 minutes (') and 60 seconds (") to help pinpoint a place between the 69 mile lines.
So here are the details of my idea. All website members worldwide log in to a single computer that picks up their profile information using PHP. However, at the beginning of the page after the login screen (what I call the control page) it checks the city they are from and the latitude of that city and uses this to decide what latitude computer to load the final information from before it sends them the control page. Here is the part I am not sure about. Maybe to do this jump from the profile computer to the proper latitude computer it would do a header command with a $_GET parameter string before calling the appropriate latitude computer. On the latitude computer a session is started for the user which is initially loaded from the $_GET array (just enough info is provided to keep them going).
Therefore each time they come back to the control screen this screen is being provided by the latitude computer related to their city rather than the initial profile computer they logged into.
If they want to update their profile they need to call the profile computer where all profile information is kept and the required information is passed back to the latitude computer where the control screen is pulled up from. A new session is started once they are back on the proper latitude computer.
If a user goes on a vacation to a different city (and want to use the services of the website) or they move to a different city the computer checks to see the latitude of this city (using Google maps) and if needed the user is taken to that latitude computer where the control screen is provided from. They will be forced to enter the remainder of their information on this new latitude computer (this is detected by that control page that they need to do this). Maybe this could be made more efficient by some sort of FTP transfer of their data to a CSV file on that target latitude computer and once they are on that computer the control screen detects that this file is there and it processes this file to include the new data thus saving the user the need to enter the data again. If they have gone on a simple one month vacation maybe new information which was entered on the 2nd latitude computer could be transferred by FTP to their main latitude computer and as before the control page on that computer would detect this file, use it to load their data files then delete that file. Maybe I could give them instructions to do this transfer across latitude computer during off peak hours.
Any thoughts would be greatly appreciated and hopefully this idea or suggestions regarding it may help others.
Thanks,
John