DragonCity: A 2.5M DAU Social Game with a Symfony2 heart

It’s been a while since I last updated this blog and I am sorry about that.

My new job at SocialPoint gets me so tired that at the end of the week I don’t have much energy to collaborate in open-source projects or even write small posts like this. But I wanted to make the Symfony2 community aware of our current big project, which is the Facebook videogame DragonCity. You can see more info about it here and even give it a try at Facebook.

The great thing about this game is that we have achieved the amazing milestone of getting more than 2.5 Million Daily Active Users and all the backend is developed using Symfony2.

You can check these numbers at AppData and you can see that SocialPoint is number 13 on “Developer Leaderboard” at AppData Homepage (at least at the time of writing this…). We are not that far from giants like Tripadvisor, Spotify or Instagram so you can imagine how amazing it is to participate on such a project.

Besides this numbers, working in a videogame company is quite a different challenge if we compare it to my previous jobs, which were actually big websites.

In a website you can “easily” scale and improve performance by using cache systems like Memcached and speed up data retrieving using NoSQL technologies like Redis. Also improving your front-end files and HTTP caching techniques and softwares like Varnish can help a lot.

In a videogame, you face a totally different scenario. There is not much data you can cache in responses as most requests are player actions sent via POST to the backend. The front-end is basically a Flash application (yes, HTML5 is not that mature at this moment, let’s hope this changes in the near future) and some js and css over it to develop the item shop and some small tabs and cross-promotions. And besides that, when you try to store every user action in such a big traffic scenario you find lots of problems trying to scale your data storage systems.

So, as you can see, developing a videogame backend is totally different than a website, except that everything is done with HTTP requests. And this was one of the main reasons that made me accept this new job.

And yes, we are using Symfony2. Most people can start claiming that the framework is really slow and eats a lot of memory… and yes it is slower than a index.php saying “Hello world” but trust me that with APC properly configured and good production settings Symfony2 is fast like hell. Talking about memory, we had an issue when we upgraded to Symfony 2.0.16 where sometimes executing ‘app/console cache:warm’ in the deployment process crashed. And then we noticed that our production PHP configuration memory_limit was just 32Mb. So yes, Symfony2 does not use that amount of memory, unless you do crappy stuff… and then it is completely your fault!

Talking about bundles, most people can ask if we are using the ORM. Well, we are NOT using Doctrine2 because at the beginning we wanted the DAO objects to be as agnostic as possible (so that we could “easily” change from relational databases to some NoSQL systems). Once we stablish a deffinitive configuration for this game and the next to come, it is quite likely that we start using Doctrine DBAL if we end up using some MySQL flavour to store parts of the data.

And some people can also ask if we have done any big changes in Symfony2 kernel to make it fast, and the answer is just no. We desactivated some bundles we are not using, added some vendor dependencies and… basically that’s it!

So, please if you are starting a big new project do not hesitate to use Symfony2, as it can handle big amounts of requests and data!

Hope you liked to know about this project and I will try to post more often!

You may also like...

1 Response

  1. Jordi says:

    Enhorabona i gracies per compartir-ho.