Another one of my questions regarding server hosting (hope i don't annoy anyone here. :P)
To give you a bit of insight before i ask the question:
I'm currently working on a platformer/racing game.
The idea is that players can race on maps and win medals (depending on how fast their run was). Custom maps can be created to by using the built-in map editor.
Now, naturally to get the most out of the experience i wanted to create a master-server which includes features like:
- online leaderboards
- statistic calculations (ladderpoints, current medal count, etc... NOTE: I don't run game-simulation on the server.)
- custom map sharing (players can log into the website and upload their custom maps which in turn allows others to download those from the web)
- 3D realtime WebGL based previews of said maps (you can preview maps in realtime in the webbrowser before downloading them
- server list for hosted game-servers by the players. (Hosted servers by the community register themselves on the master server so that others can see this particular server in the serverlist.)
The server could simultaneously be used to host other stuff like a forum and/or a blog for the game.
Now the big issue is that i have absolutely no idea how demanding this stuff will be in terms of hardware requirements and/or bandwidth (and traffic). Im quite limited when it comes to the budget which i can invest into the server per month. (It may be my first ever commercial release.)
I know that the general answer to stuff like this is "benchmark it!". But i hope that some of you with experience on this topic can give me advice/some tips to get an general idea on how beefy a server has to be in order to handle such a load.
Here are some details about how the communication between the client and server works and how some of the mentioned features were implemented on the serverside:
- Thew whole server-client communication is done via HTTP requests.
- Leaderboard requests are simple HTTP requests to a PHP script which reads the top 10 entries of a particular leaderboard + the players individual position. (around 2 to max 3 select statements to the database.).
- After each race, the client sends data (like palyerID, score, + some minor metadata) to the server and retrieves the leaderboard after the requests. (so those are 2 HTTP requests after each run.) Depending on the players skill, each map can be finished in a timespan of between 30 seconds and 2-3 minutes. (this is the average interval in which those requests could happen.)
- Statistics are calculated by using Cronjobs which run in an interval of 1-2 minutes on the server. In order to avoid heavy calculations, i update only 20-50 players per interval (want to save on CPU performance as the calculations can be quite heavy.).
- Mapfiles which can be uploaded to the server are rather small. Average size is between 32kb and 64kb (for middle to larger maps). In order to save space i compress those files on the serverside with gzip to reduce the filesize. (I also parse them on the serverside to make sure that this file really is a valid gamemap file.)
- The 3D WebGL based preview in the webbrowser downloads the selected map from the server as a compressed gzip file (to save traffic), extracts it on the clientside with javascript and then parses the file.
- Server list would also be updated with plain HTTP requests. A community hosted server could (as an example) send a "i'm still alive and have the IP XXX" HTTP request to the server every 1-3 minutes and insert/update this information in a mysql table. (Although i'm not sure if that would be feasible/a good idea for the server performance.)
Another thing that is worrying for me is running an unmanaged VPS.
I've done quite a bit of research on this topic and came to the conclusion that i have no idea how to setup,secure and maintain an unmanaged server. (I don't have the time and knowledge to do that.)
So i was looking into a managed server solution, though those are less common and more expensive compared to unmanaged solutions.
Now the question is, given that the communication is done by simple HTTP requests, i could technically use a simple managed Webserver/Webhosting solution (instead of an unmanaged VPS) so that i don't have to worry about configuring the server itself?
As an example, i have found this company (seems to be based in germany, although i have read that their datacenter is in france> https://www.hosteurope.de/en/WebServer/Comparison/ )
The 20 euro solution has 2GB quaranteed ram, unlimited MySQL databases on the HDD, 2 MySQL databases on a SSD (which would be ideal for the games data),100GB HDD storage (more than enough to store a ton of custom maps) and a "traffic flatrate", meaning that i have "theorethically" unlimited traffic. (Although they seem to have the right to limit the bandwidth of the server from 100Mbit down to 50Mbit if i start to stress the connection too much over a longer period of time.) The issue here is that they don't seem to specify how many cores are 'quaranteed" for this virtual webserver. (Probably none?)
My question now is: What kind of server (in terms of hardware like CPU and RAM) as well as traffic and bandwidth would be required in order to host a server like this? Especially if you have a bigger number of concurrent players (like 1000? Is this realistic?)
I don't want specifics, only a rough estimate in order to get an idea on how demanding that stuff can be. (Some of you may have done something similar before.)
If you have suggestions for companys which offer cheap services which could handle stuff like that i would love to check them out. :)
Of course, if it turns out that running such a server would be way too costly, then i would simply drop the whole masterserver altogether.