After much neglect, my poor blog is finally getting some much-needed care.
MathJax, you see, has a rather large footprint. And my blog runs on a decrepit server that is already overtaxed. So, to use MathJax, I first had to put a reasonably tuned cache in front of my blog to offload the byte-slinging duties soon to be imposed.
Enter Varnish, an efficient, highly tunable, caching HTTP proxy. I set it up on a front-end server and told it to cache anything mostly static on the blog’s server:
Basically, that bit of Varnish Configuration Language says that after the proxy fetches a resource from the back-end blog server, if it’s an image, script, feed, or MathJax resource, it should be given some reasonable amount of time to live in the cache. Once in the cache, Varnish will serve it up until its time to live expires, when Varnish will finally ask the old blog server to fetch another copy.
This little change made a big difference in my blog’s responsiveness. It feels much snappier now. (Let me know if you agree.)
Now I can have fun with TeX-markup mathematical formulas on the blog: \[1 + x_1 + x_2 + \cdots\]
The only downside to using a client-side library like MathJax is that it will probably not go so well for readers using Instapaper and e-readers. (If you’re one of them, let me know how it goes for you.)