Skip to content
The Résumé of Ace
中文

Section III

The Stack

Every tool is a finite thing. The boundless was built entirely out of finite things.

An instrument has a shape; what you are reaching for does not. What you can hold is never quite the thing you were after.

A tool is a worldly object, and a bounded one: you can hold it, it wears out, it gets replaced, and not one of them does everything. What is strange is that nothing large has ever been built out of anything else. Databases, compilers, schedulers — each was stacked up by someone out of whatever limited instruments were on the bench at the time.

So choosing was never a matter of finding the best one. It is a matter of deciding which set of limits you are willing to live inside. Every instrument has already made part of the judgement on your behalf: whatever it renders easy, it also renders easy to stop questioning. What matters is not landing on the one that fits the hand, but keeping track of what you signed away — at what price, and for which kind of certainty.

Languages

7 entries

Data

5 entries

Infrastructure

5 entries

Observability

2 entries

Client

7 entries

AI Tools

5 entries

Languages

Go

A compiled language from Google, built around goroutines and a small, stable feature set.

Go compiles to a single static binary and ships with a garbage collector, a scheduler and a standard library that covers HTTP, JSON, testing and profiling. Goroutines are lightweight threads managed by the runtime; channels pass values between them, and the sync package provides mutexes and wait groups.

The language changes slowly and keeps a short list of features. Generics arrived in 1.18; error handling uses explicit return values. gofmt fixes a single formatting style, so code from different authors reads the same way. It is widely used for network services, command-line tools and cloud infrastructure such as Docker and Kubernetes.

Key points

  • The runtime multiplexes goroutines onto OS threads (the GMP model) and hands the processor to another thread when one blocks in a system call
  • The garbage collector is concurrent with sub-millisecond pauses; collection frequency follows the allocation rate, tuned with GOGC and GOMEMLIMIT
  • context.Context carries cancellation and deadlines across goroutines and API boundaries

Languages

Rust

A systems language that checks memory safety at compile time through ownership and borrowing.

Every value in Rust has one owner, and references to it are checked by the borrow checker: any number of shared references, or exactly one mutable reference, at a time. These rules let the compiler rule out use-after-free, double free and data races without a garbage collector.

Rust compiles through LLVM to native code with performance close to C and C++. Cargo handles builds, dependencies, tests and documentation. It is used for command-line tools, browsers, databases, embedded systems, WebAssembly, and parts of the Linux and Windows kernels.

Key points

  • Lifetimes describe how long a reference stays valid; most are inferred, and explicit annotations appear mainly in function signatures and structs
  • Send and Sync mark which types may move or be shared across threads, so data races are compile errors
  • unsafe blocks allow raw pointers and FFI; the surrounding code is expected to uphold the invariants the compiler cannot check

Languages

C

A small, low-level language that maps closely to the machine and underlies most operating systems.

C exposes memory directly through pointers and leaves allocation and lifetime to the programmer via malloc and free. Its compiled output is predictable and close to the hardware, and its calling convention is the common interface other languages use to talk to system libraries.

Unix, Linux, the major databases, language runtimes and most embedded firmware are written in C. The standard defines undefined behaviour for cases such as out-of-bounds access and signed overflow, and optimising compilers rely on those rules when transforming code.

Key points

  • Sanitizers (ASan, UBSan, TSan) and Valgrind detect memory errors and undefined behaviour at run time
  • Allocators such as glibc malloc, jemalloc and tcmalloc use arenas and per-thread caches, which affect fragmentation and memory usage
  • The C ABI is the standard boundary for FFI from Rust, Go, Python and most other languages

Languages

TypeScript

JavaScript with a static type system, compiled away before the code runs.

TypeScript adds type annotations, interfaces, generics and union types to JavaScript. The compiler checks them and emits plain JavaScript; the types do not exist at run time. Its type system is structural: two types are compatible when their shapes match.

It is the default for most large front-end and Node.js codebases, and editors use its language service for completion, navigation and refactoring. Type definitions for untyped libraries are published on DefinitelyTyped under @types/*.

Key points

  • strict mode enables null checks and stricter inference, and is the usual setting for new projects
  • Discriminated unions with a literal kind field let the compiler narrow types inside switch and if branches
  • Data from the network or user input is unchecked at run time; libraries such as zod validate it and derive the static type from the schema

Languages

Python

A dynamically typed, interpreted language used widely for scripting, data work and machine learning.

Python has a large standard library and an ecosystem on PyPI that covers web frameworks, automation, scientific computing and machine learning. NumPy, pandas and PyTorch do their heavy work in compiled C, C++ or CUDA code and expose it through Python APIs.

CPython, the reference interpreter, has a global interpreter lock that lets one thread execute Python bytecode at a time. I/O-bound work scales with threads or asyncio; CPU-bound work uses multiprocessing or native extensions. Python 3.13 added an experimental build without the GIL.

Key points

  • Type hints are checked by tools such as mypy and pyright and are ignored by the interpreter
  • uv and Poetry manage virtual environments and lock files; a lock file makes installs reproducible
  • asyncio runs coroutines on a single-threaded event loop and suits network-heavy services

Languages

Swift

Apple's compiled language for iOS, macOS and the other Apple platforms.

Swift uses optionals to mark values that may be absent, value types (structs and enums) with copy semantics, and automatic reference counting for classes. Protocols with default implementations play the role that inheritance plays in many other languages.

Swift 5.5 added async/await and actors, and Swift 6 checks for data races at compile time under strict concurrency. Swift is open source and also runs on Linux and Windows, though most of its use is on Apple platforms with SwiftUI and UIKit.

Key points

  • Structs and enums are copied on assignment; classes are shared by reference and counted with ARC
  • guard let and if let unwrap optionals safely; force-unwrapping with ! traps at run time when the value is nil
  • Actors serialise access to their state, and Sendable marks types that can cross concurrency domains

Languages

Kotlin

A JVM language from JetBrains, the preferred language for Android development.

Kotlin runs on the JVM and interoperates fully with Java libraries. Its type system distinguishes nullable from non-null types, and it adds data classes, extension functions, smart casts and sealed classes. Google has listed it as the preferred language for Android since 2019.

Coroutines provide asynchronous code written in sequential style, with structured concurrency tying each coroutine to a scope. Kotlin also compiles to JavaScript and native code, and Kotlin Multiplatform shares code between Android, iOS, desktop and server.

Key points

  • Values coming from Java have platform types (String!) whose nullability the compiler does not know
  • Coroutines launched in a lifecycle-bound scope, such as viewModelScope, are cancelled when that scope ends
  • val declares a read-only reference and var a mutable one; collections come in read-only and mutable interfaces

Data

PostgreSQL

An open-source relational database with strong SQL support and a large extension ecosystem.

PostgreSQL implements multi-version concurrency control: an update writes a new row version, readers see a consistent snapshot without taking locks, and VACUUM later reclaims the old versions. It supports transactions, foreign keys, window functions, CTEs, JSONB and full-text search.

Extensions add capabilities inside the database: PostGIS for geospatial data, pgvector for vector search, TimescaleDB for time series. Replication is available as streaming physical replication and as logical replication of selected tables.

Key points

  • EXPLAIN (ANALYZE, BUFFERS) shows the executed plan with actual row counts, timings and buffer reads
  • Autovacuum removes dead row versions and prevents transaction ID wraparound; long-running transactions delay both
  • Connections are processes, so deployments with many clients usually put a pooler such as PgBouncer in front

Data

Redis

An in-memory data store used as a cache, message broker and fast key-value database.

Redis keeps its data in memory and executes commands on a single main thread, so each command is atomic. It provides strings, hashes, lists, sets, sorted sets, streams and bitmaps, each with its own commands; Lua scripts and transactions group several commands together.

Persistence is optional, through RDB snapshots, an append-only file, or both. Replication and Sentinel provide failover, and Redis Cluster shards keys across nodes by hash slot. Since the 2024 licence change, Valkey continues the project under the BSD licence.

Key points

  • Commands that scan large collections, such as KEYS or SMEMBERS on a big set, block the main thread while they run
  • Common cache problems are penetration (requests for missing keys), stampede (many rebuilds of one expired key) and avalanche (many keys expiring at once)
  • maxmemory and the eviction policy decide what is removed when memory runs out

Data

MySQL

A widely deployed open-source relational database, usually run with the InnoDB storage engine.

InnoDB stores each table as a clustered index on the primary key; secondary indexes store the primary key and look the row up through it. It supports transactions and row-level locking, and implements MVCC by building older row versions from the undo log.

MySQL is common in web applications and is the base of managed services such as Amazon Aurora and PlanetScale. Replication works from the binary log, either asynchronously, semi-synchronously, or through Group Replication.

Key points

  • A short, monotonically increasing primary key keeps inserts at the end of the clustered index and keeps secondary indexes small
  • Under REPEATABLE READ, InnoDB takes gap and next-key locks on ranges, which can block inserts into those ranges
  • EXPLAIN and the slow query log show which queries scan large numbers of rows

Data

ClickHouse

A column-oriented database for analytical queries over very large tables.

ClickHouse stores each column separately and compresses it, so a query reads only the columns it uses. Its vectorised execution engine processes data in blocks and parallelises a query across CPU cores and across shards.

The MergeTree engine family sorts data by the table's ORDER BY key, writes inserts as parts and merges them in the background. Variants such as ReplacingMergeTree and AggregatingMergeTree deduplicate or pre-aggregate rows during those merges. It is used for logs, metrics, event analytics and observability backends.

Key points

  • The ORDER BY key determines the sparse primary index, so filters on its leading columns skip the most data
  • Inserts work best in large batches; many small inserts create many parts and increase merge load
  • Updates and deletes run as asynchronous mutations that rewrite whole parts

Data

SQLite

An embedded SQL database that stores a whole database in a single file.

SQLite is a C library linked into the application, with no separate server process. The database is one cross-platform file, and transactions are atomic and durable. It ships in every major operating system, browser and phone, and is one of the most widely deployed pieces of software.

In WAL mode, readers and a single writer can work at the same time, and writes are serialised. Tools such as Litestream and LiteFS replicate the file for backup or for read replicas. It is used for application storage, local caches, test databases and small to medium websites.

Key points

  • Only one write transaction runs at a time; busy_timeout sets how long another writer waits for the lock before returning "database is locked"
  • WAL mode is enabled with PRAGMA journal_mode=WAL and is the usual setting for concurrent access
  • Columns use type affinity by default; STRICT tables enforce declared column types

Infrastructure

Kafka

A distributed, partitioned log for streaming events between systems.

Kafka stores messages in topics, each split into partitions. A partition is an append-only log replicated across brokers; consumers track their own offset in it and can re-read from any point while the data is retained. Ordering is guaranteed within a partition.

Consumer groups spread a topic's partitions across instances, so throughput scales with the partition count. Kafka is used for event pipelines, change data capture, log aggregation and decoupling services. Since version 4.0 it runs without ZooKeeper, using its own KRaft consensus.

Key points

  • Messages with the same key go to the same partition, which keeps per-key ordering
  • With acks=all and min.insync.replicas, a write is acknowledged only after enough replicas have it
  • Delivery is at-least-once by default; exactly-once processing uses idempotent producers and transactions

Infrastructure

Docker

A tool for building and running applications in containers from layered images.

A container is an ordinary process on the host kernel, isolated with Linux namespaces (process IDs, network, mounts, users) and limited with cgroups (CPU, memory, I/O). An image is a stack of read-only filesystem layers plus metadata, built from a Dockerfile and stored in a registry.

Docker packages an application with its dependencies so it runs the same way on a laptop, in CI and in production. Images follow the OCI specification, so they also run under containerd, Podman and Kubernetes. Docker Compose describes multi-container setups in one file.

Key points

  • Each Dockerfile instruction creates a layer, and unchanged layers are reused from the build cache
  • Multi-stage builds compile in one stage and copy only the output into a smaller runtime image
  • Containers share the host kernel; running as a non-root user and dropping capabilities reduce what a compromised process can do

Infrastructure

Kubernetes

A container orchestrator that keeps a cluster in the state described by its configuration.

Kubernetes stores the desired state of the cluster as API objects (Deployments, Services, ConfigMaps and so on) in etcd. Controllers watch those objects and act until the actual state matches: the scheduler places Pods on nodes, the kubelet starts their containers, and Deployments replace failed Pods.

It provides service discovery, load balancing, rolling updates, autoscaling and storage attachment through a common API. Managed offerings such as EKS, GKE and AKS run the control plane, and Helm and Kustomize package and template the manifests.

Key points

  • Resource requests guide scheduling and limits cap usage; a container that exceeds its memory limit is OOM-killed
  • Readiness probes control whether a Pod receives traffic, and liveness probes restart a container that has stopped responding
  • A PodDisruptionBudget limits how many replicas voluntary disruptions, such as node drains, can take down at once

Infrastructure

Linux

The open-source kernel that runs most servers, containers and cloud infrastructure.

The Linux kernel manages processes, memory, filesystems, networking and devices, and exposes them through system calls and the /proc and /sys filesystems. Namespaces and cgroups, the building blocks of containers, are kernel features.

Distributions such as Debian, Ubuntu, RHEL and Alpine package the kernel with a userland and a package manager. Tools such as top, vmstat, iostat, ss, strace and perf show what the system and individual processes are doing.

Key points

  • Load average counts runnable tasks and tasks in uninterruptible sleep, so heavy disk I/O raises it as well as CPU use
  • Free memory is used as page cache; the available column in free shows what can be reclaimed for applications
  • eBPF runs sandboxed programs in the kernel for tracing, networking and security, with tools such as bpftrace and the BCC suite

Infrastructure

NGINX

A web server and reverse proxy built on an event-driven, non-blocking architecture.

NGINX runs a master process and a small number of worker processes; each worker handles many connections with an event loop (epoll on Linux, kqueue on BSD). This keeps memory use low and steady as the number of connections grows.

It serves static files, terminates TLS, load-balances across upstream servers, caches responses, and proxies HTTP, gRPC and WebSocket traffic. It is also the basis of ingress controllers in Kubernetes and of OpenResty, which adds Lua scripting.

Key points

  • worker_processes auto starts one worker per CPU core
  • keepalive in an upstream block reuses connections to backends and reduces connection setup
  • nginx -t checks the configuration, and nginx -s reload applies it without dropping existing connections

Observability

Prometheus

A monitoring system that scrapes metrics over HTTP and stores them as time series.

Prometheus pulls metrics from targets at a fixed interval and stores each series, identified by a metric name and a set of labels, in a local time-series database. PromQL queries, aggregates and computes rates over those series, and alerting rules are written in PromQL as well.

Applications expose metrics through client libraries; exporters do the same for systems such as Linux hosts, databases and proxies. Alertmanager groups and routes alerts. For long-term or global storage, Thanos, Cortex, Mimir and VictoriaMetrics extend it.

Key points

  • Every distinct combination of label values is a separate series, so labels such as user ID or request ID multiply storage and memory use
  • rate() on a counter gives a per-second rate and handles counter resets
  • Histograms record values in buckets, and histogram_quantile() estimates percentiles across instances

Observability

Grafana

A dashboard and visualisation tool that queries many data sources in one place.

Grafana connects to data sources such as Prometheus, Loki, Tempo, Elasticsearch, ClickHouse and SQL databases, and renders their query results as panels on dashboards. Variables let one dashboard switch between services, clusters or environments.

It also handles alerting, and links metrics, logs and traces so a panel can jump to the related logs or trace for the same time range. Dashboards are stored as JSON and can be provisioned from files or managed through its API.

Key points

  • RED (rate, errors, duration) describes request-driven services, and USE (utilisation, saturation, errors) describes resources
  • Data links and exemplars connect a metric panel to the matching logs and traces
  • Provisioning dashboards from version-controlled JSON keeps them reviewable and reproducible

Client

React

A JavaScript library for building user interfaces from components.

A React component is a function that takes props and state and returns a description of the UI. When state changes, React re-renders the affected components and applies the differences to the DOM. Hooks such as useState, useEffect and useContext give function components state and side effects.

React handles the view layer; routing, data fetching and server rendering come from frameworks such as Next.js and React Router or from separate libraries. React 18 added concurrent rendering, and React 19 added Server Components and Actions. React Native applies the same model to iOS and Android.

Key points

  • key identifies list items between renders; stable IDs keep each item's state attached to the right element
  • useMemo and useCallback keep values and functions referentially stable between renders
  • Libraries such as TanStack Query cache server data and handle refetching and invalidation

Client

Next.js

A React framework from Vercel with routing, server rendering and API routes built in.

Next.js maps files in the app directory to routes and renders pages on the server, at build time, or on the client. In the App Router, components are React Server Components by default; components marked 'use client' are also sent to the browser and hydrated.

Route handlers and Server Actions run server code inside the same project, and middleware runs before a request reaches a route. Fetch results and rendered pages can be cached and revalidated by time or on demand. It deploys to Vercel, to Node.js servers, or as a static export.

Key points

  • 'use client' marks the boundary where components start shipping JavaScript to the browser
  • Caching and revalidation are set per fetch or per route, with revalidate, cache and revalidatePath
  • Environment variables without the NEXT_PUBLIC_ prefix stay on the server

Client

Astro

A web framework for content sites that renders pages to HTML and ships no JavaScript by default.

Astro components render on the server or at build time and output HTML. Interactive components from React, Vue, Svelte or other frameworks are added as islands with client:* directives, and only those islands load JavaScript in the browser.

Content collections load Markdown, MDX or data files and validate their frontmatter against a schema. Astro builds static sites by default and supports server rendering through adapters. This site is built with Astro; its only client script runs the front-page typewriter and the stack dialogs.

Key points

  • client:load, client:idle and client:visible control when an island hydrates
  • Content collection schemas use zod, so invalid frontmatter fails the build
  • Astro is built on Vite and uses Vite plugins and its dev server

Client

Tailwind CSS

A utility-first CSS framework that styles elements with small, single-purpose classes.

Tailwind provides classes such as flex, px-4 and text-sm, each setting one or a few CSS properties from a design scale. Styles are written in the markup, and the build scans the source files and generates CSS only for the classes in use.

Version 4 moved configuration into CSS: design tokens are declared with @theme, and custom utilities with @utility. Variants such as hover:, md: and dark: apply a class under a state or breakpoint. This site uses Tailwind v4 for layout, with its tokens and newspaper styles in one stylesheet.

Key points

  • Spacing, colour and type scales come from the theme, so values stay consistent across components
  • In v4, @apply accepts classes declared with @utility; classes inside @layer components are unavailable to it
  • Repeated groups of utilities are usually extracted into a component in the UI framework

Client

Vite

A front-end build tool with a fast dev server based on native ES modules.

In development, Vite serves source files to the browser as native ES modules and transforms each file when it is requested, with hot module replacement on save. Dependencies are pre-bundled once with esbuild. For production it bundles the application with Rollup, and newer versions with Rolldown.

It supports TypeScript, JSX, CSS modules and static assets without extra configuration, and its plugin API is compatible with Rollup plugins. Astro, SvelteKit, Nuxt, SolidStart and many React setups are built on it.

Key points

  • Development and production builds go through different pipelines, so the production build is worth testing before release
  • import.meta.env exposes environment variables, and only those prefixed with VITE_ reach client code
  • vite preview serves the production build locally

Client

Node.js

A JavaScript runtime built on V8, used for servers and for front-end tooling.

Node.js runs JavaScript outside the browser on Google's V8 engine. JavaScript executes on one thread with an event loop, and libuv handles file, network and timer I/O asynchronously, using a thread pool for operations the OS cannot do asynchronously.

It runs web servers and APIs with frameworks such as Express and Fastify, the server side of Next.js, and most front-end tooling: Vite, the TypeScript compiler, ESLint and package managers. npm is its package registry. Even-numbered releases become long-term support versions.

Key points

  • Synchronous or CPU-heavy work in a request handler blocks the event loop for all concurrent requests
  • worker_threads run CPU-bound code on separate threads
  • An .nvmrc file or the engines field in package.json records the Node version a project needs

Client

SwiftUI

Apple's declarative UI framework for building interfaces in Swift across its platforms.

A SwiftUI view is a struct whose body describes the interface for the current state. When state changes, SwiftUI recomputes the affected views and updates the screen. One codebase can target iOS, iPadOS, macOS, watchOS, tvOS and visionOS.

State is held with property wrappers such as @State and @Binding, and since iOS 17 with @Observable model classes. SwiftUI interoperates with UIKit and AppKit through UIViewRepresentable and hosting controllers. Xcode previews render views while they are being edited.

Key points

  • @State holds state owned by one view, and @Observable models hold state shared between views
  • Many APIs depend on the minimum OS version, which is listed in the documentation for each modifier
  • UIViewRepresentable and UIHostingController embed UIKit views in SwiftUI and SwiftUI views in UIKit

AI Tools

Claude Code

Anthropic's coding agent that works in a repository from the terminal, an IDE or the desktop app.

Claude Code reads files, searches the codebase, runs shell commands and edits across multiple files to complete a task described in natural language. It shows each step and asks for permission before actions according to the configured permission mode.

A CLAUDE.md file in the repository records conventions and project notes, and is loaded into every session. It connects to external tools through MCP servers, and supports subagents, hooks and custom slash commands. It runs in the terminal, in VS Code and JetBrains IDEs, in the Claude desktop app and on the web.

Key points

  • CLAUDE.md holds project conventions, build commands and known pitfalls for every session to read
  • Tasks with a clear goal and a way to verify the result, such as a failing test, are completed most reliably
  • Changes are reviewed in the diff before they are committed

AI Tools

Codex

OpenAI's coding agent, available as a CLI, an IDE extension and a cloud service.

Codex reads and edits code, runs commands and tests, and proposes changes for a described task. The Codex CLI runs locally in the terminal with configurable approval modes; Codex in ChatGPT runs tasks in cloud sandboxes and returns the result as a diff or a pull request.

An AGENTS.md file in the repository gives it build commands, test commands and project conventions. Cloud tasks run in parallel and asynchronously, so several independent tasks can be started at once and reviewed when they finish.

Key points

  • AGENTS.md lists how to build, test and lint the project
  • Cloud tasks run in isolated containers with the repository checked out
  • A second model reviewing a change catches a different set of mistakes from the model that wrote it

AI Tools

Gemini

Google's family of multimodal models, which I use for questioning a subject until it is clear.

Gemini is a family of large language models from Google DeepMind that accept text, images, audio, video and documents. It is available in the Gemini app, through the Gemini API and Vertex AI, and inside Google products. Its context window holds very long inputs, such as entire papers or books.

I use it mainly for knowledge questions, in a Socratic way: ask what something is, then why, then what follows, and keep going through each answer until the definitions and their premises are clear. Each answer is a step in that line of questioning.

Key points

  • Supplying the source document grounds the answers in that text
  • Asking for the reasoning and for counter-arguments exposes the premises behind an answer
  • Specific facts such as figures, versions and recent events are checked against primary sources

AI Tools

Ollama

A tool for downloading and running open-weight language models on a local machine.

ollama run <model> downloads a model and starts serving it. Models are stored as quantised weights and run through a llama.cpp-based engine on CPU, Apple Silicon or NVIDIA and AMD GPUs. A Modelfile sets the system prompt, parameters and template for a custom model.

Ollama exposes a local HTTP API, including an OpenAI-compatible endpoint, so existing client libraries can use it by changing the base URL. It is used for offline work, for data that must stay on the machine, and for embeddings and other high-volume, low-latency calls.

Key points

  • The OpenAI-compatible endpoint is served at http://localhost:11434/v1
  • Quantisation levels such as Q4 and Q8 trade model quality for memory; the whole model fits best in VRAM or unified memory
  • The context length is configurable per model and affects memory use

AI Tools

Hugging Face

A platform for hosting and sharing machine learning models, datasets and demos.

The Hugging Face Hub hosts open-weight models, datasets and Spaces (hosted demo apps) as Git repositories. Each model has a model card describing its training data, intended use, limitations and licence. Community members publish fine-tunes and quantised builds, such as GGUF files for llama.cpp and Ollama.

Its libraries include Transformers for loading and running models, Datasets for data loading, Tokenizers, PEFT for parameter-efficient fine-tuning, and Diffusers for image models. Inference Endpoints and Inference Providers serve models through an API.

Key points

  • Model licences vary, and some open-weight models restrict commercial use
  • Downloading by revision pins a model to a specific commit of its repository
  • Community GGUF builds differ in quantisation and context length, which are listed in the file names and model card