open-menu closeme
Engineering
github linkedin rss
  • Why untouched Go slices can end up in physical memory more often under GOMEMLIMIT

    calendar Dec 3, 2026 · 7 min read · Go Linux Performance  ·
    Share on: twitter copy

    A Go program that allocates large slices and never writes to them should need almost no physical memory. Linux backs anonymous memory with physical pages on first write, so untouched virtual memory is free. Yet a program that does nothing but allocate 400 MiB slices ends up with 0.9 GiB of RSS, and 2.1 GiB once …


    Read More
  • Set GOMAXPROCS for small Go programs on big hosts

    calendar Dec 1, 2026 · 10 min read · Go Rust Container Performance  ·
    Share on: twitter copy

    Multi-tenant hosts often run many copies of small Go programs: shims, credential refreshers, sidecars, one per container or one per tenant. Each copy does little work, but each one starts with GOMAXPROCS set to the number of CPUs it can see, which on a large host is the whole machine. The Go runtime sizes parts of its …


    Read More
  • Remount sysfs to make its superblock rw: mount -o remount,rw /sys

    calendar Nov 9, 2026 · 6 min read · Linux Container NFS Performance  ·
    Share on: twitter copy

    While testing Amazon EFS volumes in containers, I found that sequential reads in some runs were about 4 times slower than in others. EFS volumes are mounted with efs-utils, which turns mount -t efs into an NFSv4.1 mount through a local TLS proxy. In the slow runs, the NFS mount's read_ahead_kb was 128 instead of 15360. …


    Read More
  • Page-cache thrashing on EC2: kill the tenant before it takes the host down

    calendar Oct 28, 2026 · 30 min read · Linux EC2 container Performance  ·
    Share on: twitter copy

    For a long time, some of our container hosts, most often the smallest ones, would go dark every so often. A t3.micro with 1 GiB of memory, running a customer's containers, would stop sending logs and metrics all at once and never start again. The orchestrator still showed every container as RUNNING. The only signs of …


    Read More
  • Pre-load container images on the Bottlerocket read-only root filesystem

    calendar Oct 25, 2026 · 13 min read · Bottlerocket container Linux Performance  ·
    Share on: twitter copy

    We run customer workloads in containers, and each container gets its own VM (an EC2 instance or a microVM). Every VM needs a few OCI images regardless of the workload: the language runtime image the customer's workload is built on, a log forwarding sidecar, an internal monitoring container. The obvious way to provide …


    Read More
  • Don't hardcode fsync in your library

    calendar Jul 20, 2026 · 5 min read · Containers Linux Performance  ·
    Share on: twitter copy

    I recently ran into an issue after upgrading the containerd client library to v2.3.0. The root cause was a change in one of containerd's dependencies, continuity, that started enforcing fsync when copying files. containerd/continuity is a library in containerd that provides filesystem utilities: file copying, directory …


    Read More
  • Speed up building Bottlerocket image in AWS CodeBuild

    calendar Oct 20, 2025 · 4 min read · Bottlerocket Docker Performance  ·
    Share on: twitter copy

    When I first moved building Bottlerocket AMI from an EC2 host to AWS CodeBuild, I was hit by a very slow build. On an EC2 instance, I built both the x86 and Arm versions on x86 instances, and fresh builds finished in 5 minutes. However, on CodeBuild with more vCPU and memory, the build process was painfully slower. The …


    Read More
  • False sharing: a look at cache line and write combining

    calendar Feb 23, 2024 · 7 min read · Go Concurrency Performance  ·
    Share on: twitter copy

    Modern CPUs operate significantly faster than memory. A 4.5 GHz x86_64 CPU operates 30 times faster than 6000 MHz DDR5 memory with CAS Latency 36. When accounting for latencies from the bus and memory coherency protocols, memory can be 100 times slower than registers. To mitigate this speed gap, CPUs use layers of …


    Read More
  • Factorial Growth of Subqueries When Using Nested WITH Clauses in ClickHouse

    calendar Jan 12, 2024 · 5 min read · Databases Performance  ·
    Share on: twitter copy

    ClickHouse is a popular OLAP database. It speaks SQL and earns the reputation of "fast and resource efficient". But the support of SQL comes with surprises if not careful. In this blog, I show that a simple query of nested WITH clauses in ClickHouse generates factorial number of subqueries. The simple query …


    Read More
  • Set GOMAXPROCS for Go programs in containers

    calendar Nov 22, 2023 · 6 min read · Go Performance  ·
    Share on: twitter copy

    The first version of this post, from November 2023, said the Go runtime ignores the container's CPU limit and recommended setting GOMAXPROCS by hand or with automaxprocs. Go 1.25 (August 2025) changed the default: on Linux, the runtime now reads the cgroup CPU limit at startup and keeps watching it. This is a rewrite …


    Read More
    • ««
    • «
    • 1
    • 2
    • »
    • »»

Peng Zhang

Software Engineer

Recent Posts

  • Why untouched Go slices can end up in physical memory more often under GOMEMLIMIT
  • Set GOMAXPROCS for small Go programs on big hosts
  • Remount sysfs to make its superblock rw: mount -o remount,rw /sys
  • Page-cache thrashing on EC2: kill the tenant before it takes the host down
  • Pre-load container images on the Bottlerocket read-only root filesystem
  • Leaked empty directories exhaust inodes
  • Share one client per service
  • Debugging zero disk reads after moving to Bottlerocket

Tags

LINUX 30 GO 24 BOTTLEROCKET 11 CONTAINER 11 PERFORMANCE 11 ALGORITHMS 8 INTERVIEW 7 CONCURRENCY 4 SYSTEMD 4 DISTRIBUTED SYSTEM 3 GUIDE 3 SECURITY 3 AWS 2 CONTAINERS 2
All Tags
ALGORITHMS8 AWS2 BOTTLEROCKET11 CONCURRENCY4 CONTAINER11 CONTAINERS2 CRYPTOGRAPHY1 DATABASES1 DISTRIBUTED SYSTEM3 DNS1 DOCKER1 EC22 GO24 GUIDE3 INTERVIEW7 LINUX30 NETWORK1 NFS1 PERFORMANCE11 RUST1 SECURITY3 SELINUX2 SHELL1 SYSTEMD4 TESTING1 WEB2
[A~Z][0~9]
Peng Zhang

Copyright 2022-  PENG ZHANG. All Rights Reserved

to-top