Web Content Caching Explained

The minefield that is web content caching can be confusing and complicated!

It’s one of those features that really sits between the network and the application. In many businesses this grey area has no real ownership and as such, mistakes are often made.

I want to take a little time to explore and hopefully simplify this complex area.

So firstly one must address the question of what is a content cache and why bother using it?

A content cache is a piece of software or an appliance designed to sit in front of the application server. Its job is to intercept certain requests and respond on behalf of the application thus reducing the number of hits sent to the backend severs.

Typically the requests that are intercepted have already been seen before, so the cache will store responses to these requests and if it intercepts a similar request it can respond in the same way.

A simple example would be an image cache. The client (ie browser) would make a response to the web server for an image. The first time this image is requested the cache will have to get it from the web server however for subsequent requests it will simply serve it directly.

The idea is that the web server will have a lot less work to do as the cache can serve a lot of the content. The implications of this really depend on the exact setup, application and content however they typically fit into the following:

1. Reduce load on the web/application servers – Save on application server hardware and licensing costs.

2. Reduce load on middleware and Backed DB systems.

3. Serve the content faster – Caches can be very fast!

4. Cache the content closer to your users. This is an interesting one. The cache does not always have to be at the same location as the rest of the system. You could use a good cache to build your own simple content distribution system to ensure your users get the content from a source as close to them as possible. Who said that a CDN (Content Distribution Network) has to cost the earth!

OK so you have decided that you may want to use a cache, so what next? The biggest problem with content caching is simply deciding what and for how long you want to cache content for. It sounds simple but failure to do this in the past has given many a network manager / application owner a genuine fear of caching. You don’t want one user getting the account balance of the previous user!

However to really make the most of the capabilities that a modern content cache can offer we must understand the full picture. The application behaviour, the cache setup and the browser behaviour.

Let us take a quick look at typically what happens when an image is requested from a web server by a browser.

1. The user requests an image to look at.

2. The Cache will notice that it has not seen this request before and therefore will request it from the web server.

3. The web server will get the image and send it back to the cache.

Important. The web server will decide if this image can be cached or not. It will instruct the upstream devices such as the cache and ultimately the client if it should be cached it or not. It does this by using specific HTTP header. (I won’t geek out on this, in this article as it can get overly complex.)

4. Now it gets interesting because the cache will need to decide on which way to go. Does it obey the rules from the web server or does it override it with its own rules? We will discuss this later on.

5. So the image is now sent back to the client and just to complicate things the client will also cache the content and also look out for the cache control header.

So we can see that not only do we have to decide on the application caching rules but also how we want the cache to behave upstream. If we do this right we can even reduce the number of hits reaching the cache and thus network in the first place.

So now we have a rough idea of what is going on, so how do we implement a cache?

A general method is described in “light” detail below.

1. Decide what you want to cache and for how long – So I want to cache all images for 24hours or all *.asp for 2seconds etc. These can get complicated.

2. Be certain you are happy with these rules.

3. Now check again.

4. Configure the cache to remove all cache control headers from the response from the web server. In other words ignore any caching control setup on the webserver – We assume we know how to create more accurate set of rules.

5. Configure the cache with these new rules and also expiry dates/ durations.

6. Configure the cache to add some new cache controls for the Client. Client side cache control is tough as browsers respect these rules with varying degrees of success. This is not really in the scope of this paper but I may revisit it.

7. Document – These rules can be complex and can involve speaking to people in different parts of the business to understand the application, therefore it’s worth documenting this info whilst it is fresh.

8. Test and test again – The more testing the better. Remember part of testing is to manually empty the content cache’s cache but also the client’s too.

That’s it for now folks.

I am writing a follow up on this talking in a little more detail about typical cache settings and also helping to answer questions such as, ‘will a cache be of any help for my application and if so what type of cache should I be looking at?’

Web Load Balancing and Caching 101

What is Load Balancing?

Load balancing is the process by which inbound internet protocol (IP) traffic can be distributed across multiple servers. Load balancing enhances the performance of the servers, leads to their optimal utilization and ensures that no single server is overwhelmed. Load balancing is particularly important for busy networks, where it is difficult to predict the number of requests that will be issued to a server.

Typically, two or more web servers are employed in a load balancing scheme. In case one of the servers begins to get overloaded, the requests are forwarded to another server. Load balancing brings down the service time by allowing multiple servers to handle the requests. This service time is reduced by using a load balancer to identify which server has the appropriate availability to receive the traffic.

The process, very generally, is straightforward. A webpage request is sent to the load balancer, which forwards the request to one of the servers. That server responds back to the load balancer, which in turn sends the request on to the end user.

What is Session Persistence and Why is It Important?

An important issue when operating a load-balanced service is how to handle information that must be kept across the multiple requests in a user’s session. If this information is stored locally on one backend server, then subsequent requests going to different backend servers would not be able to find it. This might be cached information that can be recomputed, in which case load-balancing a request to a different backend server just introduces a performance issue.

Load Balancing Algorithms

A variety of scheduling algorithms are used by load balancers to determine which backend server to send a request to. Simple algorithms include random choice or round robin. More sophisticated load balancers may take into account additional factors, such as a server’s reported load, recent response times, up/down status (determined by a monitoring poll of some kind), number of active connections, geographic location, capabilities, or how much traffic it has recently been assigned. High-performance systems may use multiple layers of load balancing.

Load balancing of servers by an IP sprayer can be implemented in different ways. These methods of load balancing can be set up in the load balancer based on available load balancing types. There are various algorithms used to distribute the load among the available servers.

Weighted Round-Robin Allocation

Weighted Round-Robin is an advanced version of the round-robin that eliminates the deficiencies of the plain round robin algorithm. In case of a weighted round-robin, one can assign a weight to each server in the group so that if one server is capable of handling twice as much load as the other, the powerful server gets a weight of 2. In such cases, the IP sprayer will assign two requests to the powerful server for each request assigned to the weaker one.

What is Web Caching?

A Web cache is a temporary storage place for files requested from the Internet. After an original request for data has been successfully fulfilled, and that data has been stored in the cache, further requests for those files (a Web page complete with images, for example) results in the information being returned from the cache rather than the original location.

Types of Web Caches

Forward/transparent proxy servers, reverse proxy servers (which are actually what the cache appliances are running internally) and web servers mostly have web caches. The caches in web servers are RAM caches as they already have the resources served locally. The caches on proxy servers could be RAM & DISK, usually both. It is highly recommended to install a 15k RPM or SSD HDD as proxy server DISK cache.

SSL Offloading

Secure socket layer (SSL) certificates provide authentication between a server and a client computer in a Web application. Companies or businesses with a dedicated SSL certificate must host that certificate on a Web server. Heavy use of the certificate can put a strain on the machine and slow down the application.

SSL offloading takes all the processing of SSL encryption and decryption off the main Web server and moves it to a separate device designed specifically for the task. This allows the performance of the main Web server to increase and it handles the SSL certificate efficiently.

HTTP Compression

There’s a finite amount of bandwidth on most Internet connections, and anything administrators can do to speed up the process is worthwhile. One way to do this is via HTTP compression, a capability built into both browsers and servers that can dramatically improve site performance by reducing the amount of time required to transfer data between the server and the client. The principles are nothing new – the data is simply compressed. What is unique is that compression is done on the fly, straight from the server to the client, and often without users knowing.

Suitable File Types

Sites that have a lot of plain text content, including the main HTML files, XML, CSS, and RSS, may benefit from the compression. It will still depend largely on the content of the file; most standard HTML text files will compress by about a half, sometimes more. Heavily formatted pages, for example those that make heavy use of tables (and therefore repetitive formatting content) may compress even further, sometime to as little as one-third of the original size.

URL Translation & URL Rewrite

URL translation is translation from externally known URLs to the internal locations

URL Rewriting is a server-side technique for mapping URL requests to request handlers.

Typically there is a direct mapping between request URL and the handler for that request. All requests that end in .php will be handled by a PHP script with the given name. Similarly, request paths that end in.html will typically be handled by a static file handler. The mapping between URL and handler is typically static, and depends solely on the “extension” of the URL Request.

Why Rewrite URLs?

There are many of reasons to rewrite URLs:

* Search Engine Optimization (SEO)
SEO is a broad topic, but the main goal is to assist search engines in finding content on a web site. One aspect of that is optimizing the URLs themselves.

* Making user-friendly URLs
Similar in effect to SEO, this allows the use of friendly public URLs where they are observed by users in links and browser bars. Elements within URLs that are meaningful only to server-side technology, including the extension of the server-side script or web app platform, can be obscured from the public.

* Server-side technology migrations
When migrating from one technology to another in stages, URL rewriting can be used to keep the URL space stable while things change on the server back-end. URL Rewriting can also be used to support migration of “old” or stale URLs to the new URL namespace, when those changes occur.

ServeTrue IQProxy supports all of the above with support at a reasonable cost for Windows

Best Way To Make Business PC’s Run Faster

Business computers cannot run slow. Period. So in order to improve the speed & reliability of your computer, you have to be able to clean out any of the problems which it may have with the files or options that it needs to run. The good news is that there are a number of effective ways to do this, which include using the likes of specialized software, as well as ensuring that Windows is able to process the files which it needs to run.

How To Improve Business PC’s Speed

1) Make Sure That Outlook Does Not Have Many Emails

If your Outlook program contains a large number of emails inside, it will likely take a large amount of system resources to run it. This problem sometimes cannot be avoided, and so it’s vital that you are able to either backup or archive the emails that Outlook has:

  • Open Outlook
  • From the top menu, select “File > Data Management”
  • Click “Add”
  • Choose your desired format
  • Enter your filename
  • Click “Save”

2) Uninstall Any Software Which Is No Longer Required

The next step is to clean out any of the programs which the system might not even need. This can be done by clicking onto the Start > Control Panel > Programs & Features, allowing your system to run much smoother and more effectively as a result. This should be done by the system administrator

3) Clean Out The Internet Cache

After that, you should also clean out the Internet cache for your system. This basically ensures that your PC is able to process the files and settings which your computer requires to run, and is used to make sure that you can get the most out of your computer’s Internet speed. To do this, your administrator should connect to the likes of Internet Explorer / Chrome / Firefox, select “Options” and then remove the infected settings that your PC may have.

4) Clean Out The Registry

The next step is to clean out the registry database of your computer. This is a large database which stores a large amount of important information for your system, and is continually being used to help ensure that your PC can process the likes of your most recent emails, desktop wallpaper and even your computer’s passwords. Unfortunately, the registry is continually leading a large number of errors to form on Windows, which can make a lot of computers run considerably slower. To fix this, you should can use a registry cleaner to scan through your PC and fix the errors it may have.