[development] FYI more drupal.css stuff

Allie Micka allie at pajunas.com
Sun Nov 13 15:51:47 UTC 2005

On Nov 13, 2005, at 9:20 AM, Ber Kessels wrote:
> I dont have any, unfortunately. I only use webalizer in various  
> different configurations. Just some common sense brought me the  
> conclusion that it is my 5th biggest BW eater. Reason is:
> * it is available on most sites. (logo.png is different on every  
> site, though the combined logos eat much more bw. pngcrush already  
> helped reducing BW a lot!)
> * it is called on every page. While the BW for serving content of  
> every page differs per page.
> * some my themes are so lightweight, that drupal.css is larger then  
> the HTML+style.css *together*.

That's anecdotal information, not the hard numbers required to make  
an informed decision.  As someone attempted to point out, browsers  
cache css files and will only request them once per visit.  You will  
see in your web logs that some drupal.css requests return a 200  
status and the entire file, and some return a 304 "not modified"  
status and 0 bytes (plus HTTP headers)

The common sense way to determine a file's usage is to grep it out of  
your web logs.  To get a list of the number of times it has requested  

     grep drupal.css your_log_file | wc -l

In my case that was 298 hits out of 3565  ( cat your_log_file | wc -l)

To get a list of the number of times it's actually been *downloaded*:
    grep drupal.css your_log_file | grep 'HTTP/1.1" 200' | wc -l

In my case that was 119.  So, in 3565 hits (~150MB according to my  
stats), drupal.css has been requested 298 times and downloaded 119  
times, using roughly 1MB of traffic (9315b * 119)

I agree that a 9k css file borders on unreasonable, and I'm sure your  
mileage varies (more than 1% but less than 24%).  Here are two non- 
drupal solutions you can effect:

1) Install mod_gzip (apache 1.3) or mod_deflate (2.0) to gzip your  
content.  You will save 30-70% on any text file it is configured to  

2) If you can't access your server's configuration and care more  
about bandwidth than cpu, have php handle .css files and use its gzip  
output handler.

Allie Micka
pajunas interactive, inc.

scalable web hosting and open source strategies

More information about the development mailing list