Current time: 09-19-2019, 12:12 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't configure apache to clear all F grades!
11-24-2011, 07:26 PM
Post: #1
Can't configure apache to clear all F grades!
If anyone with apache knowledge can advise, I would be very grateful.

I spent a day trying to optimise my httpd.conf and did see good improvements but have reached the end of my limited understanding.

This is where it has got to: http://www.webpagetest.org/result/111124_Y7_29JE7/

One bit that is bugging me is my failure to GZIP encode all text assets (the main html file):

FAILED - (43.8 KB, compressed = 6.1 KB - savings of 37.7 KB) - http://www.glovesonhand.co.uk/wa/1/43/44...shion.html

The apache config I added was:

<FilesMatch "\.(php|css|htm|html|xml|txt|js|pl|jpg|jpeg)$">
SetOutputFilter DEFLATE
</FilesMatch>

This did apparently compress the CSS file, but not the main page html file.

My other problem is in compressing images. If I tell apache NOT to compress jpg/jpeg files, then the initial load is 2s (25%) slower for this page. However, WPT still gives me a F and still lists the same jpg files as needing compression, even when I am compressing them and the page load is clearly faster.

Now I know a better solution would be to compress images before hand, not on the fly, but why does WPT show a faster load but still report the problem? Is it because it is simply unhappy with what it finds after unpacking the images, despite the fact they were handed over compressed? Is my only fix to better optimise the original images on this site? If so, any Mac OS X / Windows tools I can drop lots of files in and have them come out lighter (so our staff can do the work, not me using command line tools!).

Thanks for any insights, would love straight A grades!

John
Find all posts by this user
Quote this message in a reply
11-27-2011, 02:34 AM
Post: #2
RE: Can't configure apache to clear all F grades!
Are the html files actually html files on disk or are they using a rewrite rule to go to php or some other dynamic language?

As far as image compression goes, you won't be able to do that through apache - you don't want to gzip images. You need the jpeg images to be compressed at a lower image quality and you could either do it as a batch process or do it as part of the publishing process but you don't usually want to do that inline. It shouldn't be too hard to throw together a script that uses imagemagik to recompress all images to a quality level of 75 or 85.

I don't know how possible it would be on your platform but if you could combine the individual images for each color into a combined image (and use an image map or sprite) you could eliminate a lot of the individual image requests and speed things up a LOT.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-28-2011, 08:46 PM
Post: #3
RE: Can't configure apache to clear all F grades!
The HTML files are dynamically generated by an app server behind the web server (using Apple WebObjects). Can this not then be compressed on the way out, or do I need a different apache config?

Thanks for the image compression techniques, we have gone through this process and now all is ok on that front.

Thanks also for the tip on using a single image with image map. I have started to understand that numbers of resources / round trips is a key problem in performance.

John
Find all posts by this user
Quote this message in a reply
11-28-2011, 11:41 PM
Post: #4
RE: Can't configure apache to clear all F grades!
You can do it by mime type instead of just file extension:

Code:
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain    
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE text/xml    
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/json
</IfModule>

That should work a bit better for dynamically generated content.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-29-2011, 02:49 AM
Post: #5
RE: Can't configure apache to clear all F grades!
I had actually tried that route and the same results (it is in place now). The source for the page contains:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

which I assume should match on "text/html"?

Thanks
Find all posts by this user
Quote this message in a reply
11-29-2011, 02:53 AM
Post: #6
RE: Can't configure apache to clear all F grades!
Check the actual HTTP headers. Apache doesn't look at meta headers within the payload. There could also be another rule somewhere else that may be breaking it (check your htaccess and httpd.conf for downgrade or force-response-1.0
Visit this user's website Find all posts by this user
Quote this message in a reply
11-29-2011, 03:12 AM
Post: #7
RE: Can't configure apache to clear all F grades!
Well, there was (now commented out):

#BrowserMatch "Mozilla/2" nokeepalive
#BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
#BrowserMatch "RealPlayer 4\.0" force-response-1.0
#BrowserMatch "Java/1\.0" force-response-1.0
#BrowserMatch "JDK/1\.0" force-response-1.0

Here is what curl says about the headers:
curl -I http://www.glovesonhand.co.uk
HTTP/1.1 200 Apple
Date: Mon, 28 Nov 2011 17:09:11 GMT
Server: Apache/2.2.21 (Amazon)
connection: close
content-length: 12819
Content-Type: text/html; charset=UTF-8

still doesn't want to compress the main file returned

Thanks for your amazing help to this point and no problem if you don't have further ideas.
Find all posts by this user
Quote this message in a reply
11-29-2011, 04:15 AM
Post: #8
RE: Can't configure apache to clear all F grades!
Sorry, you've reached beyond my area of expertise (particularly with the Apple Web Objects side of things). It might be worthwhile to see if you can gzip directly at the app server, particularly if Apache is proxying the requests through and not running it as a cli.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-29-2011, 08:26 PM
Post: #9
RE: Can't configure apache to clear all F grades!
I have found a WebObject thread that touches on this: http://osdir.com/ml/webobjects-dev/2011-...00188.html
which suggests that there should be a config file for that adaptor specifically e.g. /Library/WebObjects/ Adaptors/Apache2.2/apache.conf containing:
SetOutputFilter DEFLATE
though that file path is a MacOS path and I can't see an equivalent config file on Amazon Linux
I will try to resurrect the thread and that list and post back if I find a solution.
Zipping at the app server is possible using a framework called Wonder, though I am not currently using that framework.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)