#Performance
17 posts
When Your Python Server Is Slow — Finding the Bottleneck in 5 Minutes with py-spy
Using py-spy, the sampling profiler that attaches to a running Python process with no code changes or restarts: dump to identify a hung process, top for live bottleneck watching, record and flame graphs, --idle for off-CPU waits, reading the GIL numbers, and running it in containers.
How a CDN Makes Things Fast — From Cache Hits to Dynamic Content
CDN mechanics from the practitioner's side: the edge structure that shrinks distance (RTT), the Cache-Control headers and cache keys that decide hit rate, invalidation and deploy strategy, how CDNs help even uncacheable dynamic traffic (TLS termination, connection reuse), and the common mistakes that eat hit rate.
Why Redis Is Fast — Memory, a Single Thread, and Data Structures
The structural reasons Redis handles hundreds of thousands of requests per second: memory access with no disk in the path, a lock-free single-threaded event loop, and purpose-built data structures — plus the single-thread trap (one slow command stalls everything) and the cases where Redis gets slow.
What a Database Index Actually Does — B-trees, Lookup Cost, and the Price of Writes
How indexes make lookups fast, from the B-tree up: the cost gap versus full scans, composite indexes and column order, why indexes are not free (write cost, storage), and the working rules for what to index and what to leave alone.
When a REST API Is Slow — the Order for Finding the Bottleneck
Finding API bottlenecks by procedure instead of instinct: instrumenting to split the request into segments, the four usual suspects (database, serialization, external calls, N+1), the priority order of fixes like caching and pagination, and why p99 matters more than p50.
What Load Average Actually Is — and How It Differs from CPU Usage
Reading the most misread metric in Linux correctly: the definition (running + runnable + disk-wait D-state tasks), judging against core count, the four classic ways it diverges from CPU usage, and reading the 1/5/15-minute triple as a trend.
Why Your Server Is Slow #5: When the Database Slows Down — Indexes, Locks, Connection Pools
Tracking down why a database that ran fine is getting slower. Covers full scans collapsing the day data growth crosses a threshold, indexes that exist but never get used, lock wait chains rooted in long transactions, telling pool exhaustion from database saturation, and a diagnostic order built on EXPLAIN and the statistics views.
Why Your Server Is Slow #4: Plenty of Bandwidth, Still Slow — Latency, RTT, Retransmissions
Tracking down why the network feels slow while the link sits mostly idle. Covers how RTT times round-trip count sets perceived speed, the handshake cost of TCP and TLS, BDP and window limits, checking packet loss and retransmissions, and connection reuse.
Why Your Server Is Slow #3: Slow Despite an SSD — Write Amplification, fsync, Queue Depth
Tracking down why storage is the bottleneck even on an SSD. Covers the fine print behind spec-sheet IOPS, the cost of durable writes through fsync, SLC cache exhaustion and write amplification, the physical limits of queue depth 1, and the IOPS ceilings of cloud volumes.
Why Your Server Is Slow #2: More Memory Didn't Help — Page Cache, Swap, Working Set
Tracking down why adding memory left performance unchanged. Covers what available really means, how spare memory already works as page cache, judging swap by movement rather than usage, sizing the working set, and the container limits and application heaps that upgrades never reach.
Why Your Server Is Slow #1: Low CPU Usage but Still Slow — Run Queue, I/O Wait, Lock Contention
Tracking down why a server is slow while CPU usage stays low. Covers run queue and scheduling delay, the iowait trap, lock contention and off-CPU waits, and steal time in the cloud — a diagnostic order for finding the waiting that utilization graphs miss.
Angular Advanced #7 Performance tuning — Virtual Scroll, Image, Profiler
Angular app performance, organized by three layers — build, runtime change detection, and resources. Virtual Scroll, NgOptimizedImage, Angular DevTools Profiler, and the defer block — the tools that actually pay off in large apps, all in one place.