Question

If you had a server and database that was getting way too much traffic, for lets say a simple online game, how would you consider scaling the server and database?

My thoughts are to future-proof it and scale both the server and database horizontally. I know this creates much greater complexity, but I feel like it's the best option.

Can someone offer me their thoughts? How would you identify the bottlenecks and issues within the database? What are the main things to look for before jumping in and scaling? How would you scale the server? How would you scale the database?

Thanks :)

Was it helpful?

Solution

Great question. There are several things I would suggest you do.

First, make sure you have a "bottleneck". A bottleneck is different from "slowness".

Does your application work well any of the time? If not, you have a slowness problem. If it works well most of the time but under some circumstances (load, data size, ...) it does badly you have a bottleneck.

Try to improve the obvious bottlenecks in your application first, they help you no matter what you do with the database.

For horizontal scaling, there are many alternatives. You could shard the database yourself in your application but this is not always easy and often has long term costs like maintenance that you should factor in. Also sharding could place limitations on the kinds of queries you can run against the database. I believe that in the long term, sharding is counter productive.

There are some "transparent horizontal scale-out" solutions out there and you can check them out as well. These solutions take care of all of the nuances of horizontal scale-out for you and are based on techniques similar to parallel databases (MPP databases).

Here are several references you should consider reading.

sharding at pinterest

sharding at netlog

this question on stackoverflow

Sharding for startups

Future proofing is a good idea, better to plan ahead. Full disclosure, I have a bias on this subject given the company I work for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top