Die Another Day
Scaling from 0 to 4M
requests per day as a
lone developer
I am Cristian…
Gawyn

@crplanas
… and this is the story of
how Playfulbet is growing.
The growth of Playfulbet is
not so spectacular.
1.5M daily pageviews
4M daily requests
But the interesting part of
this story is the small
resources we had.
This is not only the story of
how Playfulbet grows, ...
Me, scaling in October 2012
Me, scaling in February 2014
The difference?
One week of October 2012 v.
One week of February 2014
We are going to talk about
different techniques for
scaling.
But first, we need to
understand how an app
works.
The Restaurant
Analogy
Requests = Customers
Waiters = Application instances
Food = Data
So you want to scale your application?
Meet your next best friend:
The application graph
The browser graph
What happens when
something goes wrong
There are 2 ways for improving
load time:

1. Improve app performance
2. Improve your architecture
Improving
performance
The basic basics
- Use indexes in your DB.
- Optimize your queries:
eager loading, pluck….
Cache
In Playfulbet we use
memcached.
Materialize
Use the DB –or another
resource- to create a
shortcut to the data you
need.
An example

A bet is made on an option.
An option exists on a market.
A market exists on an event.
An event exists on a co...
Fake if it’s necessary.
The accuracy of some data is
critical.

But the accuracy of all data is
not always critical.
Improving the
architecture
In the beginning there was only
one server.
His name is…
But the load was too heavy.
So Maradona needed some help in
the back.
Obviously, our staging server also
has a cool name.
At this point we decided to
move our DB to Amazon.
Good: You don’t need to manage it yourself.
Bad: Latency.
The structure kept growing.
Our current structure
Proxy
Chat
SSL
Memcached

25 “Frontal”
servers

3 “Back” servers
Redis
But this structure can’t
continue.
1.

Our DB has performance
problems.
2. There are cheaper
alternatives.
3. VPS don’t sc...
In the very near future:
1.

We are moving to dedicated
servers.
2. We will use slave DBs for reads.
3. We will have someo...
So this is the end of me as the
only technical guy in
Playfulbet.
And this is why I wanted to
share this story with you.
Thanks!
Upcoming SlideShare
Loading in …5
×

Die Another Day: Scaling from 0 to 4 million daily requests as a lone developer by Cristian Planas

1,204 views

Published on

Scaling an app includes many different skills: from writing good code to system administration and architecture.

This are the slides of Cristian Planas talk, that took place at itnig on February 20th. Cristian is co-founder & CTO at Playfulbet, and he explained some basic lessons taken from the case of Playfulbet, a social game with more than 150.000 registered users.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,204
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Die Another Day: Scaling from 0 to 4 million daily requests as a lone developer by Cristian Planas

  1. 1. Die Another Day Scaling from 0 to 4M requests per day as a lone developer
  2. 2. I am Cristian… Gawyn @crplanas
  3. 3. … and this is the story of how Playfulbet is growing.
  4. 4. The growth of Playfulbet is not so spectacular. 1.5M daily pageviews 4M daily requests
  5. 5. But the interesting part of this story is the small resources we had. This is not only the story of how Playfulbet grows, but how I grow.
  6. 6. Me, scaling in October 2012
  7. 7. Me, scaling in February 2014
  8. 8. The difference? One week of October 2012 v. One week of February 2014
  9. 9. We are going to talk about different techniques for scaling.
  10. 10. But first, we need to understand how an app works.
  11. 11. The Restaurant Analogy
  12. 12. Requests = Customers Waiters = Application instances Food = Data
  13. 13. So you want to scale your application? Meet your next best friend:
  14. 14. The application graph
  15. 15. The browser graph
  16. 16. What happens when something goes wrong
  17. 17. There are 2 ways for improving load time: 1. Improve app performance 2. Improve your architecture
  18. 18. Improving performance
  19. 19. The basic basics - Use indexes in your DB. - Optimize your queries: eager loading, pluck….
  20. 20. Cache In Playfulbet we use memcached.
  21. 21. Materialize Use the DB –or another resource- to create a shortcut to the data you need.
  22. 22. An example A bet is made on an option. An option exists on a market. A market exists on an event. An event exists on a competition. A competition exists on a sport. All the bets should show an icon depending of the sport.
  23. 23. Fake if it’s necessary. The accuracy of some data is critical. But the accuracy of all data is not always critical.
  24. 24. Improving the architecture
  25. 25. In the beginning there was only one server. His name is…
  26. 26. But the load was too heavy. So Maradona needed some help in the back.
  27. 27. Obviously, our staging server also has a cool name.
  28. 28. At this point we decided to move our DB to Amazon. Good: You don’t need to manage it yourself. Bad: Latency.
  29. 29. The structure kept growing.
  30. 30. Our current structure Proxy Chat SSL Memcached 25 “Frontal” servers 3 “Back” servers Redis
  31. 31. But this structure can’t continue. 1. Our DB has performance problems. 2. There are cheaper alternatives. 3. VPS don’t scale CPU.
  32. 32. In the very near future: 1. We are moving to dedicated servers. 2. We will use slave DBs for reads. 3. We will have someone in charge of the system administration.
  33. 33. So this is the end of me as the only technical guy in Playfulbet. And this is why I wanted to share this story with you.
  34. 34. Thanks!

×