Most recent posts

Book Review: Designing Data-Intensive Applications, 2nd Edition by Martin Kleppmann and Chris Riccomini

Overview

DDIA is aimed at experienced programmers who want to make informed choices regarding performance, scalability and integrity of data persistence at scale, or are wanting to more effectively use their existing stacks. I recommend the book for those audiences.

The book is long and information dense (which I appreciate) but is more of a survey. The reader will not be an expert in any one tool by the end, but you will cover the fundamental concepts, concerns and limitations to set your expectations of what the persistence layer is providing vs what the application software remains responsible for.

As someone who has been using relational databases for decades, writing SQL queries and diagnosing and improving query performance, I still learned things from the sections applicable to RDBMS, such as around isolation levels. Sprinkled throughout the book are mentions of which products employ certain strategies, but the book is focused on identifying the tradeoffs and intended usage, and does not promote one product or type of solution over the others. Every chapter has copious footnotes for any topic you want to dig deeper in to.

One footnote link on database performance for developers: https://use-the-index-luke.com/sql/preface

Impressions

If your needs don’t require scaling out your persistence layer, keep it simple. (Just use Postgres). Measure, don’t assume where your bottlenecks are. Scaling read-only copies is straight-forward (as evidenced by cloud managed databases offering this with a button click). After adding multiple writer instances the data layer can no longer be treated as a black box; understanding the capabilities and limitations becomes a concern of the code base. Modularize so that only high volume data is distributed, leaving the lower volume parts of datasets simpler.

Application software often considers it acceptable to abort or rebuild in the face of unexpected faults. Reliable data storage systems, on the other hand, must pay close attention to unlikely edge and error conditions such as concurrent calls with transactions that roll back, or reaching consensus in the face of network glitches, server crashes, and misaligned clocks. A one in a million occurrence is no longer infrequent running at high scale. (Jepsen tests distributed system vendors against their safety claims).

By the end of the book we come full circle comparing similarities between responsibilities of databases vs distributing data across federated systems. Indices start to look similar to derived data conveyed via asynchronous event logs with idempotent writes.

While federation addresses read-only querying across several systems, it does not have a good answer to synchronizing writes across those systems. We said that within a single database, creating a consistent index is a built-in feature. When we compose several storage systems, we similarly need to ensure that all data changes end up in all the right places, even in the face of faults. Making it easier to reliably plug together storage systems (e.g., through CDC and event logs) is like unbundling a database’s index maintenance features in a way that can synchronize writes across disparate technologies

When copies of the same data need to be maintained in several storage systems in order to satisfy multiple access patterns, you need to be very clear about the inputs and outputs. Where is data written first, and which representations are derived from which sources?

If it is possible for you to funnel all user input through a single system that decides on an ordering for all writes, it becomes much easier to derive other representations of the data by processing the writes in the same order. This is an application of the state machine replication approach that we saw in ā€œConsensus in Practiceā€. Whether you use CDC or an event sourcing log is less important than the principle of deciding on a total order.

In principle, derived data systems could be maintained synchronously, just as a relational database updates secondary indexes synchronously within the same transaction as writes to the table being indexed. However, asynchrony is what makes systems based on event logs robust. It allows a fault in one part of the system to be contained locally, whereas distributed transactions abort if any one participant fails, so they tend to amplify failures by spreading them to the rest of the system.

I also appreciated the inclusion of the last chapter, Doing the Right Thing, on ethical concerns with data, which our industry often gives little consideration to.

most users have little knowledge of what data they are feeding into our databases or how it is retained and processed—and most privacy policies do more to obscure than to illuminate. Without understanding what happens to their data, users cannot give meaningful consent. Often, data from one user also says things about other people who are not users of the service and who have not agreed to any terms. The derived datasets that we discussed in the last few chapters—in which data from the entire user base may have been combined with behavioral tracking and external data sources—are precisely the kinds of data that users cannot meaningfully understand.

Moreover, data is extracted from users through a one-way process, not a relationship with true reciprocity or a fair value exchange. There is no dialogue, no option for users to negotiate how much data they provide and what service they receive in return. The relationship between the service and the user is asymmetric and one-sided; the terms are set by the service, not by the user

Git Quick Reference

2/1/2026 (updated: 11/6/2026)

Orientation

A git repository is initialized in a directory (the repository root) and records snapshots of the files you choose to track under that directory.

Each commit stores a snapshot of the tracked files as staged, plus metadata including timestamp, message, and the hash(es) of its parent commit(s). Usually a commit has a single parent, but the first commit has none, and a merge commit has two or more. Commits linked by parents form a directed acyclic graph (DAG) of history.

A commit is identified by a hash of all of that content. Since the hash covers the parent hashes, it includes not just the commit’s data but also its position in the graph. Commits are therefore immutable: amending, rebasing, or cherry-picking creates new commits with new hashes.

It is generally safe to make history-changing graph modifications; the original commits remain in the reflog until garbage collected. However, since rewriting an old commit means rewriting all its descendants, pushing revised history to others requires them to reconcile diverged paths.

Referring to commits

HEAD is the current commit. git show HEAD

HEAD^ is the (first) parent commit of HEAD. The first parent of a merge commit is the branch you were on when you merged. main^2 is the second parent of a merge commit (what was brought into main).

main..newbranch: All commits reachable from newbranch, excluding those that are reachable from main. Same as newbranch ^main

main...newbranch: All commits that are in only one of the two branches, not both

More at https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection

Compare

List the commits that are in origin/release-candidate but not in origin/main:

git log --graph --pretty=oneline --abbrev-commit origin/release-candidate ^origin/main

List the filenames that have changed in the commits in myfeature branch excluding the commits in main:

git diff --name-status main..myfeature

Modify the local graph

Rebase is covered wonderfully by https://womanonrails.com/git-rebase-onto

git rebase --onto newParent commitToLeaveBehind

Sync

Update a local branch to match the origin version (like pull) but without having that branch currently checked out: git fetch origin main:main

Push tag to the origin: git push origin release-1.2.3

Delete tag on the origin: git push --delete origin mytagname (Delete local tag: git tag -d mytagname)

Configure

Git configuration comes from:

  • system-wide /etc/gitconfig (Linux) set with git config --system
  • per-user at ~/.gitconfig or ~/.config/git/config set with git config --global
  • repository-specific at .git/config

List combined git configuration and its source: git config --list --show-origin --show-scope

Line endings, bane of repos that touch multiple platforms

core.autocrlf

  • input : convert CRLF to LF on commit but not the other way around (leave changed on check-out)
  • true : for Windows git users, converts LF endings into CRLF on check-out
  • false : for single platform Windows-only projects, make no adjustments to line-endings

.gitattributes checked into the root of the repo takes precedence over core.autocrlf. Contains space delimited:

  • file name pattern, e.g. *, *.sh, *.png
  • line ending configuration, e.g. text eol=lf (all users checkout as LF), binary (do not touch)

Identities for syncing with remote

For the current repository, use the specified key to authenticate to the remote: git config core.sshCommand "ssh -i /path/to/specific_private_key -o IdentitiesOnly=yes"

Find which user on the remote is associated with the given key: ssh -T -ai ~/.ssh/id_rsa git@github.com

PostgreSQL AWS RDS Outbound DNS

Situation

In an AWS RDS PostgreSQL database with a foreign server, access from PG to the foreign server broke after changing the target database (also hosted by RDS in the same VPC) from private to public. The AWS-provided DNS name should still resolve to its private IP address for servers inside the same VPC in order to make use of security groups, and avoid traffic looping out and back into the VPC.

Diagnosis

The foreign server’s DNS name used in the PG foreign server configuration (the default one defined by AWS) did not change. Other servers (EC2) in the same VPC were able to access the target database using the original DNS name successfully, resolving to the private IP address.

Reverting the target RDS database to private restored access via the foreign server.

Creating a CNAME record in Route 53 pointing at the DNS name of the target server did not resolve the issue.

Defining a foreign server pointing at the private IP address instead of using the DNS name of the target server worked, but I did not want to hard code the IP address in our configuration.

Solution

I was able to use the original AWS DNS name in the foreign server configuration after I set the custom DB parameter group variable rds.custom_dns_resolution to 1, and restarted the database instance. The ā€œcustomā€ DNS server is defined by the VPC’s DHCP options set, which I left at the default ā€œAmazonProvidedDNSā€.

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.CustomDNS.html

All blog posts