<?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 Chen Kai Blog</title><link>https://www.chenk.top/en/tags/performance/</link><description>Recent content in Performance on Chen Kai Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 17 Jul 2025 09:00:00 +0000</lastBuildDate><atom:link href="https://www.chenk.top/en/tags/performance/index.xml" rel="self" type="application/rss+xml"/><item><title>System Design (4): Caching — Where to Cache, What to Evict, and When Caching Hurts</title><link>https://www.chenk.top/en/system-design/04-caching-strategies/</link><pubDate>Thu, 17 Jul 2025 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/system-design/04-caching-strategies/</guid><description>&lt;p>There is an old joke in computer science that the two hardest problems are cache invalidation, naming things, and off-by-one errors. The joke works because cache invalidation really is that hard. But caching is also the single most effective technique for improving system performance. A well-placed cache can reduce latency by 100x, cut database load by 90%, and save thousands of dollars in infrastructure costs per month.&lt;/p>
&lt;p>The trick is knowing where to cache, what patterns to use, and — critically — when caching will make your system worse instead of better.&lt;/p></description></item><item><title>Databases (2): Indexing and Query Planning — How Databases Find Your Data</title><link>https://www.chenk.top/en/databases/02-indexing-and-query-planning/</link><pubDate>Fri, 19 Apr 2024 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/databases/02-indexing-and-query-planning/</guid><description>&lt;p>A query that returns in 2 milliseconds on your laptop with 1,000 rows will take 45 seconds on a production database with 50 million rows — unless you have the right indexes. Indexes are the single most impactful performance tool in your database toolkit, and understanding how they work changes the way you think about every schema and every query you write.&lt;/p>
&lt;hr>
&lt;h2 id="the-fundamental-problem-finding-a-row" class="heading-anchor">The Fundamental Problem: Finding a Row&lt;a href="#the-fundamental-problem-finding-a-row" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>Imagine a table with 10 million rows, stored on disk as a heap file. Each row sits somewhere in a sequence of 8 KB pages. When you run:&lt;/p></description></item><item><title>Python Engineering (8): Performance — Profiling, Caching, and Knowing When to Stop</title><link>https://www.chenk.top/en/python-engineering/08-performance-and-profiling/</link><pubDate>Wed, 27 Apr 2022 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/python-engineering/08-performance-and-profiling/</guid><description>&lt;p>Donald Knuth&amp;rsquo;s famous quote is often half-remembered. The full version is: &amp;ldquo;We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.&amp;rdquo; The second sentence is the key. Performance work isn&amp;rsquo;t about making everything fast; it&amp;rsquo;s about finding the 3% that matters and making that fast.&lt;/p>
&lt;p>This article is about finding that 3%. You&amp;rsquo;ll learn to profile first, optimize second, and measure the impact of each change.&lt;/p></description></item></channel></rss>