1

I'm running a PHP based game which has over 45 Million members predicted for end of this year (2011) Currently we are on 7.5 Million, this game is being ran on facebook and I am in desperate need to help get this game server as efficient and as powerful as possible.

it is a dedicated server with

Processor Manufacturer Intel Model i7 920 Frequency 4x 2x 2.66 GHz NIC GigaEthernet RAM 12 GB Hard disk 4 x 1 TB

specs.

It has apache installed, cPanel, phpMyAdmin, several apache mods and MySQL.

The game also runs 47 mysql calls per second per user.

Is there any alternatives to the above which could be faster, more efficient etc?

I dont mind having to recode the game to fit to it, as long as it maximises our upper limit of members on the game.

Thanks

Also, is there a way to tell what our maximum limit to players, database calls etc is?

Thank you again, hope you guys can help :)

2
  • Are you trying to say you're getting >350m mysql responses per second off a consumer CPU? either your maths/measurement are wrong or you've got that thing overclocked to a few Thz.
    – Chopper3
    Feb 24, 2011 at 10:14
  • No, because they are never all online at the same time, most we have had online at once is around 40,000-50,000 Feb 25, 2011 at 17:04

2 Answers 2

7

The best way to load test your software and environment is to put it, or an identical system, under artificial load. If the game can be scripted do so and have many scripted players login and play from a neighbouring machine, slowly ramping up the number of artificial players until response times start to head towards levels that are not acceptable. This will give you an indication of your maximum number of users you can give good performance to at any one time.

Once you have the environment in a high load state, watch relevant system metrics to see where the bottleneck is (usually one component suffers before the rest) - if there is a way to optimise that do so and repeat the test. The first thing to check is whether the main limiting factor is disk I/O, RAM or CPU, then to pair down what is going on to see if the culprit is something you can easily optimise (perhaps some part of your code is inefficient and chewing up a lot of CPU time (in which case profiling the code may suggest point to tight loops that can be optimised), perhaps you run out of RAM and start swapping before IO or CPU become a major issue on their own (so adding more RAM or reducing the amount needed by each process could help), perhaps the database activity is saturating IO bandwidth, and so on.

There may be no way to optimise out the main bottleneck on a single machine that is worth the effort - then you need to start thinking about using multiple machines (you should make plans for this anyway, in case your popularity grows faster than expected or for the purposes of fail-over (to keep your app alive if one physical server develops a major fault).

Without some analysis it is difficult to given any more specific answers than that, as the performance metrics of one application can differ greatly from the next.

3

47 calls per user per second on that hardware wont work. Point. It is a way too high number to start with. Looks like inefficient coding / inefficient loops / too granular SQL. I would undersstand it in a limited degree for a real time game, but not for a browser game. I suggest you identify where those SQL Statements come from and find an alternative.

Second, if that is what it is, you have both, little ram and pathetic slow discs, both will be limiting factors in scalability.

4
  • 1
    +1 Anything more than one query every few seconds indicates very poor design and coding. Feb 24, 2011 at 10:10
  • @John: Definitely. I think I misread (or my mind mis-auto-corrected) that to "47 calls per minute" which is still high but more reasonable. Feb 24, 2011 at 11:47
  • So i should fit these all into one large query? Feb 25, 2011 at 13:16
  • Sou should make what makes sense, and without knowing exactly what you do it makes no sense to answer. Just 47 sql statements per second per user is simply not something that strikles me as sensible.
    – TomTom
    Feb 25, 2011 at 13:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .