NetTalk Central

Author Topic: Pre-Compressing Static Files  (Read 14116 times)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Pre-Compressing Static Files
« on: August 27, 2007, 12:35:31 AM »
One of the NetTalk web server's features is the (optional) ability to serve pre-compressed static files. In other words if the browser asks for a.htm, and a.htm.gz exists, then a.htm.gz will be sent to the browser (if the browser supports compressed files.)

.gz files are not parsed by the server (ie they are not searched for <!-- Net: tags) so this technique is limited to Static files.

CSS and JS files are clear beneficiaries of this approach, graphic files (PNG & JPG) are not as they are already compressed.
Static HTM files (ie ones without NetTalk tags) are also good candidates for this approach.

To create a .gz file you will need the gzip command line tool from http://www.gzip.org/.

Run the gzip utility using the -9 -n -f -c switches. For example
gzip -9 -n -f -c web\scripts\prototype.js   > "web\scripts\prototype.js.gz"

The .gz file should be in the same folder as the actual file (wherever that is.)

Cheers
Bruce

mriffey

  • Newbie
  • *
  • Posts: 43
    • View Profile
    • Email
Re: Pre-Compressing Static Files
« Reply #1 on: December 15, 2007, 11:28:53 AM »
Bruce,

Doing some perf testing for BobP, we gzipped all the .htm files. You noted in this post that the files referenced by <!...Net: tags would not be parsed.

HOWEVER, while they arent parsed, they are LOADED.

I tried this locally and got a bunch of garbage on the screens where the .htm.gz files are.

Screenshot is attached.

Mark

[attachment deleted by admin]