A âExpiresâ header is a timestamp sent by your web server to your visitors browser. It instructs a browser to keep a specific piece of data in its cache until the time set by the header is reached. It can be tied to almost any kind of data sent by your server (images, stylesheets, javascripts, web pages).
You could, for example, tell browsers to re-download your logo image only once per month. So, if you have a million page views from returning visits in a month, you just saved your server a theoretical million hits (and about 19 gigabytes of bandwidth if your logo weights 20 kilobytes).
When properly set, it can be a HUGE performance booster and bandwidth saver.
[QUOTE=William Godin;61926]A âExpiresâ header is a timestamp sent by your web server to your visitors browser. It instructs a browser to keep a specific piece of data in its cache until the time set by the header is reached. It can be tied to almost any kind of data sent by your server (images, stylesheets, javascripts, web pages).
You could, for example, tell browsers to re-download your logo image only once per month. So, if you have a million page views from returning visits in a month, you just saved your server a theoretical million hits (and about 19 gigabytes of bandwidth if your logo weights 20 kilobytes).
When properly set, it can be a HUGE performance booster and bandwidth saver.
Thanks for the info, I wanted to find out more about that actually. Going to test that on some of my sites. It seems to be a excellent way of speeding it up.
Oh and sorry about you having to do 2 posts. ânewâ users have to have made a few posts before they can include a link in their posts⌠yours got stuck waiting for approval. Sorry about that.
Iâll have to look into this âAdd expires headersâ tactic a little more too. I just moved to a dedicated server and anything to save bandwidth is certainly good. Thanks for the info William Godin.
[QUOTE=William Godin;61942]No problem, Bjorn. It kinda is my fault! I have been a lazy contributor.
I intend to do better this year.
By the way, how is everyone keeping tab on their website performance? Weâve been using the Apdex score for a while, and it changed our lives.[/QUOTE]
Damn, Apdex looks very complicated! You mean as in overall performance including sales?
[QUOTE=William Godin;61926]A âExpiresâ header is a timestamp sent by your web server to your visitors browser. It instructs a browser to keep a specific piece of data in its cache until the time set by the header is reached. It can be tied to almost any kind of data sent by your server (images, stylesheets, javascripts, web pages).
You could, for example, tell browsers to re-download your logo image only once per month. So, if you have a million page views from returning visits in a month, you just saved your server a theoretical million hits (and about 19 gigabytes of bandwidth if your logo weights 20 kilobytes).
When properly set, it can be a HUGE performance booster and bandwidth saver.
Iâve started to use Expire in headers. Iâm serving java and design images from a subdomain and with a 1 year expire on them. But I can update them by changing what folder I store them in and a htaccess rewrites makes sure it still works.
But not sure itâs much different, does the site flicker to anyone:
Gay Porn Pig performs pretty badly on speed tests so we will be investing a bit in optimising it. Quite a bit will probably wait until we move it over to a new CMS (probably Gossamer based) - Joomla and some of the extensions seem too resource intensive.
Expires headers can be a pain in the ass if you have a dynamic site that changes after someone logs in. Take this site for example⌠How would you like it if you got a page that looked like you werenât logged in after you had actually logged in? Thatâs the sort of thing expires headers can do to you. Itâs even worse if thereâs a proxy server involved since the proxy server can cache a page and present it to multiple users - so you may get someone elseâs version of the page. Theyâve been the bane of my existence at times.
It gets more complicated since âExpiresâ isnât the only thing you need to set. âLast-Modifiedâ, âCache-Controlâ, and âPragmaâ are also HTTP headers that can affect the page caching. And on top of it all, there are HTML meta tag equivalents of each of them - and if they conflict you really have no clue what the browser will do⌠(Yes, thatâs up to 8 elements that all have to be in perfect sync).
Bjorn - I wouldnât recommend doing a 1 year expires on your Javascript. What if you want to change it? Iâd do a few hours at most so all the page loads in a particular session just hit the Javascript once. Thatâs really the point. The userâs browser cache wonât hold onto the file for a year, so thereâs no point in caching for a year.
Also, think about bang for the buck⌠Text files (HTML, JS, CSS) are small and highly compressible. Images are much better candidates for caching since they take a lot more bandwidth, though in the context of how fast does a particular page load, the overhead of retrieving the JS and CSS more than once can be a small factor. (More important is to make sure theyâre not on a different host that requires another DNS lookup and connection).
[QUOTE=rawTOP;62202]
Bjorn - I wouldnât recommend doing a 1 year expires on your Javascript. What if you want to change it? Iâd do a few hours at most so all the page loads in a particular session just hit the Javascript once. Thatâs really the point. The userâs browser cache wonât hold onto the file for a year, so thereâs no point in caching for a yearâŚ[/QUOTE]
Ah but there is a very simple way of solving the problem. I only use it for images and scripts that are used on all pages and I have a domain alias + htaccess setup for:
Forcing it to refresh. Itâs still the same file and location but just a simple htaccess rewrite that points that alias to the real location. Same with Java.
Itâs crazy hard to compute Apdex scorings! For the sake of our sanity, weâve outsourced that part. (Weâre using NewRelic)
Apdex doesnât calculate business performance per se (sales, etcâŚ). It just takes those hard-to-read technical metrics and transforms them into a measure of user satisfaction.
It basically tells you if the performance of your websites is a source of frustration for your customers in a manner us, non-ĂÂźber-geeks, can understand it.
Happy customers tend to be more loyal. And I just looove loyal customers. lol
[QUOTE=gaydemon;62223]Ah but there is a very simple way of solving the problem. I only use it for images and scripts that are used on all pages and I have a domain alias + htaccess setup for:
Forcing it to refresh. Itâs still the same file and location but just a simple htaccess rewrite that points that alias to the real location. Same with Java.:)[/QUOTE]
The additional dns lookup and http connection is probably hurting you more than youâre saving with the expires header. Putting everthing on www will make things a bit faster. You can still do your rewrite trick on a /static/ directory instead of a subomain.
[QUOTE=William Godin;62232]Itâs crazy hard to compute Apdex scorings! For the sake of our sanity, weâve outsourced that part. (Weâre using NewRelic)
Apdex doesnât calculate business performance per se (sales, etcâŚ). It just takes those hard-to-read technical metrics and transforms them into a measure of user satisfaction.
It basically tells you if the performance of your websites is a source of frustration for your customers in a manner us, non-ĂÂźber-geeks, can understand it.
Happy customers tend to be more loyal. And I just looove loyal customers. lol[/QUOTE]
It sounds really interesting, Iâm a sucker for efficiency and stats⌠What do you need to use it? What data is necessary to get a good âpictureâ or to be able to use this way of calculating performance?
Sure, there are probably a quite a few providers out there who can compute Apdex for you. Iâm using NewRelic RPM, but they require your website to be built in Ruby (or in Java I believe).
It all depends on the architecture of your websites. And if you canât find a provider, and you have access to programmers, they may be able to implement it for you.