DAVID WORTHDATE PRESENTER:
TITLES ARE HARD
EVEN WHEN YOU SCALE WEB APPLICATIONS WELL
Intros - All Around
David Worth (firstname.lastname@example.org)
Friendly Engineer at DigitalOcean (seriously, seem
my business cards)
Who are you nice folks?
What is DigitalOcean?
We provide "Droplets" e.g. Virtual Private Servers,
Backups, Private Networking, IPv6, DNS, and
amazing tutorials and support.
We also provide a high-quality RESTful API which
provides access to everything you see in the web
DigitalOcean is a “Cloud Provider” e.g.
And… We’re Hiring
Come work with me! - Careers at DigitalOcean
DROPLETS COME IN NUMEROUS SIZES
“SIZE” DICTATES CPU, RAM, DISK SIZE, AND BANDWIDTH
NOW I NEED TO DO
… HAVE YOU TRIED
The two types of scaling:
Vertical - using bigger and bigger servers to meet
Horizontal - using more and more (potentially
smaller) servers to meet your needs.
Two types of Vertical
Scaling at DigitalOcean
Flexible - increase CPU and memory temporarily -
this can always be un-done and can meet a
Permanent - increase all of the attributes of your
Droplet (CPU, RAM, disk, and bandwidth) - cannot
Both are performed by “resizing” your Droplet.
Sounds Great! What do I
need to know?
Resizing requires your Droplet to be powered
down, then resized, and then powered back up.
e.g You will have an outage in case of a resize!
e.g. Your internet famousness will falter! (NO!!!)
So when would I want to
Before you launch!
Doing your development of a new site on the
smallest possible instance is cost-eﬀective and
makes sense. But before you post your site to /r/
* Yes - bigger pixels are faster/better/MOAR in this diagram
Why Horizontal Scaling?
Because sometimes bad things happen to good
droplets - Servers Crash. Software bugs bring
down a server. The internet just breaks. We try to
stop it but…
More importantly - Composing a few smaller
servers can be used, and more can be added
THE FIRST “EASY” STEP
LOAD-BALANCING OUR WEB SERVERS
Several “smaller” webservers - all sharing a single
database server - are “balanced” by a reverse-
proxy server such as Nginx or HAProxy.
Greater cost and technical overhead but greater
resiliency under failure of a single web-serving
You can add more webservers anytime you like!
As many as you like really. And of any size!
Oh… but what about that lone Database server!
What happens if it crashes? Or is overwhelmed
by a complicated query?
REPLICATING OUR DATABASE SERVERS FOR GREATER RESILIENCY - HYPERDB
The data on most applications and sites is write-once /
We can create replicas of the database holding all of
your precious content and have it arrive on other
database servers automagically.
Each webserver can then query its own copy of the
In the WordPress world this can be achieved with
… but what about static assets (like my selﬁes?!)
ADDING A CDN OR NETWORKED FILESYSTEM TO REPLICATE ASSETS
… that “or”
If you have constraints on your assets that you
control them at all times use a Network Filesystem
like Ceph or GlusterFS.
If you don’t have that constraint CDNs provide
many advantages including lower infrastructure
complexity, lower-latency, and a specialized
services whose only job is to server your assets.
Use some Conﬁguration
When bringing up new servers, it really helps to
not have to spend any manual energy doing so -
Use DigitalOcean’s User-Data, Ansible, Puppet,
SaltStack, or Chef.
This ensures your life is easier at 4am after three
consecutive all-nighters when you need more
You can use vertical scaling
with horizontal scaling
Once you can add and remove servers to your
conﬁguration, you can add various sizes too!
To scale up your entire architecture spin up a new,
larger server, and spin down a smaller one. Your
Load Balancer will add and remove them as
appropriate. Do this until all of your servers are
How to Automate the Scaling of your web
application on DigitalOcean
Automating the Deployment of a Scalable
How to Optimize WordPress Performance with
MySQL Replication on Ubuntu 14.04
Automating App Deployments using User-Data