First movie of the new year. It wasn’t as bad as I expected it to be.
CSS/JS Automated Packing and Serving
Compressing CSS and Javascript is something myYearbook does regularly — but manually — before we put code into our production environment. Our main purposes for compressing CSS and Javascript are to decrease bandwidth requirements for content delivery and to decrease page load times for our users, both of which improve the overall user experience.
We can further decrease the CDN bandwidth requirements and page load times (while keeping developers sane) by creating a system that rolls CSS and Javascript calls into two single requests. This could look something like the following.
- assets.mysite.com/css?f=site,Application
- assets.mysite.com/js?f=site,Application
The advantage of the single call for each is the decrease in the number of connections opened to the HTTP daemon providing those files (the CDN). By default, most (if not all) browsers restrict concurrent HTTP connections to a server (IE7: 4, Fx: 8) to help avoid congestion and overwhelming of the server. With other assets (like images) taking up HTTP requests, overall page load times can become higher and higher as we wait for HTTP connections to free up.
This raises the question, how do we do cachebusting for new files? Sure, it seems simple, we can append a cachebuster value to the end of the filename, which gives us something like the following.
- assets.mysite.com/css?f=site,Application&cb=1
- assets.mysite.com/js?f=site,Application&cb=1
This introduces a new problem. Now, whenever we promote a single asset change, it busts the cache of every single css and javascript file on the site. What do we do to avoid this? It’s simple, we’ll bust the cache of individual files by specifying a cachebuster for each file.
- assets.mysite.com/css?f=site:123,Application:48&cb=1
- assets.mysite.com/js?f=site:89,Application:47&cb=1
That’s it. We’re done. We’ve implemented a system that reduces the number of tasks for the developer (packing and merging of CSS/Javascript) and also improves the overall user experience.
Enjoy.
myYearbook TV
A recent favorite of mine, TV has been my source for House, The Office, Fringe, and Life. I enjoy all of these shows but don’t have the time to enjoy them when they air. So, on the weekends, I usually catch up to the most recent episodes.
Themes on Home After Login
I’m enjoying one of our new features at myYearbook, Home After Login (HAL) Themes.
HAL Themes provides the user with the option to choose from one of (currently) 22 themes for their home page.
