Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Dec 13, 2010 7:03 am 
Offline
Senior Newbie

Joined: Mon Dec 13, 2010 6:59 am
Posts: 8
Hello,

I am new to Linode and enjoying having full control on the slice. Lot to learn nd its fun!!

I was trying to figure out why my gzip compression of JS files does not work.


curl --head http://desidime.com/javascripts/beast.js
HTTP/1.1 200 OK
Server: nginx/0.8.53
Date: Mon, 13 Dec 2010 10:34:27 GMT
Content-Type: application/x-javascript
Content-Length: 181666
Last-Modified: Sun, 12 Dec 2010 23:04:20 GMT
Connection: keep-alive
Vary: Accept-Encoding
Accept-Ranges: bytes


In my /opt/nginx/conf/nginx.conf, I have:


gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 32 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

Can anyone help me with this? I even increased gzip_buffers slot to 32(8k) from 16(8k) since the js file was huge...

Best Regards,

Jimish


Top
   
 Post subject:
PostPosted: Mon Dec 13, 2010 8:10 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
It is working, probably something to do with curl, maybe it doesn't accept gzip encoded data, here's my output from safari

Request URL:http://desidime.com/javascripts/beast.js
Request Method:GET
Status Code:200 OK

Response Headers
Connection:close
Content-Encoding:gzip
Content-Type:application/x-javascript
Date:Mon, 13 Dec 2010 12:07:03 GMT
Last-Modified:Sun, 12 Dec 2010 23:04:20 GMT
Server:nginx/0.8.53
Transfer-Encoding:Identity
Vary:Accept-Encoding

However it's still a 6000 line long file you should consider using a js compressor.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Mon Dec 13, 2010 11:01 am 
Offline
Senior Newbie

Joined: Thu Feb 05, 2009 4:26 pm
Posts: 10
try the "--compressed" option for curl

(or something like " --header 'accept-encoding: gzip'")


Top
   
 Post subject:
PostPosted: Mon Dec 13, 2010 11:25 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
PipeBoost, who sell compression software for IIS, has a nice "compression checker" tool:

http://www.pipeboost.com/GetReport.asp? ... s/beast.js

It's reporting an uncompressed size of 303,618 bytes, and a compressed size of 71,775 bytes. Considering that the gzip modules of most webservers (lighty, at least) have zero overhead on compressed static files due to caching, not a bad improvement :)

Google makes a javascript compiler called Closure that seems to be the most efficient "javascript compressor" available (tests show it beats out YUI and jsmin, at least). In advanced mode, where it gets aggressive with optimizations which may or may not require code changes to use, it reports:

117.56KB (36.99KB gzipped)

In simple mode, which is safer in terms of not requiring code changes, but is less efficient:

162.92KB (43.98KB gzipped)

So, with little effort on your part, Closure gets your javascript down from 70KB to 44KB. With some effort on your part, it can help you get down to 37KB.

Here's the link: http://code.google.com/closure/


Top
   
 Post subject:
PostPosted: Tue Dec 14, 2010 4:18 pm 
Offline
Senior Newbie

Joined: Mon Dec 13, 2010 6:59 am
Posts: 8
thank you guys very much. Yes, I confirmed its compressing correctly.

Yes, I can compress it further as you guys told and its one of the thing on my list. Thanks guspaz for the links.

1 more question: Any specific browsers that might not be able to deal with compressed files?


Top
   
 Post subject:
PostPosted: Tue Dec 14, 2010 4:56 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
jimishjoban wrote:
1 more question: Any specific browsers that might not be able to deal with compressed files?


NCSA Mosaic? Any browser should let the server know if it can handle compressed files or not.


Top
   
 Post subject:
PostPosted: Tue Dec 14, 2010 6:27 pm 
Offline
Senior Member

Joined: Sat May 03, 2008 4:01 pm
Posts: 568
Website: http://www.mattnordhoff.com/
I've heard IE6 gets confused by compressed JavaScript, which is presumably why you have that "gzip_disable" line in your config. Any remotely decent client will either handle compression right or not ask for it in the first place.

_________________
Matt Nordhoff (aka Peng on IRC)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group