Words and Pictures - August

Words and Pictures for August? It’s November!

I know. I’ve been doing other things, yet these articles were too good not to share.


  • Have You Heard The One About President Joe Biden? - Jeanne Marie Laskas (GQ). Joe Biden sounds like a politician who isn’t a Politician. Great writing - it made me feel like I was travelling with him.
  • Arabic: A Language With Too Many Armies And Navies - The Economist. An introduction to Arabic dialects. Technical enough to be interesting yet accessible to monoglots or infant polyglots like me.
  • In Praise Of Laziness - Schumpeter (The Economist). Knowledge workers need physical and mental space for creativity.
  • Forced Exposure - Groklaw. I read this as the seriousness of the Edward Snowden leaks was becoming clear. It’s still terrible and I hope we, particularly the technical community along with political activism, can make move the balance back towards privacy.
  • The Powerball Jackpot Is \$425m. Should You Play? - James Harvey (Medium). Don’t let a little bit of maths dissuade you - this is a great read.


  • Stargate SG1, Season 7. Fighting the Goa’uld System Lords without ever taking themselves seriously. I love this show.

NSW Fires

The Rural Fire Service are amazing. We’ve had temperatures in the mid-30 degrees Celsius, winds gusting up to 100km/h and humidity below 20% and they’ve worked incredibly hard to protect people and properties. Thank you. Please support them or consider joining up.

Smoke from the Linksview fire

Smoke from the Linksview fire

Wordspeak site performance improvements

Improving the performance of this site has been a fun journey. I don’t think the principles of optimisation change much from domain to domain so the challenge is learning how to apply those principles to a new domain (and learning which ones are going to have the most impact). So these improvements aren’t novel, but the process of discovering and implementing them was enjoyable. With no loss of functionality, I was able to significantly improve page load time for all visitors to the site and make additional improvements for those that read the site from Eastern Australia.

The optimisations below were made over the space of about 6 months the improvements to page load time aren’t quantified. I did look at waterfall graphs and get feedback from WebPagetest but I wanted to have fun with optimisation instead of baselining and measuring at each stage:

Minimise geographical distances

Host locally

Everything feels faster when it’s closer. When I was in California recently, everything felt fast and the main difference was that the services were physically close. Connections to my web server changed from being a 190ms pacific ocean round trip to a 30ms hop within the state. DNS lookups in the wordspeak.org domain went from 240ms to 50ms. When I consider that most of my readers are in Australia, it makes sense to host in Australia so that the first connection and any subsequent connections are much faster (its even more significant when the first connection involves a DNS lookup). It also means that ssh sessions are more responsive, particularly over mobile networks where packet loss is higher. The first step was to move my server from Linode in California to AWS in Sydney and the next step is to move DNS from Rackspace, whose closest Anycast node is in Texas, to Amazon Route 53 who have Anycast nodes in Sydney.

Minimise what you need to transfer

Reduce Page Weight and Request Count

Each library that is used on a site will usually involve requesting at least one extra JavaScript or CSS file. It takes time to initiate those requests and it takes time to download the content in those requests. My improvements came from removing unused libraries that my site builder, Nikola, includes by default and then using webassets bundles to concatenate like files so I have a single CSS and a single JavaScript file instead of 12 files. Even though the JavaScript and CSS were already minified, I was further able to reduce the amount of data in the CSS files by removing redundant selectors using mincss.

Content Delivery Networks (CDNs) can reduce page load time under some circumstances, so I experimented with transferring (JQuery and Twitter Bootstrap) from CDNs but I observed better performance by self-hosting. I expect this was for a few reasons:

  1. Obtaining JQuery and Bootstrap from the CDNs added two DNS lookups and three requests to the page load if the CDN files weren’t in cache. The non-CDN setup had these libraries incorporated into the single CSS and JavaScript file that was produced by webassets so these lookups and requests weren’t necessary, even though webassets-generated files were larger.
  2. The Bootstrap CDN didn’t compress content (yes, I double-checked. No, I don’t understand why they wouldn’t!)
  3. mincss meant that I didn’t need to transfer most of the bootstrap CSS file anyway, so my Bootstrap was slimmer than the CDN Bootstrap.

Minimise what you actually transfer

Compress. Compress. Compress

Retrieving compressed content from a web server is very widely supported. Without compression, there was 261KB of data transferred to show the front page of my site, but with compression enabled it dropped to 86KB, 33% of the uncompressed size. I use Nginx as my web server, so it was as simple as having the following snippet in the default http section of the nginx.conf:

gzip  on;
gzip_http_version 1.1;
gzip_types    text/plain text/CSS text/javascript
              application/x-javascript text/xml application/json
              application/xml application/xml+rss;

However, I still found that json files were not being compressed, even though I’d added the application/json MIME type to the gzip_types directive. I resolved this by declaring an application/json MIME type, associated with the json file type in the Nginx mime.types file.

types {
  text/html                             html htm shtml;
  application/x-javascript              JavaScript;
  application/json                      json;

Use the fastest source for a resource

Or: don’t request what you already have

Caches provide faster access to a frequently used resource - the principle is the same whether it’s someone putting a favourite app on the front screen of their smartphone, a CPU retrieving from L3 cache instead of main memory, or placing the salt at the front of the spice shelf for easy retrieval (and relegating fenugreek to the back). In most cases, the hard work is specifying a cache policy so that the cache contains a valid copy of the most valuable resources. To help the client cache appropriately, I configured Nginx to tell the browser how long a cached item should be considered valid. Images shouldn’t change once I put them on the site, and all but the top level content (index.html and archive.html) shouldn’t change once they’ve been put up so this is policy works well for me.

location ~* \.(jpg|jpeg|gif|png|ico) {
    root   /home/esteele/Sites/www.wordspeak.org;
    expires 365d;

location ~* \.(html|json|js|css) {
    root   /home/esteele/Sites/www.wordspeak.org;
    expires 7d;

location = (index.html|archive.html) {
    root   /home/esteele/Sites/www.wordspeak.org;
    expires 1h;

And in conclusion

Optimisation isn’t just about getting more done with less; it’s also about completing the same work more quickly with existing resources. Try applying these principles to something that you control - it’ll make you really awesome, people will like you more, and it’ll probably make you rich and stuff.

Creative outlets

This blog often reads like a diary, so one might ask why I bother to publish it at all. It’s not like I’m famous, have a track record of writing interesting articles, or breaking news, so why do I do it?

Writing is a creative outlet

I think everyone benefits from having creative outlets. Some people play a musical instrument or sing, some paint and some build big Lego models. 1 I like to write and I think writing concise, clear, elegant statements is a noble, valuable and satisfying pursuit. I spend many hours each week writing email yet I rarely have the luxury of crafting and polishing, so I choose to write and re-write the few words that appear here - it gives me a chance to perfect the text. The degree of polish given to the words is completely disproportionate to the number of readers or the topic, but hobbies are rarely rational undertakings, are they?

As long as it’s satisfying and I have a little spare time, I’ll keep writing, and if I have extra time, I’ll even write a little less.

If I had more time, I would have written a shorter letter.” - Cicero

An interesting technical workflow

The process of publishing is often as enjoyable as the creation of the material. The process of creating and serving this page is technical enough to provide space for tinkering and streamlining, but simple enough that returning to a working (manual) process is always an option if there’s a real need to publish. I think I’ve spent more time playing with the process than actually writing articles - the source code to the publishing engine, Nikola, is easy to understand and modify and maintaining my own host and deployment workflow has introduced me to several great tools and platforms.

Publishing this blog gives me an excuse to write and experiment with software; it gives me a small but well defined project where I’m in control of the scope and get to do all the fun bits. My most engaging software projects generally begin out my own need, yet because I’m the client I can stop when I want. As someone who enjoys starting projects more than finishing them, this helps keep it a fun activity.

Real-world optimisation

I find the quest for efficiency to be very satisfying. Efficiency might mean running a site on one host instead of two without a degradation of performance, reducing the build time of a product from 30 to 23 seconds or reducing the time to render a web page from 800ms to 600ms. I find something to optimise whenever I look about, yet I don’t optimise because I have a problem with scalability, I do it because I like the discipline of optimising.

Optimisation activities expose me to tools, platforms and techniques just like my workflow improvements - I love to learn why placing particular elements at the top of a page allows the page to render more quickly, or how moving my site closer to my location improves responsiveness over cellular connections during my daily commute, and I think it’s very cool that I can reliably rebuild my hosting and publishing environment on a new server within a few minutes. A site gives me avenues for optimisation, and I think that’s great.

So while many would be disappointed to spend time writing without the knowledge that people are reading, you can probably see why having readers isn’t the driving force for this little site.

… that said, it’s really cool that you’re reading it!

  1. I’m happy to accept gifts 

Words and Pictures - June and July

A poorly scoped upgrade to my hosting left me without an easy way to publish until I rebuilt the entire world… entirely… and stuff. More on that later. In the meantime here’s my favourite reading from the last two months.