2. Intros - All Around
David Worth (dworth@digitalocean.com)
Friendly Engineer at DigitalOcean (seriously, seem
my business cards)
Who are you nice folks?
3. 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
UI "cloud".
DigitalOcean is a “Cloud Provider” e.g.
13. When first starting a new blog, site, application, or
toy it probably makes sense to use the smallest
server you can get away with for money reasons.
17. NOW I NEED TO DO
SOMETHING!
… HAVE YOU TRIED
SCALING?
18. The two types of scaling:
Vertical - using bigger and bigger servers to meet
your needs.
Horizontal - using more and more (potentially
smaller) servers to meet your needs.
19. Two types of Vertical
Scaling at DigitalOcean
Flexible - increase CPU and memory temporarily -
this can always be un-done and can meet a
temporary need.
Permanent - increase all of the attributes of your
Droplet (CPU, RAM, disk, and bandwidth) - cannot
be undone.
Both are performed by “resizing” your Droplet.
20. 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!!!)
21. So when would I want to
resize?
Before you launch!
Doing your development of a new site on the
smallest possible instance is cost-effective and
makes sense. But before you post your site to /r/
cuteness resize!
24. 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
without downtime!
30. The short-version…
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
droplet.
You can add more webservers anytime you like!
As many as you like really. And of any size!
31. Oh… but what about that lone Database server!
What happens if it crashes? Or is overwhelmed
by a complicated query?
35. Database Replication
The data on most applications and sites is write-once /
read-many so…
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
data.
In the WordPress world this can be achieved with
HyperDB.
36. … but what about static assets (like my selfies?!)
38. ADDING A CDN OR NETWORKED FILESYSTEM TO REPLICATE ASSETS
39. … 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.
41. Use some Configuration
Management
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
capacity.
42. You can use vertical scaling
with horizontal scaling
Once you can add and remove servers to your
configuration, 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
upgraded!
45. References:
How to Automate the Scaling of your web
application on DigitalOcean
Automating the Deployment of a Scalable
WordPress Site
How to Optimize WordPress Performance with
MySQL Replication on Ubuntu 14.04
Automating App Deployments using User-Data