CloudFlare, Caching, Bandwidth & Speed

by

Recently we have gotten a few queries from customers after the switch to using the CloudFlare services and I wanted to take a explain caching for those of you who are curious.

 

Part of the service that CloudFlare offers by default is a caching mechanism which saves your stores images, css and js files across the globe. This makes the sites load very quickly as the files can come from a server that is located very geographically close to the end user. See the map of CloudFlare’s data centers here https://www.cloudflare.com/network-map/ .

 

StoreSecured tells CloudFlare how long to save static content and then once a single customer has requested a file, that file is ready for the duration of the cache period for super quick loading from the CloudFlare servers and it also tells the user to cache locally (this was done previously as well). Please note that it is a best practice on the web to cache static content like images, css, and js files and to use a  CDN like CloudFlare to do so.  Cache is especially important for images that are part of your store template, ie those that are on each page of your website as once a user loads a file once on the first page load there is no need for them to need to load it again, this makes subsequent page loads much quicker.

 

What happens when you want to change an image or css/js file and want everyone to see it right away? Here is where caching can be more of a pain for you as the site owner/updater.  If the image is cached then users will still see the old image until the cache time period has expired. The way around this is to give the new image a new name. This will ensure that the new image is immediately downloaded and viewed by everyone.  Yes, this can be a pain but there is a big trade off here in site loading time for your users.

 

By default all StoreSecured sites are operating on a 4 hour cache with CloudFlare. This number can be increased, decreased or the cache can be removed (not recommended but it is an option if requested).  To change the default number of hours to cache for your site please contact us via support ticket with the new cache time.   A separate cache expiration can also be set for different folders in your site if desired.

 

Hint: The longer that files can be cached the more efficient/quick loading your site will be.  If your images do not change often and you are comfortable with renaming them when they do change then we recommend at least a 1 week cache expiration.

 

If you view your StoreSecured statistics often you may also have noted that the number of hits shown in your statistics file has gone down since you switched over to using CloudFlare.  This is normal and a good thing and again this is attributed to caching.  This has nothing to do with visitors to your site.  The hits is an indication of how many different files that users request when they come to your site.  A single page view can generate hundreds of hits, ie each image, css and js file that is needed to load a page is a hit.  Thus when a file gets cached it no longer has to be requested from the StoreSecured servers and your hit counts go down.  This also reduces the amount of bandwidth that your site uses.  Your visitor count in the stats should mostly remain the same but may go down slightly due to new protection features that block bad bots, spammers and attackers.  Since those people never reach the site their visit is no longer counted.

 

If you have any questions, comments or concerns please contact us at support@storesecured.com.


%d bloggers like this: