Field notes — essays & research notes

Things I've written down.

Ruby, Rails, performance, security and applied machine learning. Updated when something feels finished.

51 posts · page 4 of 6
SECURITY 05 / 06 / 26

Secrets that stay secret

The dangerous part is not storage. It's that a secret in git history is still there after you delete the file — and .gitignore won't save you.

3 min
RUBY & RAILS 05 / 01 / 26

Stop guessing: profiling Ruby properly

Benchmarking a suspicion confirms the suspicion. A sampling profiler tells you where the time actually went.

3 min
RUBY & RAILS 04 / 28 / 26

Retries fell 30% when I stopped retrying the wrong things

A retry is a bet that the failure was temporary. Most retried jobs were losing that bet — and the ones that won were doing their work twice.

5 min
RUBY & RAILS 04 / 22 / 26

Reading a query plan without fear

EXPLAIN output looks impenetrable and answers three questions. Those three cover most of what makes a query slow.

3 min
SECURITY 04 / 15 / 26

Your logs are a database nobody secured

Logs are copied to aggregators, retained for months and read by people who would never be granted access to the production database.

2 min
RUBY & RAILS 04 / 08 / 26

Migrations that don't take the site down

The dangerous migrations aren't the slow ones. They're the ones that take a lock while old and new code are both running.

3 min
RUBY & RAILS 04 / 01 / 26

One statement instead of ten thousand

Saving records in a loop is the slowest correct way to write data. The alternatives are faster and quietly skip things you may be relying on.

2 min
RUBY & RAILS 03 / 25 / 26

Counting on read is a bug you ship on purpose

A count in a loop is the N+1 nobody spots, because each query is fast and the logs look fine.

2 min
SECURITY 03 / 18 / 26

Accepting files from strangers

An upload endpoint accepts arbitrary bytes chosen by someone you don't know. Almost every mistake here comes from trusting what they say it is.

2 min