Can I scale more droplets horizontally at various Geographic Locations?

July 29, 2015 2.2k views
VPN DigitalOcean Deployment Clustering Miscellaneous Load Balancing WordPress Ubuntu

Eg if i have a Wordpress site built on EasyEngine on Droplet at DO SF,
Can it up to Auto Scale, ie create more droplets at other Geographic Locations depending on where the client is located closest to DO sever at respective region like Singapore or Europe. . is this possible? possible with EasyEngine, or Nginx or NGinx with varnish, or just any custom droplet can be replicated and Auto Created at other locations . Temporary or even permanently depending on traffice

2 Answers

Yes, but you need to use the API to create new instances, I recommend you to use varnish if all you need is to handle more traffic, yet a better option is no use a service Like Cloudflare and avoid the hassle to do it your self. Unless you application is massive I see no need to scale on servers, you better use a CDN/Caching solution like Cloudflare.

  • i read though the documentation for API's to create new instances. not sure if it allows Geographical Horizontal cloning, rather i wanted to clone same droplet in a different geographical region for better Content delivery .

    do you know any tutorial which you used varnish installation with wordpress? i am new at programming and server , i found a program called easy engine and he didnt not recommend varnish its from rtcamp you can check it . ?

    THe other major problem with do is lack of storage space which is going to force me to use google cloud storage or s3 , that said i might try cloud front for a year with free quota .

    do you know any good tutorials for varnish with wordpress and nginx etc ?
    do you know any tutorails for using external storage with do ?
    let me know thank you

  • How much data are you expecting to storage on your server? because big data means big costs transferring/replicating this data to different regions, that's why a caching system could work better, the "problem" with caching is you need to create your app around caching, that means no cookies or sessions, except where you really need them, and in that case you create rules on your cache system to avoid caching such sections of your site ie: you login/profile/setting/shoppingcart/etc sections, everything else should be cached and you need to avoid cookies and sessions there.

    Again Cloudflare is free (has premium but not needed on most cases) is hassle free and as a CDN offers cached copies of your data from the nearest geographical zone to your users READ MORE: Cloudflare , also works as your DNS/NS server which is great, gives you free SSL, caching, security against attacks, and more.

    Also if you have that many data you need to storage in a service like S3 (which only accepts static content ie: images, txt, css, js, etc) you probably don't need to store much in your server, so no need to replicate your server and again a caching system will be better. And you can use Cloudflare CDN to cache and deliver your content (even from Amazon S3/Google) from nearest geo zone to your users.

    So here is What I would do if your site is not too complex to require different:

    Create your server on DO (lets called origin) and setup what you need like nginx, php, mean, whatever you are using.

    Create a free account at Cloudflare and host your application domain there, and create record directing visitors to your DO server (Origin). Optionally you can create an extra cheap server and install varnish on it, you can do this to avoid high traffic to your Origin server in case you have too many visitors.

    If you do the last you configure your domain at Cloudflare this way:

    A record: www --> Varnish (IP address) --> Origin IP address

    So Varnish caches your content from Origin server and Cloudflare distribuits your content Globally.

    If you choose to also use S3/Google you can create a subdomain for your static content at cloudflare too, ie:
    CNAME record: --> Amazon S3/Google Storage, so again Cloudflare will cache and distribute your content globally from Amazon/Google.

    Now there are plenty guides for Varnish (choose Varnish version 4) all over the web and DO community, in CentOS is pretty easy as to add repos from, yum install varnish, edit /etc/sysconfig/varnish to choose how much storage and storage type you want to use (RAM/HDD) and then edit /etc/varnish/default.vcl to setup your backend. Also this is the file where you will add rules as you needed. There is plenty documentation on too.

    Here are some tips you will need with Wordpress and Varnish/Cloudflare

    Create/look for rules to avoid caching /wp-admin /wp-login.php

    On Varnish is like this:

    Don't cache admin
    sub vcl_recv {
        if (req.url ~ "((wp-(login|admin|comments-post.php|cron.php))|login)" || req.url ~ "preview=true" || req.url ~ "xmlrpc.php") {
            return (pass);
        } else {
            unset req.http.cookie;
    sub vcl_backend_response {
        # Dont cache admin
        if (bereq.url ~ "(wp-(login|admin|comments-post.php|cron.php))|login" || bereq.url ~ "preview=true" || bereq.url ~ "xmlrpc.php") {
            set beresp.uncacheable = true;
            set beresp.ttl = 120s;
            return (deliver);
        } else {
            if ( beresp.ttl > 0s ) {
                    unset beresp.http.set-cookie;
                # Our cache TTL
                set beresp.ttl = 10s;
                set beresp.grace = 24h;

    On Cloudflare is a simple "Page rule" you fill on a form like this one:
    Security Profile: High, Cache level: Bypass cache

    Also if you use S3/Google with Wordpress you will need to be sure to call all your static content from your CDN domain like the one we setup on cloudflare before, you can use WC Total Cache plugin for this.

    I know it can sound challenging if you are new at this but is pretty easy and reliable once you get it. Now as a final comment all this is really necessary if you are handling high concurrence of traffic, if you have few users maybe all you need is Cloudflare and one DO main server. Good luck!

thank you .
Target market New Zealand India South and East Asia and Rest of the world. but may have lot of traffic from north america depending on popularity .

I have added some extra changes as per your recommendations
I will be hosting about 10 blogs on a single droplet and as time goes will need more space and droplets are low on storage i will be doing this

Domain --> Cloudflare to AWS cloud front via wp plugin which will help me get data from aws, at (Usa and Europe Region Only class 100 as per aws)
S3 for all Media from WordPress. via plugin
Wordpress backups to Google cloud Storage.
Droplet at Singapore DO , linked to S3 Sever in Singapore. but cloud front at usa and europe only(data transfer from s3 sg to usa is free as of what i know )
Will be setting up Main Droplet where the content and data base is backed with Nginx CGI Fast Cache . unless there is a problem i wont use it .

I will be using w3 total cache for cloud front ,behind cloud front .
as per your suggestion i will also look at WC Total Cache.

I am hoping cloud flare may be smart enough to decide to server static cache content from my do dropet in the region around sg and there own cdn . for rest of the world use aws cloudfront and there own cloudflare cdn .

do you know ?how to divert dns as per geo location ie set up parameters what server to call for a specific region . can this be done via cloudflare . or any other way possible . they all will be only in english though with one exception also in chinese .

Have another answer? Share your knowledge.