use mod_gzip for javascript files

VERIFIED FIXED

Status

VERIFIED FIXED
11 years ago
6 years ago

People

(Reporter: pascalc, Assigned: mrz)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
This is for both mozilla.com and mozilla-europe.org (and potentially other mozilla sites).

Javascript files are not sent gziped from Apache, we should do that to save bandwidth and improve page load since we use some pretty big javascript libraries with the new design.
CCing mrz for comment.  I think there has been some problem with caching compressed data in the netscaler and I'm not sure if this would trigger the problem.  Maybe it would help to gzip it on the NS instead of apache?
(Assignee)

Comment 2

11 years ago
That was different - the issue there was with the netscaler doing compression, not with caching pre-compressed objects.  However, I think the issues I thought were related to compression last week were related to that other Netscaler bug.  I reverted the rules I had in place.

If the js is cachable it should also be compressible - do you have a specific URL?

Updated

11 years ago
Duplicate of this bug: 422815

Comment 5

11 years ago
We should also use mod_gzip on CSS files, same general concept.

If possible we would also like this done for AMO.

Thanks!

Updated

11 years ago
Duplicate of this bug: 441412
(Assignee)

Updated

11 years ago
Assignee: nobody → mrz
(Assignee)

Comment 7

11 years ago
If I read the Netscaler config, .js and .css should already be compressible ready objects.  I have a ticket open with them.

(Assignee)

Comment 8

11 years ago
Took awhile but finally figured out what the built-in compression policies do.  

1)      Name: ns_cmp_content_type       Rule: ns_content_type
2)      Name: ns_cmp_msapp      Rule: (ns_msie && (ns_msword || ns_msexcel || ns_msppt))
3)      Name: ns_cmp_mscss      Rule: (ns_msie && ns_css)
4)      Name: ns_nocmp_mozilla_47       Rule: ns_mozilla_47 && ns_css

ns_content_type matches "Content-Type CONTAINS text".  ns_css matches "Content-Type CONTAINS text/css".  ns_mozilla_47 matches "User-Agent CONTAINS Mozilla/4.7".  

I've created the following:

add policy expression moz_javascript "RES.HTTP.HEADER Content-Type CONTAINS application/x-javascript"

add cmp policy moz_cmp_css_js -rule "(moz_javascript || ns_css)" -resAction COMPRESS

Would like a second set of eyes before I bind that to the compression engine. 


(Assignee)

Comment 9

11 years ago
nslb01> show cmp policy moz_cmp_css_js
        Name: moz_cmp_css_js    Rule: (moz_javascript || ns_css)
        Response action: COMPRESS       Hits: 345
        Bytes In:...5707814     Bytes Out:... 1905336
        Bandwidth saving...66.62%       Ratio 3.00:1
 Done

Can't actually tell if it's working other than watching the Hits counter increment.

mrz@boris [~/] 8> GET -desS -H'Accept-Encoding: gzip,deflate' http://www.mozilla-europe.org/js/util.js
GET http://www.mozilla-europe.org/js/util.js --> 200 OK
Cache-Control: max-age=300       
Connection: Keep-Alive
Date: Wed, 25 Jun 2008 06:06:39 GMT
Via: NS-CACHE-6.0:   4
Accept-Ranges: bytes
ETag: "b33"
Server: Apache/2.2.3 (Red Hat)
Content-Length: 2867
Content-Type: application/x-javascript
Expires: Wed, 25 Jun 2008 06:11:39 GMT
Last-Modified: Tue, 17 Jun 2008 18:00:39 GMT
Client-Date: Wed, 25 Jun 2008 06:08:53 GMT
Client-Peer: 63.245.209.63:80
Client-Response-Num: 1
Keep-Alive: timeout=300, max=862

and,
 curl -H'Accept-Encoding: gzip,deflate' http://www.mozilla-europe.org/js/util.js

returns uncompressed content.  Maybe I'm not checking right?
(In reply to comment #9)
>  curl -H'Accept-Encoding: gzip,deflate'
> http://www.mozilla-europe.org/js/util.js
> 
> returns uncompressed content.  Maybe I'm not checking right?
> 

No, you're right. Firebug reports uncompressed js files.
(Assignee)

Comment 11

11 years ago
Can you give me a css url to check?  Maybe it's getting one and not the other?
(In reply to comment #11)
> Can you give me a css url to check?  Maybe it's getting one and not the other?
> 

https://addons.mozilla.org//css/type.css

It's gzipping css :) Halfway there!
(Assignee)

Comment 13

11 years ago
Citrix case 31804164.

I'm catching some javascript - 

nslb01> show expression moz_javascript
1)      Name: moz_javascript  Expr: "RES.HTTP.HEADER Content-Type CONTAINS javascript"  Hits: 557583
 Done

That's a lot of hits but I have no idea why that test URL isn't matching.
(Assignee)

Comment 14

11 years ago
OMG IT'S RETURNING COMPRESSED!

mrz@boris [~/] 16>                                                                                                     VaSÛ8ýL~Å?4[~/] 1N ½~(Íu ´wÜéîèÓat-Encoding: gzip,deflate' http://www.mozilla-europe.org/js/util.js
   ÒB¥×/º*½7:"ÇÖ*\aDöc|,õ¡F!EqÈxqþk¢¡D>Å-Ãé-¬$qeJ÷Vý>íÑËdÐæL¶¶[¡Î&ÊѸԩWF¾±=#|ú¤±²ÎÛRÓLäÒq¹YSC#SOj
iyÚ                                              w̽òmG¦"íÁÞ57ìË       /O'!±/-
                                                                              s=2X²ådçlá8¡¬:R. Þ,kCu±èëצNZk`IË)KKÿ®ü¹{˜Åm/®¶CíNâ¤ßóÞ*p%ãvH³Ýk£¨vg7 ݵZøA      縚(ŝêƒìKÈ#Ìr5—šd&¡JbV¢„dڃÉZc†ê‡&I&~ZÐõ¡¹››Æú½^Öxáå¾H¯skJ½7ö@ÍãLÍ/UÖÔì<ˆPH4%^äôÎÔTÂ&nØ¿¹óbóå¶kV¡Éº{+Ú]NQ7ÿÒÞÂZ4$êÕyrWô`w´<¨4_ÀËÕ´ô0{
²ºR&¿S5UÀâ^Õ]§à¸Õåö¬·1E°+ÁÎE.í¬ÍGW?I,5Ó¦F!ÔÄ(d6¤à3.±Mwôå¸rj·ÙÆH+EÒ@×V×çTöæ¢(e/·8 à[(ÍÙm   u+à3F¨
Ô¹tuëºÀ¡[ý{ô&ß`cÏæ.Ü®X¨]}Áÿ·§CoÓWü­ ¹Þï5_-[O¸»Mײ¼¨Rù\·-»ðU5ðªR+ÑNo                    *°&
K­yþBX« XÛ$©Z
Huzzah! We now get a D for performance instead of an F in ySlow!
(Assignee)

Comment 16

11 years ago
Can someone check if other js pages are getting compressed?
(Assignee)

Comment 17

11 years ago
It's what I suspected - http://www.mozilla-europe.org/js/util.js was in the cache as a non-compressed object (pre-compression policy).

Post compression policy, I had to wait for that object to expire before a new version of that object was cached.

The draw back is that only one version can be in the cache, either compressed or uncompressed as shown below.  Marking closed though.

mrz@boris [~/] 3> GET -desS -H'Accept-Encoding: gzip,deflate' http://www.mozilla-europe.org/js/util.js
GET http://www.mozilla-europe.org/js/util.js --> 200 OK
Cache-Control: max-age=300       
Connection: Keep-Alive
Date: Thu, 26 Jun 2008 16:27:56 GMT
Via: NS-CACHE-6.0:   4
Accept-Ranges: bytes
ETag: "b33"
Server: Apache/2.2.3 (Red Hat)
Content-Encoding: gzip
Content-Length: 1241
Content-Type: application/x-javascript
Expires: Thu, 26 Jun 2008 16:32:56 GMT
Last-Modified: Tue, 17 Jun 2008 18:00:39 GMT
Client-Date: Thu, 26 Jun 2008 16:31:26 GMT
Client-Peer: 63.245.209.63:80
Client-Response-Num: 1
Keep-Alive: timeout=300, max=1000

mrz@boris [~/] 4> GET -desS  http://www.mozilla-europe.org/js/util.js
GET http://www.mozilla-europe.org/js/util.js --> 200 OK
Cache-Control: max-age=300
Connection: Keep-Alive
Date: Thu, 26 Jun 2008 16:31:32 GMT
Accept-Ranges: bytes
ETag: "b33"
Server: Apache/2.2.3 (Red Hat)
Content-Length: 2867
Content-Type: application/x-javascript
Expires: Thu, 26 Jun 2008 16:36:32 GMT
Last-Modified: Tue, 17 Jun 2008 18:00:36 GMT
Client-Date: Thu, 26 Jun 2008 16:31:32 GMT
Client-Peer: 63.245.209.63:80
Client-Response-Num: 1
Keep-Alive: timeout=300, max=989
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
http://web-sniffer.net/?url=https%3A%2F%2Faddons.mozilla.org%2F%2Fcss%2Ftype.css&submit=Submit&http=1.1&gzip=yes&type=GET&uak=0:

Connect to 63.245.213.31 on port 443 ... ok

GET //css/type.css HTTP/1.1[CRLF]
Host: addons.mozilla.org[CRLF]
Connection: close[CRLF]
User-Agent: Web-sniffer/1.0.27 (+http://web-sniffer.net/)[CRLF]
Accept-Encoding: gzip[CRLF]
Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7[CRLF]
Cache-Control: no[CRLF]
Accept-Language: de,en;q=0.7,en-us;q=0.3[CRLF]
Referer: http://web-sniffer.net/[CRLF]
[CRLF]

http://web-sniffer.net/?url=http%3A%2F%2Fwww.mozilla.com%2Fincludes%2Fyui%2F2.5.1%2Fcontainer%2Fcontainer_core-min.js&submit=Submit&http=1.1&gzip=yes&type=GET&uak=0:

Connect to 63.245.213.11 on port 80 ... ok

GET /includes/yui/2.5.1/container/container_core-min.js HTTP/1.1[CRLF]
Host: www.mozilla.com[CRLF]
Connection: close[CRLF]
User-Agent: Web-sniffer/1.0.27 (+http://web-sniffer.net/)[CRLF]
Accept-Encoding: gzip[CRLF]
Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7[CRLF]
Cache-Control: no[CRLF]
Accept-Language: de,en;q=0.7,en-us;q=0.3[CRLF]
Referer: http://web-sniffer.net/[CRLF]
[CRLF]

http://web-sniffer.net/?url=http%3A%2F%2Fwww.mozilla-europe.org%2Fjs%2Futil.js&submit=Submit&http=1.1&gzip=yes&type=GET&uak=0:

Connect to 63.245.213.33 on port 80 ... ok

GET /js/util.js HTTP/1.1[CRLF]
Host: www.mozilla-europe.org[CRLF]
Connection: close[CRLF]
User-Agent: Web-sniffer/1.0.27 (+http://web-sniffer.net/)[CRLF]
Accept-Encoding: gzip[CRLF]
Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7[CRLF]
Cache-Control: no[CRLF]
Accept-Language: de,en;q=0.7,en-us;q=0.3[CRLF]
Referer: http://web-sniffer.net/[CRLF]
[CRLF]

(Random sample).

Verified FIXED
Status: RESOLVED → VERIFIED
Component: www.mozilla.org/firefox → www.mozilla.org
Product: Websites → Websites
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
You need to log in before you can comment on or make changes to this bug.