Sirv CDN – how it works
Sirv CDN is our highly optimized Content Delivery Network.
The CDN is made up of 24 points of presence (PoPs), located in major cities around the world. By serving files from the nearest PoP, your images will load extremely fast.
CDN features
Sirv CDN helps achieve Sirv's primary objective of delivering media as optimized and fast as possible:
- Smallest possible file size
- Automatic image conversion to next-gen formats (e.g. WebP)
- Automatic video optimization and streaming
- Automatic optimization of JS & CSS files
- All SEO best-practices for images and videos
- Delightfully easy to use DAM at my.sirv.com
Response times
The CDN routes each request to the geographically closest PoP to the users' location.
Response times are extremely fast, thanks to fine-tuned file and network optimization. The actual time required to fully return a request is determined by many factors:
- File size
- Cache status on CDN
- Cache status on primary processing server (if file not on CDN)
- Image processing time (if image not already processed)
- Location of user from their nearest PoP
- Speed and quality of users' internet connection
- Speed, quality and number of network hops between users ISP and Sirv's CDN
Average response time
The average response time for a 25 KB file returned by Sirv is as follows:
- Sirv CDN HIT: 25 ms
- Sirv CDN MISS, Sirv processing HIT: 55 ms
- Sirv CDN MISS, Sirv processing MISS: 160 ms
Your average response time is shown on your Performance page. For comparison, the average response time for a typical account is between 30 ms and 80 ms.
99th percentile response time
Averages reveal only part of the picture. For example, a user in a remote location and on a slow connection might receive the file after 1000 ms (1 second), which will bring down the average response time. Therefore, a more more revealing statistic is the speed of the fastest 99% of requests. The average fastest 99% of requests is:
- Sirv CDN HIT: 17 ms
- Sirv CDN MISS, Sirv processing HIT: 46 ms
- Sirv CDN MISS, Sirv processing MISS: 139 ms
HIT vs MISS
A HIT occurs when the file already exists on the server, so is immediately returned to the user. Otherwise, it's a MISS, causing the request to be forwarded to Sirv's primary datacenter.
Given that CDN HITs return the fastest response, try to keep a high HIT:MISS ratio. To increase your HIT ratio, consider this advice:
- Don't overwrite images with identical images
- Set a longer browser cache period (TTL)
- Choose suitable Default settings then try not to change them
A typical Sirv account will have 80-90% HITs and 10-20% MISSes. The HIT:MISS ratio for your account will be added to your analyitcs page in the future.
CDN cache headers
Sirv uses multiple layers of caching, to return files as quickly as possible.
In each response from Sirv, you will see headers for the two most interesting levels of cache:
- x-sirv-cache - cache status from primary processing server
- x-sirv-cdn-cache - cache status from CDN server
Of particular interest is the x-sirv-cdn-cache header. You can ignore the x-sirv-cache value - that is a cached response used by the Sirv team to identify if the image had already passed through image optimization.
The fastest possible response will be a HIT from the CDN because that will be the nearest server to your user. If the CDN server does not already have the file, the request will be sent to one of Sirv's processing servers. If the processing server does not already have the file, it will process it, cache it, then return it.
Browsers cache responses, so x-sirv-cdn-cache may repeatedly show MISS unless you clear your browser cache.
Interpreting cache headers
There are 4 possible combinations of headers.
MISS MISS
The following headers mean that the file didn't exist on the CDN server, nor on the primary processing server. It is typical of a newly uploaded file that has never been requested:
x-sirv-cache: MISS x-sirv-cdn-cache: MISS
HIT MISS
The following headers mean that the file didn't exist on the CDN server but did exist on the primary processing server:
x-sirv-cache: HIT x-sirv-cdn-cache: MISS
HIT HIT
The following headers mean that the file existed on the CDN server and had also existed on the primary processing server:
x-sirv-cache: HIT x-sirv-cdn-cache: HIT
MISS HIT
If the file was a MISS from the primary processing server, the CDN will receive a x-sirv-cdn-cache: MISS header and keep it until the file expires on the CDN (or is purged due to the master file being deleted). Therefore, it is possible and common to see CDN HIT and processing MISS. That simply refers to the MISS in the original request, which happened at some time in the past. It will look like this:
x-sirv-cache: MISS x-sirv-cdn-cache: HIT
Aim for CDN cache HIT
In summary, you can ignore the x-sirv-cache: MISS - what you're aiming for is x-sirv-cdn-cache: HIT.
Note: Sirv has multiple CDN servers, in multiple locations. It also has multiple processing servers. It balances the load across servers, so you might see different response headers for the same file from different devices or different geographic locations.
CDN file cache purging
Sirv CDN automatically stays up to date. Unlike traditional CDNs which can require manual intervention to prevent old images from being served, Sirv automatically purges all variants of an image when you upload a new version. This happens within 3 seconds across Sirv's CDN, meaning the old file will never be served again.
If a user has recently viewed a file and their browser has cached it, then their browser may show them the locally cached version in future. If your files change frequently and you have repeat visitors seeing the old files, consider reducing your browser cache duration, either for your entire account or, preferably, just for those frequently changing files. Another option is to select 'Purge from cache' and the latest version will display for all visitors.
The only time an image will not purge is if you replace a watermark image with a new version. Check how to purge images if you replace a watermark image.
Network diagram
The following network diagram shows how files are uploaded to Sirv, stored, processed and delivered from the CDN. Download as PDF.