Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I currently manage a game that handles around 8K daily users, the current server setup is

VPS: 16GB+8cores+ 160GBSSD. 
Handles 8K daily users that are generating 600K daily direct calls to the mysql DB; 
The situation is: The game is growing, and server response is slowing down.

So! I'm looking for options to avoiding having an incredibly slow server, and saw Memcache as a viable solution, and studying it I came up with 2 questions, which are:

Is it safe to store ONE Key value per user, that contains all user data, perhaps as a concatenated string that would be around 100 characters long, and then update the DB every once in a while? ->that would mean having thousands of keys at the same time.

The idea is not to replace mysql, just to aid it in the users session and be able to update the DB every so often, for this situation would Sessions or Memcache be the right way to go?

share|improve this question
2  
Have you done any performance tuning on MySQL? –  Michael Hampton Aug 29 '13 at 15:50

1 Answer 1

You can make quite big values, however, using Redis would be better. With Memcached you are limited to Key->Value pairs, Redis has alot more features and offers you more (and better) solutions for what you want (more like a database).

But both Redis and Memcache are in-memory solutions, so make sure they don't contain mission critical data. Otherwise you could decide to let Redis dump it's database on file every xxx actions or x minutes, use master-slave replication / cluster, and so on.

share|improve this answer
    
oh wow, I didn't know about Redis, will definitely explore! thanks a lot Jeroen! –  Felipe Zuleta Aug 29 '13 at 14:45
    
+1 for redis :) –  simon Aug 29 '13 at 15:00
1  
@FelipeZuleta Be aware that you still need to write changes out to disk as soon as is practical, otherwise you open a window for potential exploits (e.g. duplicating gold or items). –  Michael Hampton Aug 29 '13 at 15:49
    
@FelipeZuleta Another option would be to replace MySQL (I know you say that's not your goal, but SQL and relational databases are not always the best option. Something like Redis with disk dumps or MongoDB may be a better fit for your purposes...) –  voretaq7 Aug 29 '13 at 15:55
    
Hi Michael! thanks for the reply, I'll keep that in mind. Hi voretaq7, I'll check out both Redis and MongoDB :) thanks! –  Felipe Zuleta Aug 29 '13 at 16:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.