Many web hosting services cram websites into the same servers due to resource inadequacy. I have worked with many such providers for quite some time and one of the great benefits is I am able to get their data for a reasonable price without their hosting becoming inefficient. This allows me to build pages and servers on shared resources so if one were to get overwhelmed, my site will stay up and running while they go down. This approach gives me an open door to ask questions of the providers and customers to make sure they are well-served.
Now, it is important to note there are various types of hosting that either need the flexibility or the reliability of shared resources. This means that the amount of resources each host will use will vary depending on the configuration. There are hosts that do not scale, but scale on an hourly basis, so if the hardware becomes unavailable that hosts cannot afford to run at a reasonable rate, the site would collapse.
The other major type of hosting that we need to look at is shared virtual hosts. Some of these are “production” hostings that are designed specifically to be run on shared resources, and this makes them ideal for the type of data intensive tasks like fact-checking and running bots that perform heavy database actions (query aggregations, projection, and comparison queries). Other hosts are more geared toward general web hosting. Hosting these on a shared virtual host gives you the flexibility of choosing the resources you need and adding resources as you need them without worrying about the resources of the server itself, which is another benefit of having shared hosting, and there also services of a dedicated server for hosting different websites.
How Hosting Works with Cloudflare
Here we will take a look at the various components of hosting a site in Cloudflare and then discuss how we can use these elements to optimize performance in a meaningful way.
Each piece of data on our site is used by two (or more) parts of our Cloudflare account. To illustrate this, let’s take the word “David” from our example blog. The URL for the blog is http://danandherman.com/blog. We then have the following pieces of data that are transmitted over the wire:
The original blog post and the new blog post with comments.
The Web server that the blog is being served on.
The Web server that is hosting the cache.
The public IP address that the blog is being served on.
The public IP address that Cloudflare is assigning to the blog’s client, meaning it knows where to send requests for the blog.
This means that a request to search for the word “david” will ask to query all three Cloudflare parts for the blog’s post. In some circumstances this can be a particularly slow process, so let’s take a look at the potential impact of a request that is made to Cloudflare and how it can be optimized.
The first thing we need to consider is the request and response times for a single request to Cloudflare. Depending on the amount of data that the Cloudflare service has to share between the client and the Web server, the longer the response time, the more CPU the client is requesting. If the return time for the request is too long, the client might drop the request, or might be forced to send a much longer one if the request is too large for the available resources.