Friday, 20 January 2017

Cheap Global Website Hosting

One of the most interesting things you can do with a website is to have it protected, and the source located in a safe harbour, that could be in a data centre that is local to you or one that has good data protection laws.

But in all cases the website must be visible to the outside world, this can be done with CDN (content delivery network) so that all users have the lowest latency.

Now you can build your own CDN and I'll go on to explain how in a later post or you can use one of the existing commercial ones like CloudFlare.

Behind that you need something to present your CDN with data this is your highest layer of the website and should ideally be a caching server with a master one or two layers down.  In my case, the proxy layer runs on port 80 but is getting content from port 8080 that is an ssh tunnel to the source, so while a full content is cached master is still accessed in case of changes.

Now I know what your thinking, that's fine for static content but what about dynamic content.
Basically the same thing the only difference is how you store data if the poxy's run a full content with the database or if the source handles all the write actions and leaves reads to the proxy.

The illustration above shows a more practical version of the layout as looking at these things in a flat view is often hard to understand.

So what are the advantages to this design? to start with you have reduced the load to the source webserver to only write changes allowing all reads to be cached where possible at the proxy and CDN layers,

So a typical design like this can handle 1000 users per webserver, giving this design to handle 6000 concurrent users for about $300, impressive when you think that you could easily have 10,000 users and just 6000 are active at any one point.

The design also allows for better security as the source is never publicly exposed to the security risks as two layers would need to be traversed just to get the location of the source, also since much of the content is cached updating the source is all that is needed to release a new version.