Tue

05

Jan

2010

Tuning Minify with X-Sendfile

We'll start our new blog with a nice performance optimization.

 

Jimdo is using "Minify" to merge and compress JS and CSS files for a long time. This results in huge performance gains.

 

UPDATE / DISCLAIMER: We know that the right way is to pre-generate the minfied files and let them being pushed out by the webserver directly. So this is a quick-fix for users that use Minify directly. Adding pre-built minified files to the build process is currently in progress ;) We'll post some follow-up here.

 

While Minify does basically a great job, Boris and me experienced a bottleneck today: Minify does not have any option to make use of modern webservers' feature "X-Sendfile" which is supported by the famous and fast webservers lighttpd and nginx. With X-Sendfile, you can pass the job of delivering a file from the filesystem to the http-user-agent to the kernel (which is known to perform this job best). Ever used readfile? Well, Minify does. And that's bad.

 

Writing the code took about thirty minutes. It's even not necessary to patch minify itself. All we had to do is write our own Minify Cache Backend which extends the 'Minify_Cache_File' class.

read more 4 Comments