<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Performance on </title>
    <link>https://peng.fyi/tags/performance/</link>
    <description>Recent content in Performance on </description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>map[name:Peng Zhang]</managingEditor>
    <webMaster>map[name:Peng Zhang]</webMaster>
    <copyright>Peng Zhang</copyright>
    <lastBuildDate>Thu, 03 Dec 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://peng.fyi/tags/performance/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Why untouched Go slices can end up in physical memory more often under GOMEMLIMIT</title>
      <link>https://peng.fyi/post/unused-virtual-memory-can-use-physical-memory/</link>
      <pubDate>Thu, 03 Dec 2026 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/unused-virtual-memory-can-use-physical-memory/</guid>
      <description>
        
          
            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 GOMEMLIMIT is set. The cause is how the runtime decides when it has to clear memory before handing it out.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Set GOMAXPROCS for small Go programs on big hosts</title>
      <link>https://peng.fyi/post/gomaxprocs-for-small-go-programs/</link>
      <pubDate>Tue, 01 Dec 2026 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/gomaxprocs-for-small-go-programs/</guid>
      <description>
        
          
            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 allocator, its garbage collector, and its thread pool by GOMAXPROCS, so every copy carries overhead for 64 processors on a 64-vCPU host.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Remount sysfs to make its superblock rw: mount -o remount,rw /sys</title>
      <link>https://peng.fyi/post/sysfs-superblock-race/</link>
      <pubDate>Mon, 09 Nov 2026 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/sysfs-superblock-race/</guid>
      <description>
        
          
            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&#39;s read_ahead_kb was 128 instead of 15360.
That symptom has a known cause. Linux 5.4 dropped the default NFS readahead from 15 times rsize, which is 15 MiB with EFS&#39;s 1 MiB rsize, to 128 KiB (NFS: Optimise the default readahead size).
          
          
        
      </description>
    </item>
    
    <item>
      <title>Page-cache thrashing on EC2: kill the tenant before it takes the host down</title>
      <link>https://peng.fyi/post/page-cache-thrashing-on-ec2-kill-the-tenant/</link>
      <pubDate>Wed, 28 Oct 2026 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/page-cache-thrashing-on-ec2-kill-the-tenant/</guid>
      <description>
        
          
            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&#39;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 life were in CloudWatch: a CPU spike, the EBS volumes reading as fast as they could with almost no writes, and the instance&#39;s EBS byte balance draining from 100% to zero in about half an hour.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Pre-load container images on the Bottlerocket read-only root filesystem</title>
      <link>https://peng.fyi/post/container-images-on-the-bottlerocket-root-volume/</link>
      <pubDate>Sun, 25 Oct 2026 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/container-images-on-the-bottlerocket-root-volume/</guid>
      <description>
        
          
            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&#39;s workload is built on, a log forwarding sidecar, an internal monitoring container. The obvious way to provide them is to pre-load: bake the images into the OS image so the container content store is ready at boot, with no image pull and no snapshot creation.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Don&#39;t hardcode fsync in your library</title>
      <link>https://peng.fyi/post/dont-make-fsync-default-in-library/</link>
      <pubDate>Mon, 20 Jul 2026 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/dont-make-fsync-default-in-library/</guid>
      <description>
        
          
            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&#39;s dependencies, continuity, that started enforcing fsync when copying files.
containerd/continuity is a library in containerd that provides filesystem utilities: file copying, directory diffing, disk usage accounting, metadata preservation, and extended attribute handling. The main entry point for copying is fs.CopyDir, which recursively walks a source directory and copies each file via fs.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Speed up building Bottlerocket image in AWS CodeBuild</title>
      <link>https://peng.fyi/post/speed-up-building-br-image-in-codebuild/</link>
      <pubDate>Mon, 20 Oct 2025 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/speed-up-building-br-image-in-codebuild/</guid>
      <description>
        
          
            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 x86 CodeBuild uses a compute of &amp;quot;145 GB memory, 72 vCPUs&amp;quot;. The build finishes in 18 minutes, with the build-variant step taking 97% of the time.
          
          
        
      </description>
    </item>
    
    <item>
      <title>False sharing: a look at cache line and write combining</title>
      <link>https://peng.fyi/post/false-sharing-cacheline-and-write-buffer/</link>
      <pubDate>Fri, 23 Feb 2024 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/false-sharing-cacheline-and-write-buffer/</guid>
      <description>
        
          
            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 caches organized around cache lines, typically 64 bytes each. However, programming languages operate at the byte level. This mismatch between byte-level abstractions and cache line realities can create a false sharing: a false sense of data independence.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Factorial Growth of Subqueries When Using Nested WITH Clauses in ClickHouse</title>
      <link>https://peng.fyi/post/factorial-growth-of-clickhouse-with-clause/</link>
      <pubDate>Fri, 12 Jan 2024 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/factorial-growth-of-clickhouse-with-clause/</guid>
      <description>
        
          
            ClickHouse is a popular OLAP database. It speaks SQL and earns the reputation of &amp;quot;fast and resource efficient&amp;quot;. 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 is short, reads nothing, process nothing and returns nothing. Yet, it uses a lot of CPU and memory to just parse the query.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Set GOMAXPROCS for Go programs in containers</title>
      <link>https://peng.fyi/post/gomaxprocs-in-container/</link>
      <pubDate>Wed, 22 Nov 2023 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/gomaxprocs-in-container/</guid>
      <description>
        
          
            The first version of this post, from November 2023, said the Go runtime ignores the container&#39;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 for Go 1.27, with new measurements on Linux.
The short answer: if your go.mod says go 1.
          
          
        
      </description>
    </item>
    
    <item>
      <title>A simple and customizable load test tool in Go</title>
      <link>https://peng.fyi/post/simple-customizable-loadtest/</link>
      <pubDate>Sun, 15 Oct 2023 00:00:00 +0000</pubDate>
      <author>map[name:Peng Zhang]</author>
      <guid>https://peng.fyi/post/simple-customizable-loadtest/</guid>
      <description>
        
          
            We plan to load test our product before public Beta, with two goals in mind.
Find out bottlenecks: figure out road maps of performance improvement and prepare for oncalls. Understand how much workload we can support with fixed resources. This shapes the pricing strategy and determines number of Beta partners to onboard, without burning runway. Because it is complicated to generate meaningful loads to the system, we cannot use general tools like K6.
          
          
        
      </description>
    </item>
    
  </channel>
</rss>
