Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
Have you done any performance tuning on MySQL? – Michael Hampton Aug 29 '13 at 15:50

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
@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


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.