A
Artūras Šlajus
Hello there,
I'm writing a game server for flash based game. Currently there is MySQL
+ activerecord + activesupport + eventmachine.
At timed intervals (lets say 1 minute) actions should be done:
* buildings construction status should be updated.
* resource entries should be updated.
* technologies should be updated.
* unit construction status should be updated.
* unit movement status should be updated.
All those operations do heavy-duty actions with SQL and objects so they
take a while.
For example with 500 000 resource entries updating them all takes about
27 seconds.
500 000 resource entries are needed for 33 000 players.
I imagine that other status updates will add up to this time
considerably.
While eventmachine allows you to spawn green ruby threads, it seems that
mysql gem is blocking.
So far I had these ideas:
1) run things in linear fashion, ensure that everything runs pretty
speedy (under 1-2 seconds) because incoming requests would be blocked by
eventmachine. Buy another server if it doesn't.
2) run things in concurrent fashion, ensure that everything fits into
period (1 minute). Run updaters as separate ruby processes. Pretty
complex to code.
Perhaps there would be any other ideas that I've missed?
Thank you.
I'm writing a game server for flash based game. Currently there is MySQL
+ activerecord + activesupport + eventmachine.
At timed intervals (lets say 1 minute) actions should be done:
* buildings construction status should be updated.
* resource entries should be updated.
* technologies should be updated.
* unit construction status should be updated.
* unit movement status should be updated.
All those operations do heavy-duty actions with SQL and objects so they
take a while.
For example with 500 000 resource entries updating them all takes about
27 seconds.
500 000 resource entries are needed for 33 000 players.
I imagine that other status updates will add up to this time
considerably.
While eventmachine allows you to spawn green ruby threads, it seems that
mysql gem is blocking.
So far I had these ideas:
1) run things in linear fashion, ensure that everything runs pretty
speedy (under 1-2 seconds) because incoming requests would be blocked by
eventmachine. Buy another server if it doesn't.
2) run things in concurrent fashion, ensure that everything fits into
period (1 minute). Run updaters as separate ruby processes. Pretty
complex to code.
Perhaps there would be any other ideas that I've missed?
Thank you.