HTTP Caching and Cache-busting

oscon-logo.gif I have been invited to speak about HTTP caching and cache-busting at the O’Reilly Open Source Convention in July 2004.

Abstract of my talk:

A user’s web experience can often be improved by the proper use of HTTP caches. This talk discusses when to use and when to avoid caching, how to employ cache-busting techniques most effectively, and how to diagnose problems with caches.

In particular, this talk will cover:

  1. Overview of HTTP caches
    • Shared caches vs. private caches

    • Proxy caches and HTTP server accelerators
  2. How to encourage caching for static content
    • Reduction of network bandwidth usage

    • Improved browsing and page-rendering speed by avoiding network round-trips
  3. How to discourage caching for personalized or frequently-changing content
  4. How to disable caching for sensitive content
    • Cache-busting for accurate hit-metering and advertising statistics
    • Cache-busting for sensitive information (e.g. personal financial data)
  5. “Expires” vs. “Cache-Control” and other HTTP headers
  6. The best of all worlds: unique URL tagging techniques that defeat proxy caches but work gracefully with browser caches
  7. Sending HTTP headers
    • Apache’s mod_headers and mod_expires modules
    • PHP’s header() and mod_perl’s $r->header_out() functions
    • Using HTML <meta> tags
  8. Debugging HTTP caching problems
    • Using the Web Developer and Live HTTP Headers extensions for Mozilla
    • Diagnosing MSIE with Ethereal
    • Text-based debugging
    • Rolling your own HTTP proxy

Hope to see you there.

An ode to TastyBite Indian Food

TastyBite Kashmir Spinach A couple of weeks ago UPS dropped off a 30 lb. box of Indian food from TastyBite. Every box has been absolutely delicious.

My personal favorites are the Kashmir Spinach, Madras Lentils, and the recently discontinued Curried Mashed Potatoes. They’re about $3 a box in the local supermarkets, but you can get them for as low as $2.09 a box when you buy them by the 6-pack online. And they do free shipping on orders of $50 or more. Twenty-four meals for fifty bucks is a pretty good bargain.

Most importantly, all of TastyBite’s vegetarian Indian foods are 100% Kosher. We’re hoping that someday they’ll also get rabbinic supervision for their vegetarian Thai products, too.

I’m not a big fan of the Malabar Mixed Vegetables. We bought a dozen of those because they were on sale for $1.25 apiece, but we haven’t enjoyed those as much as the more mainstream dishes. They’re a little too rich and creamy for my taste.

It’s a shame that TastyBite is no longer selling their Curried Mashed Potatoes dish. Those were absolutely fantastic. Fortunately, there are no shortage of recipes for Pav Bhaji available on the Net.

The Caffeine Advantage

The Caffeine Advantage: How to Sharpen Your Mind, Improve Your Physical Performance, and Achieve Your Goals--the Healthy Way Last night I finished reading The Caffeine Advantage, a book claims that caffeine is actually good for you: “The Caffeine Advantage offers step-by-step programs that show you how caffeine can improve your IQ, memory, mood, athletic ability, physical condition, and performance at work.”

One of the most bold claims is that caffeine can make you smarter. In chapter 4 the authors state that taking a small to medium dosage of caffeine (i.e. 50 – 150 mg) before taking an IQ test will likely improve your score. Since IQ is the generally accepted measure of how smart one is, caffeine makes one smarter. I’d like to get my hands on a copy of the book that mentions that study (Caffeine and Behavior). Looks like the UCLA Biomed library has a copy, so perhaps I’ll ask Ariella to check it out for me.

The book also states that if you consuming too much caffeine can actually have an inverse affect on performance. For many people, having more than 600 mg of caffeine a day can make the drug less effective.

I’m a big fan of espresso (especially Illy, which is almost never bitter) but I occasionally drink drip coffee as well. I learned several years ago from the Caffeine FAQ that a shot of espresso has less caffeine than a cup of coffee (~100 mg vs. ~150 mg), so I figure that my morning double-shot is about equivalent to a 12 oz. cup of regular coffee. What I didn’t realize how little the average 6 oz. cup of green tea has: only 15 mg! Given the rough guideline of consuming < 600 mg a day, I guess I can drink as much green tea as I’d like.

This book is a refreshing perspective compared to the anti-caffeine rhetoric prevalent in the health community. It’s unfortunate that the authors don’t have more impressive credentials. I’d love to believe everything in the book, but I know full well that it’s written by a couple of quacks.

Would you believe an ID phishing scam like this?

I just got an identity theft lure via e-mail today:

Dear_ Citibank Cardholders,

This EMAIL was se-nt by-the Citibank server to

veerify your_ _EMAIL address_.

You must cptleome this pcseors by clicking on_the_link

beloww and enntering in the litlle window_ your CITI_bank

Atm_ card number and _PIN that _you use on_the Atm machine.

That is done for-your poterction -w- becouse some_of our

memebrs no lgoenr have acecss to their email adesedsrs

and we must verify it.

http://www.citicards.com:%7a%78%74%5a%4c%5a@%61%67%71%71%71945%64%2e%64%61%2e%52%75/%3f0%43%4c%41%4c%56

To veerify your _e-mail_ addres and accees your CITI_bank

account, click on_the link _bellow_.

tuyzlpqUo

Of course it looks completely fake (what bank would send out official email like this with so many misspellings?) yet American consumers lost $5 billion last year to ID theft [Public Enemy No. 1: Identity Theft, Wired 12.02, pp. 44-45].

There may be some good news. The latest IE 6 patch released by Microsoft this week disables the http(s)://username:password@server/resource.ext syntax in URLs. They shoulda done that years ago.

SBL Hebrew Font

The Society of Biblical Literature has made available a beta version of their SBL Hebrew Font. It’s a very clean, versatile Unicode font:

bereshit-sbl.gif

It’s distributed in OpenType TTF format, designed primarily for Win2000 and later, but you can also use it on MacOS X. However, since MacOS X (even version 10.3) does not yet support complex script (i.e. Hebrew) rendering as well as Windows does, your mileage may vary.

My Yahoo! RSS

After 2-3 years of stagnation, My Yahoo! has finally done something interesting. They have added a hosted RSS aggregator feature to the site.

For the time being, I’ll still probably stick to using like Radio Userland better, because it organizes articles by date (regardless of source) and My Yahoo! is very source-centric. However, I’m hopeful that My Yahoo! will improve over time, including the ability to show full content of RSS feeds with inline images.

Add this blog to My Yahoo!

Current Reading List

Fast Food Nation: The Dark Side of the All-American Meal I’ve been in more of a reading mood than a writing one recently.

Just finished reading

In the middle of reading

Just starting to read

Hope to get around to reading

Amazon is finally making a profit on me.

Threads considered harmful

In the past month I’ve seen at least 3 messages on the development email lists at work asking questions about developing multi-threaded applications. From a software engineering standpoint, this troubles me.

I’ve always thought that multi-threaded apps in C/C++ are simply too difficult for most engineers to understand. There’s too much non-determinism, too many race conditions, and too few language-level constructs to keep yourself from screwing up.

This isn’t to say that some engineers can’t figure it out, it’s just that most engineers can’t. I’ll borrow a diagram from Ousterhout to illustrate this point:

What's Wrong With Threads?

John Ousterhout, Why Threads Are a Bad Idea (for most purposes), 1996. PDF slides from USENIX 1996 talk (local mirror).

I’ve been reading The Art of UNIX Programming by Eric Raymond over the past few weeks and it appears that he agrees with me. He avoids the Dijkstra-esque pun on threads being harmful and instead perfers the equally-provoking title Threads — Threat or Menace?

My attitude about threads Java is different because the language has supported the concept of threads since day one. It’s still tricky to do threads correctly in Java, but not as painful as it is in C++.