Re: [users@httpd] Apache24 - how to optimize httpd.conf
From Apache point of view... * Don't use .htaccess files... put everything in httpd.conf (or equivalent) there is a huge file system performance hit {Apache has to look for .htaccess files in the directory and any parent directories} include AllowOverride None in httpd.conf * Remove etags (Header unset Etag/FileETag None) * Enable keepalive * Turn on gzip encoding {mod_deflate} which you have done * Auto set expiry dates into the future {mod_expires}: ExpiresActive On / ExpiresDefault access plus 366 day / Header append Cache-Control public for static content... Additionally... * For images look at:optipng, jpegoptim advpng... {consider spriting if useful} * For minifying CSS/JS: look at yui compressor and google closure compiler... (Use jshint to check your js to make sure that it will merge/compress OK) * Can use a number of build tools to do some of this auto-magically... * Move (most) JS to the foot of the page Watch out with minifying HTML - there is a minor bug with most of the minifiers which which can't handle correctly ends of line after tags, and if you have gzip encoding it usually doesn't make a difference! Finally... * Look at your code and try and optimize your HTML { put as much presentation as possible into CSS } * Look at your JS - don't use multiple library classes - I have seen sites using jQuery, Scriptaculous and YUI at the same time! * On 08/06/2015 22:43, Motty Cruz wrote: Hello, I added this code on .htaccess IfModule mod_mime.c AddType application/x-javascript .js AddType text/css .css /IfModule IfModule mod_deflate.c *AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript* IfModule mod_setenvif.c BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html /IfModule IfModule mod_headers.c Header append Vary User-Agent env=!dont-vary /IfModule /IfModule does not seem to make a difference! On 06/08/2015 02:38 PM, Emir Ibrahimbegovic wrote: What have you tried? On Mon, Jun 8, 2015 at 5:35 PM, Motty Cruz motty.c...@gmail.com mailto:motty.c...@gmail.com wrote: Hello, I am getting the following suggestions from: https://developers.google.com/speed/pagespeed/insights/ Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML What is the best practice to solve errors above? Thanks, - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org mailto:users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org mailto:users-h...@httpd.apache.org -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Hi James, On 06/09/2015 03:59 PM, James Smith wrote: In many cases it will only be a few packets anyway so won't actually make that much difference! The point is that it is better to stop the request in the first place by setting the appropriate expires/cache control header... than use the etag mechanism... In case it wasn't clear, we very much agree on this one, my question was centered on the ETag in particular. Thanks for your reply! James On 09/06/2015 14:56, Frederik Nosi wrote: Hi James, On 06/09/2015 02:36 PM, James Smith wrote: Yes - it is the request over head - the client will still make the request at which point the server has got to decide has it changed before even - which for most static requests is the heaviest (slowest) part before returning the not-changed response - and then serving the content! But at this point the server in case of a positive match will send just a 304 reply with no content, thus saving bandwith and time (due to eventual roundtrips) no? You are better to: (a) set near future or mid future headers [ expires in a month or in a year] Sure, the best request is the one that does not even come :-) (b) alter filenames if you significantly change the file contents [ we use MD5 of content for js/css ] This only if you're in the posisition to decide the site layout though. Note this is hyper-tuning of Apache... some people may want to enable it - it was originally set up when most users were on 28K/33.6K modems (or slower) and the transfer of data was the slow part of the equation! James [...] Thanks, Frederik -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Thanks for your suggestions! Thanks, Motty On 06/09/2015 06:59 AM, James Smith wrote: In many cases it will only be a few packets anyway so won't actually make that much difference! The point is that it is better to stop the request in the first place by setting the appropriate expires/cache control header... than use the etag mechanism... James On 09/06/2015 14:56, Frederik Nosi wrote: Hi James, On 06/09/2015 02:36 PM, James Smith wrote: Yes - it is the request over head - the client will still make the request at which point the server has got to decide has it changed before even - which for most static requests is the heaviest (slowest) part before returning the not-changed response - and then serving the content! But at this point the server in case of a positive match will send just a 304 reply with no content, thus saving bandwith and time (due to eventual roundtrips) no? You are better to: (a) set near future or mid future headers [ expires in a month or in a year] Sure, the best request is the one that does not even come :-) (b) alter filenames if you significantly change the file contents [ we use MD5 of content for js/css ] This only if you're in the posisition to decide the site layout though. Note this is hyper-tuning of Apache... some people may want to enable it - it was originally set up when most users were on 28K/33.6K modems (or slower) and the transfer of data was the slow part of the equation! James [...] Thanks, Frederik -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Yes - it is the request over head - the client will still make the request at which point the server has got to decide has it changed before even - which for most static requests is the heaviest (slowest) part before returning the not-changed response - and then serving the content! You are better to: (a) set near future or mid future headers [ expires in a month or in a year] (b) alter filenames if you significantly change the file contents [ we use MD5 of content for js/css ] Note this is hyper-tuning of Apache... some people may want to enable it - it was originally set up when most users were on 28K/33.6K modems (or slower) and the transfer of data was the slow part of the equation! James On 09/06/2015 13:27, Frederik Nosi wrote: Hi James, On 06/09/2015 10:24 AM, James Smith wrote: From Apache point of view... * Don't use .htaccess files... put everything in httpd.conf (or equivalent) there is a huge file system performance hit {Apache has to look for .htaccess files in the directory and any parent directories} include AllowOverride None in httpd.conf * Remove etags (Header unset Etag/FileETag None) Won't this disable conditional requests, ex. If-None-Match and friends? Is your recomendation because of the header overhead or am I missing something? [...] Thanks, Frederik -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Hi James, On 06/09/2015 10:24 AM, James Smith wrote: From Apache point of view... * Don't use .htaccess files... put everything in httpd.conf (or equivalent) there is a huge file system performance hit {Apache has to look for .htaccess files in the directory and any parent directories} include AllowOverride None in httpd.conf * Remove etags (Header unset Etag/FileETag None) Won't this disable conditional requests, ex. If-None-Match and friends? Is your recomendation because of the header overhead or am I missing something? [...] Thanks, Frederik
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Remove etags (Header unset Etag/FileETag None) Won't this disable conditional requests, ex. If-None-Match and friends? Is your recomendation because of the header overhead or am I missing something? Just if-None-Match. If-Modified-Since would still work. I believe people recommend disabling ETags because they may cause problems with clusters (i.e. different inode numbers or modification times for otherwise identical files), or gzip content encoding (https://bz.apache.org/bugzilla/show_bug.cgi?id=45023). rainer - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Hi Rainer, On 06/09/2015 02:53 PM, Rainer Canavan wrote: Remove etags (Header unset Etag/FileETag None) Won't this disable conditional requests, ex. If-None-Match and friends? Is your recomendation because of the header overhead or am I missing something? Just if-None-Match. If-Modified-Since would still work. I believe people recommend disabling ETags because they may cause problems with clusters (i.e. different inode numbers or modification times for otherwise identical files), or gzip content encoding (https://bz.apache.org/bugzilla/show_bug.cgi?id=45023). Well, if it's a static file i think the etag calculation should be quite fast, after all in the default apache setting it's computed using thre values: FileETag INode MTime Size which at least on linux should be cached in the dentry / filesystem cache. So intuitively should be less work then reading this values, the file content and sending it. It's not that i've done measurements on this though, just speculation. As for the cluster case (and for security reasons), i've been using: FileETag MTime Size Out of curiosity, does somebody have real misurements? rainer - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Apache24 - how to optimize httpd.conf
It's not the etag calc it's actually the round tripping to the server that is the main over head - better to get the client to cache content... Apache will still have to touch the file system to see if the content has changed (however it is done) and on some filesystems just locating the file and making sure the user can read it is slower than serving it (especially high availability and virtual file systems)... James On 09/06/2015 14:51, Frederik Nosi wrote: Hi Rainer, On 06/09/2015 02:53 PM, Rainer Canavan wrote: Remove etags (Header unset Etag/FileETag None) Won't this disable conditional requests, ex. If-None-Match and friends? Is your recomendation because of the header overhead or am I missing something? Just if-None-Match. If-Modified-Since would still work. I believe people recommend disabling ETags because they may cause problems with clusters (i.e. different inode numbers or modification times for otherwise identical files), or gzip content encoding (https://bz.apache.org/bugzilla/show_bug.cgi?id=45023). Well, if it's a static file i think the etag calculation should be quite fast, after all in the default apache setting it's computed using thre values: FileETag INode MTime Size which at least on linux should be cached in the dentry / filesystem cache. So intuitively should be less work then reading this values, the file content and sending it. It's not that i've done measurements on this though, just speculation. As for the cluster case (and for security reasons), i've been using: FileETag MTime Size Out of curiosity, does somebody have real misurements? rainer - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE. - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Hi James, On 06/09/2015 02:36 PM, James Smith wrote: Yes - it is the request over head - the client will still make the request at which point the server has got to decide has it changed before even - which for most static requests is the heaviest (slowest) part before returning the not-changed response - and then serving the content! But at this point the server in case of a positive match will send just a 304 reply with no content, thus saving bandwith and time (due to eventual roundtrips) no? You are better to: (a) set near future or mid future headers [ expires in a month or in a year] Sure, the best request is the one that does not even come :-) (b) alter filenames if you significantly change the file contents [ we use MD5 of content for js/css ] This only if you're in the posisition to decide the site layout though. Note this is hyper-tuning of Apache... some people may want to enable it - it was originally set up when most users were on 28K/33.6K modems (or slower) and the transfer of data was the slow part of the equation! James [...] Thanks, Frederik
Re: [users@httpd] Apache24 - how to optimize httpd.conf
In many cases it will only be a few packets anyway so won't actually make that much difference! The point is that it is better to stop the request in the first place by setting the appropriate expires/cache control header... than use the etag mechanism... James On 09/06/2015 14:56, Frederik Nosi wrote: Hi James, On 06/09/2015 02:36 PM, James Smith wrote: Yes - it is the request over head - the client will still make the request at which point the server has got to decide has it changed before even - which for most static requests is the heaviest (slowest) part before returning the not-changed response - and then serving the content! But at this point the server in case of a positive match will send just a 304 reply with no content, thus saving bandwith and time (due to eventual roundtrips) no? You are better to: (a) set near future or mid future headers [ expires in a month or in a year] Sure, the best request is the one that does not even come :-) (b) alter filenames if you significantly change the file contents [ we use MD5 of content for js/css ] This only if you're in the posisition to decide the site layout though. Note this is hyper-tuning of Apache... some people may want to enable it - it was originally set up when most users were on 28K/33.6K modems (or slower) and the transfer of data was the slow part of the equation! James [...] Thanks, Frederik -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Re: [users@httpd] Apache24 - how to optimize httpd.conf
At 09:24 AM 6/9/2015 +0100, James Smith wrote: [snip good advice] * For minifying CSS/JS: look at yui compressor and google closure compiler... (Use jshint to check your js to make sure that it will merge/compress OK) * Can use a number of build tools to do some of this auto-magically... One possible caveat -- mod_pagespeed which is from Google dev (the start of this thread.) We tried it in a pre-production 2.4 environment, and while most of the output was well rewritten/minified/re-ordered, it put an enormous hit on server CPU cycles (on a very fast machine) -- to the point that end-user browser load times suffered. We had to drop it. (Note this was for a fairly complex perl/js site, so YMMV. Note also that Google do not *now* recommend it for 2.4, only 2.2, if I understand their notes correctly.) Best -- Paul * Move (most) JS to the foot of the page Watch out with minifying HTML - there is a minor bug with most of the minifiers which which can't handle correctly ends of line after tags, and if you have gzip encoding it usually doesn't make a difference! Finally... * Look at your code and try and optimize your HTML { put as much presentation as possible into CSS } * Look at your JS - don't use multiple library classes - I have seen sites using jQuery, Scriptaculous and YUI at the same time! On 08/06/2015 22:43, Motty Cruz wrote: Hello, I added this code on .htaccess IfModule mod_mime.c AddType application/x-javascript .js AddType text/css .css /IfModule IfModule mod_deflate.c AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript IfModule mod_setenvif.c BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html /IfModule IfModule mod_headers.c Header append Vary User-Agent env=!dont-vary /IfModule /IfModule does not seem to make a difference! On 06/08/2015 02:38 PM, Emir Ibrahimbegovic wrote: What have you tried? On Mon, Jun 8, 2015 at 5:35 PM, Motty Cruz mailto:motty.c...@gmail.commotty.c...@gmail.com wrote: Hello, I am getting the following suggestions from: https://developers.google.com/speed/pagespeed/insights/https://developers.google.com/speed/pagespeed/insights/ Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML What is the best practice to solve errors above? Thanks, - To unsubscribe, e-mail: mailto:users-unsubscr...@httpd.apache.orgusers-unsubscr...@httpd.apache.org For additional commands, e-mail: mailto:users-h...@httpd.apache.orgusers-h...@httpd.apache.org -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
Re: [users@httpd] Apache24 - how to optimize httpd.conf
What have you tried? On Mon, Jun 8, 2015 at 5:35 PM, Motty Cruz motty.c...@gmail.com wrote: Hello, I am getting the following suggestions from: https://developers.google.com/speed/pagespeed/insights/ Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML What is the best practice to solve errors above? Thanks, - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Look into grunt or gulp first for Minify CSS,Minify HTML and optimizing images. On Mon, Jun 8, 2015 at 5:38 PM, Emir Ibrahimbegovic emir.ibrahimbego...@gmail.com wrote: What have you tried? On Mon, Jun 8, 2015 at 5:35 PM, Motty Cruz motty.c...@gmail.com wrote: Hello, I am getting the following suggestions from: https://developers.google.com/speed/pagespeed/insights/ Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML What is the best practice to solve errors above? Thanks, - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org -- -- May the source be with you. - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Apache24 - how to optimize httpd.conf
And CDNs are your friend. On Mon, Jun 8, 2015 at 5:41 PM, Darryle Steplight dstepli...@gmail.com wrote: Look into grunt or gulp first for Minify CSS,Minify HTML and optimizing images. On Mon, Jun 8, 2015 at 5:38 PM, Emir Ibrahimbegovic emir.ibrahimbego...@gmail.com wrote: What have you tried? On Mon, Jun 8, 2015 at 5:35 PM, Motty Cruz motty.c...@gmail.com wrote: Hello, I am getting the following suggestions from: https://developers.google.com/speed/pagespeed/insights/ Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML What is the best practice to solve errors above? Thanks, - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org -- -- May the source be with you. -- -- May the source be with you. - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
Re: [users@httpd] Apache24 - how to optimize httpd.conf
On Mon, Jun 08, 2015 at 02:35:24PM -0700, Motty Cruz wrote: Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML All of those bar one are content issues and therefore unconnected with your server config. The one you might consider is Leverage browser caching which suggests that you have not set your expiry headers sensibly (or at all). Have a look at the mod_expires documentation at http://httpd.apache.org/docs/2.4/mod/mod_expires.html Pete -- Openstrike - improving business through open source http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107 pgpQklo20nrR0.pgp Description: PGP signature
Re: [users@httpd] Apache24 - how to optimize httpd.conf
Hello, I added this code on .htaccess IfModule mod_mime.c AddType application/x-javascript .js AddType text/css .css /IfModule IfModule mod_deflate.c *AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript* IfModule mod_setenvif.c BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html /IfModule IfModule mod_headers.c Header append Vary User-Agent env=!dont-vary /IfModule /IfModule does not seem to make a difference! On 06/08/2015 02:38 PM, Emir Ibrahimbegovic wrote: What have you tried? On Mon, Jun 8, 2015 at 5:35 PM, Motty Cruz motty.c...@gmail.com mailto:motty.c...@gmail.com wrote: Hello, I am getting the following suggestions from: https://developers.google.com/speed/pagespeed/insights/ Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML What is the best practice to solve errors above? Thanks, - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org mailto:users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org mailto:users-h...@httpd.apache.org
[users@httpd] Apache24 - how to optimize httpd.conf
Hello, I am getting the following suggestions from: https://developers.google.com/speed/pagespeed/insights/ Should Fix: Optimize images Leverage browser caching Consider Fixing: Eliminate render-blocking JavaScript and CSS in above-the-fold content Minify CSS Minify HTML What is the best practice to solve errors above? Thanks, - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org