Tags: database

13

sparkline

Saturday, August 10th, 2019

Server Timing

Harry wrote a really good article all about the performance measurement Time To First Byte. Time To First Byte: What It Is and Why It Matters:

While a good TTFB doesn’t necessarily mean you will have a fast website, a bad TTFB almost certainly guarantees a slow one.

Time To First Byte has been the chink in my armour over at thesession.org, especially on the home page. Every time I ran Lighthouse, or some other performance testing tool, I’d get a high score …with some points deducted for taking too long to get that first byte from the server.

Harry’s proposed solution is to set up some Server Timing headers:

With a little bit of extra work spent implementing the Server Timing API, we can begin to measure and surface intricate timings to the front-end, allowing web developers to identify and debug potential bottlenecks previously obscured from view.

I rememberd that Drew wrote an excellent article on Smashing Magazine last year called Measuring Performance With Server Timing:

The job of Server Timing is not to help you actually time activity on your server. You’ll need to do the timing yourself using whatever toolset your backend platform makes available to you. Rather, the purpose of Server Timing is to specify how those measurements can be communicated to the browser.

He even provides some PHP code, which I was able to take wholesale and drop into the codebase for thesession.org. Then I was able to put start/stop points in my code for measuring how long some operations were taking. Then I could output the results of these measurements into Server Timing headers that I could inspect in the “Network” tab of a browser’s dev tools (Chrome is particularly good for displaying Server Timing, so I used that while I was conducting this experiment).

I started with overall database requests. Sure enough, that was where most of the time in time-to-first-byte was being spent.

Then I got more granular. I put start/stop points around specific database calls. By doing this, I was able to zero in on which operations were particularly costly. Once I had done that, I had to figure out how to make the database calls go faster.

Spoiler: I did it by adding an extra index on one particular table. It’s almost always indexes, in my experience, that make the biggest difference to database performance.

I don’t know why it took me so long to get around to messing with Server Timing headers. It has paid off in spades. I wish I had done it sooner.

And now thesession.org is positively zipping along!

Tuesday, July 10th, 2018

Ways to think about machine learning — Benedict Evans

This strikes me as a sensible way of thinking about machine learning: it’s like when we got relational databases—suddenly we could do more, quicker, and easier …but it doesn’t require us to treat the technology like it’s magic.

An important parallel here is that though relational databases had economy of scale effects, there were limited network or ‘winner takes all’ effects. The database being used by company A doesn’t get better if company B buys the same database software from the same vendor: Safeway’s database doesn’t get better if Caterpillar buys the same one. Much the same actually applies to machine learning: machine learning is all about data, but data is highly specific to particular applications. More handwriting data will make a handwriting recognizer better, and more gas turbine data will make a system that predicts failures in gas turbines better, but the one doesn’t help with the other. Data isn’t fungible.

Tuesday, February 27th, 2018

Let’s talk about usernames

This post goes into specifics on Django, but the broader points apply no matter what your tech stack. I’m relieved to find out that The Session is using the tripartite identity pattern (although Huffduffer, alas, isn’t):

What we really want in terms of identifying users is some combination of:

  1. System-level identifier, suitable for use as a target of foreign keys in our database
  2. Login identifier, suitable for use in performing a credential check
  3. Public identity, suitable for displaying to other users

Many systems ask the username to fulfill all three of these roles, which is probably wrong.

Wednesday, April 19th, 2017

Approximate Text Search Made Easy

A step-by-step explanation by Henrik on how he implemented fuzzy search on his music site—something I could do on The Session. He even talks about expanding this to work with ABC notation.

Tuesday, June 7th, 2016

PURL: A Portable Content Store - Not Enough Neon

I need to wrap my head around the details of this approach, but it sounds like it might be something I could do here on my site (where I feel nervous about my current dependency on a database).

Thursday, December 3rd, 2015

I Dreamed of a Perfect Database | New Republic

A really nice piece by Paul Ford on the history of databases and the dream of the Semantic Web.

Sometimes I get a little wistful. The vision of a world of connected facts, one big, living library, remains beautiful, and unfulfilled.

One thing though: the scrolling on this page is sooooo janky that I had to switch off JavaScript just to read these words comfortably.

Monday, July 30th, 2012

How to support full Unicode in MySQL databases · Mathias Bynens

Some good database character-encoding advice from Mathias.

Thursday, February 10th, 2011

ID card database destroyed - a set on Flickr

For once, I’m happy to see data being destroyed.

Tuesday, October 27th, 2009

Amazon Relational Database Service (Amazon RDS)

You can now store (and scale) MySQL databases with Amazon. Handy.

Sunday, May 10th, 2009

Wednesday, October 24th, 2007

Surfin’ Safari - Blog Archive » WebKit Does HTML5 Client-side Database Storage

I just learned from Kelly that Webkit is supporting local storage and database queries, as proposed in HTML5. Kinda like Google Gears. Potentially excited for the iPhone/iPod Touch.

Thursday, October 11th, 2007

xkcd - A webcomic of romance, sarcasm, math, and language - By Randall Munroe

Yes, you have to be a bit of a database geek to find this funny but if you are, this is very funny indeed.

Monday, May 7th, 2007

Mysql database migration and special characters | Orthogonal Thought

This article is a life-saver for me. I'm constantly having trouble with special characters when I'm backing up databases for local copies of my sites.