CSS browser caching
Posted: Tue Dec 07, 2004 4:36 am
Is anyone working on a means by which CSS may be called seperately rather than included in every webpage? I ask this because it adds a lot of size to each file that is transfered, and in some cases can be more than 50% of each page hit. If the CSS is loaded seperately the first hit would be somewhat slower but after that subsequent hits would be much faster, and for busy sites the network usage lower.
Most modern browsers are set to cache information they receive, and issue a command to check the date of the content to see if its been modified since they last obtained a copy. Should the individual style sheets be done in this way it could result in a slightly lower network cost for each page served.
The information is already in the DB, this is just a different means of pulling it out.
on a cache hit (ie its already cached)
DB is accessed to check the timestamp of the CSS page - cpu cost
Network usage is lower since style sheet isnt transmitted
pages should render slightly faster, giving the user a better experience
on a cache miss
very little difference between what is currently done and current solution
slight CPU cost due to additional thread/process to serve the CSS page
very slight network overhead (GET request, TCP handshake) added
It has been my experience that CPU is cheaper than network, as such this may be a handy thing to do. Can anyone else see a problem wtih this?
Most modern browsers are set to cache information they receive, and issue a command to check the date of the content to see if its been modified since they last obtained a copy. Should the individual style sheets be done in this way it could result in a slightly lower network cost for each page served.
The information is already in the DB, this is just a different means of pulling it out.
on a cache hit (ie its already cached)
DB is accessed to check the timestamp of the CSS page - cpu cost
Network usage is lower since style sheet isnt transmitted
pages should render slightly faster, giving the user a better experience
on a cache miss
very little difference between what is currently done and current solution
slight CPU cost due to additional thread/process to serve the CSS page
very slight network overhead (GET request, TCP handshake) added
It has been my experience that CPU is cheaper than network, as such this may be a handy thing to do. Can anyone else see a problem wtih this?