Skip to content
StackPractices

performance

Practical resources about performance for software engineers.

107 results

Optimizing for Speed and Efficiency

Performance is a feature. Slow applications lose users, increase infrastructure costs, and create a poor developer experience. Profiling, benchmarking, and systematic optimization are essential skills for senior engineers.

This section covers profiling techniques, database query optimization, frontend bundle analysis, memory leak detection, and latency reduction strategies. Each guide includes measurable targets and before/after benchmarks.

intermediate

Implement Server-Sent Events in Go for Real-Time Updates

How to build a production-ready Server-Sent Events endpoint in Go with connection management, heartbeat pings, and graceful client disconnect handling

intermediate

CDN Cache Invalidation Strategies and Patterns

Implement CDN cache invalidation using purge APIs, surrogate keys, tag-based invalidation, and versioned URLs to keep content fresh

intermediate

Cache Database Query Results with Redis and Python

Cache expensive database query results in Redis with cache-aside pattern, TTL management, and invalidation on writes for Python applications.

beginner

HTTP Cache-Control Headers for APIs and Static Assets

Set Cache-Control, ETag, and Last-Modified headers to control browser and CDN caching for API responses and static assets

intermediate

Configure Caffeine Cache in Java with Eviction Policies

Set up Caffeine cache in a Java application with size-based, time-based, and weighted eviction policies for high-performance local caching.

intermediate

Use Spring Cache Annotations with Redis Backend

Apply Spring's @Cacheable, @CachePut, and @CacheEvict annotations with a Redis cache manager for declarative caching in Java applications.

advanced

Multi-Level Cache with In-Memory L1 and Redis L2

Implement a two-level cache combining in-memory L1 and Redis L2 for low-latency reads with cross-instance consistency

intermediate

Cache HTTP Responses with Nginx Reverse Proxy

Configure Nginx as a caching reverse proxy to cache upstream HTTP responses with TTL zones, cache keys, and conditional purging.

intermediate

Implement an LRU Cache in Node.js

Build a least-recently-used cache in Node.js with O(1) get and set operations using a Map-based doubly linked list

intermediate

Implement Redis Cache Invalidation in Node.js

Invalidate Redis cache entries in Node.js with TTL expiry, explicit deletion, pattern-based clearing, and pub/sub-based distributed invalidation.

intermediate

Cache Database Queries with Django Cache Framework

Use Django's built-in cache framework with per-view caching, template fragment caching, and low-level cache API for database query optimization.

intermediate

Cache HTTP Responses with httpx and CacheControl in Python

Cache HTTP responses in Python using httpx with CacheControl for HTTP-compliant caching, ETag handling, and conditional requests.

intermediate

Cache Function Results with Redis and TTL in Python

Build a Python decorator that caches function return values in Redis with configurable TTL, key generation, and cache invalidation

intermediate

Implement the Cache-Aside Pattern with Redis

Use the cache-aside pattern to read and write data through Redis, handling cache misses, stale reads, and write-through invalidation

intermediate

Build a Real-Time Leaderboard with Redis Sorted Sets

Use Redis sorted sets to implement real-time leaderboards with rank tracking, score updates, and top-N queries in O(log N) time

intermediate

Build Async Pipelines with C# async/await and Task.Run

Build async pipelines in C# using async/await, Task.Run, Task.WhenAll, Task.WhenAny, CancellationTokenSource, Channels, and Parallel.ForEachAsync for concurrent I/O and CPU work.

intermediate

Concurrent Patterns with Go Goroutines and Channels

Build concurrent systems in Go using goroutines, channels, select statements, worker pools, fan-out/fan-in, pipelines, context cancellation, and rate limiting with tickers.

advanced

Compose Asynchronous Pipelines with Java CompletableFuture

Build non-blocking async pipelines in Java using CompletableFuture with thenCompose, thenCombine, allOf, anyOf, exception handling, timeouts, and custom thread pools.

intermediate

Scale Concurrent Applications with Java Virtual Threads

Scale Java applications with virtual threads from Project Loom. Use Thread.ofVirtual, Executors.newVirtualThreadPerTaskExecutor, structured concurrency, and scoped values.

intermediate

Concurrent Async Tasks with asyncio.gather and Task Groups

Execute multiple async operations concurrently in Python using asyncio.gather, asyncio.TaskGroup, error handling with return_exceptions, timeouts, and semaphores for rate limiting.

intermediate

Rate Limit Async Operations with asyncio.Semaphore

Control concurrency in async Python using asyncio.Semaphore for rate limiting API calls, database connections, and resource access with bounded parallelism patterns.

intermediate

Parallelize CPU and I/O Work with ThreadPoolExecutor

Use Python's ThreadPoolExecutor for parallel I/O operations, thread-safe result collection, Future callbacks, error handling, and mixing threads with asyncio for blocking work.

intermediate

Build Async Systems with Rust Tokio Runtime

Build async systems in Rust using the Tokio runtime with tasks, channels, select, synchronization primitives, graceful shutdown, and structured concurrency patterns.

intermediate

PostgreSQL Query Optimization and Indexing Strategies

Analyze and optimize slow PostgreSQL queries using EXPLAIN, proper indexing, partial indexes, and query rewriting to reduce execution time from seconds to milliseconds

intermediate

Redis Cache Patterns for High-Performance Applications

How to implement cache-aside, write-through, and write-behind patterns with Redis to reduce database load and improve response times

intermediate

Stream Process Large Files in Node.js Without Memory Issues

Process GB-sized files in Node.js using streams. Covers readline, transform streams, pipeline, backpressure, and chunk processing.

intermediate

Debounce and Throttle Functions in JavaScript

Control function execution rate with debounce and throttle. Covers leading/trailing edge, cancelable timers, and real-world use cases.

intermediate

Batch and Cache Database Queries with GraphQL DataLoader

Use DataLoader to coalesce individual load requests into batched database calls, solving the N+1 query problem in GraphQL resolvers

intermediate

Detect and Fix N+1 Queries in GraphQL Resolvers

Identify N+1 query problems in GraphQL resolvers using logging, DataLoader, and query analysis tools before they hit production

intermediate

Distribute Background Tasks with Python Celery and Redis

Set up Celery with Redis broker for distributed task processing including task chaining, groups, chords, retry strategies, scheduled tasks with Celery Beat, and result backends.

beginner

Enable Brotli Compression in Nginx for Faster Asset Delivery

How to configure Brotli compression in Nginx to reduce transfer sizes for JavaScript, CSS, and HTML assets with better ratios than Gzip

intermediate

Implement Cache Invalidation Strategies

How to keep caches consistent with databases using TTL, write-through, write-behind, and event-driven invalidation patterns.

intermediate

Caching Strategies

Implement useful caching strategies for databases, APIs, and frontends using Redis, CDNs, and browser caches.

intermediate

Implement CDN Edge Caching

Configure content delivery networks with edge caching rules, cache invalidation, and geographic optimization for static and live content.

intermediate

Set Up Connection Pooling for Databases and HTTP Clients

How to set up connection pooling for databases and HTTP clients to improve performance and reliability

intermediate

Optimize Queries with Database Indexing

How to create, analyze, and maintain indexes to speed up database queries and avoid common indexing mistakes.

intermediate

Debounce and Throttle

How to implement debounce and throttle patterns to control function execution frequency for search inputs, scroll handlers, and API calls.

beginner

Implement Lazy Loading for Images, Components, and Data

How to defer loading of non-critical resources until they are needed, improving initial page load time, reducing bandwidth, and optimizing Core Web Vitals.

intermediate

Load Testing APIs with k6 and Threshold-Based Assertions

How to write and run load tests with k6 to measure API performance, validate SLOs, and identify bottlenecks before production deployment

intermediate

Optimize Slow Database Queries

How to identify, analyze, and fix slow SQL queries using EXPLAIN, query refactoring, and database-specific optimization techniques.

intermediate

SPA Performance: Code Splitting and Lazy Loading

Improve single-page application load times by splitting bundles at route and component level, implementing lazy loading with React.lazy and live imports

intermediate

Web Performance Optimization

Improve Core Web Vitals, reduce bundle sizes, and optimize frontend performance with lazy loading, code splitting, and modern build tools.

intermediate

Concurrent HTTP Requests with asyncio.gather and aiohttp

Fetch multiple HTTP endpoints concurrently using asyncio.gather and aiohttp with error handling, rate limiting, timeouts, and connection pooling

intermediate

Distributed Rate Limiting with FastAPI and Redis

Implement distributed rate limiting in FastAPI using Redis sliding window and token bucket algorithms with per-user, per-IP, and per-endpoint limits

advanced

Reduce AWS Lambda Cold Start with Provisioned Concurrency

Minimize Lambda cold start latency using provisioned concurrency, ARM64 Graviton, lighter dependencies, and initialization code optimization.

intermediate

Compute Resource Consolidation Pattern

Combine workloads into fewer compute resources to reduce cost, improve utilization, and simplify operations.

intermediate

Back-Pressure Pattern

Prevent upstream systems from overwhelming downstream consumers by propagating flow-control signals backward through the pipeline, ensuring stable throughput under load.

beginner

Content Delivery Network (CDN) Pattern

Distribute static and live content through geographically dispersed edge servers to reduce latency, improve availability, and offload origin infrastructure.

intermediate

Eager Loading Pattern

Load related data in a single query rather than multiple round-trips, preventing the N+1 problem and improving read performance.

intermediate

Flyweight Pattern for Efficient Large-Scale Object Sharing

Use the Flyweight pattern to minimize memory usage by sharing as much data as possible between similar objects, essential for rendering large datasets

intermediate

Proxy Pattern for API Response Caching

How to implement a caching proxy that intercepts API calls and stores responses to reduce latency and avoid redundant network requests

intermediate

Shed Load Pattern

Drop requests proactively under extreme load to protect the system. Reject excess traffic before it consumes resources and causes cascading failures.

intermediate

Throttling Pattern

Limit the rate at which a system processes requests or consumes resources to prevent overload, ensure fair usage, and maintain predictable performance under varying load.

intermediate

GraphQL Batched Resolver Pattern

Resolve nested GraphQL fields in a single batched request to eliminate N+1 queries and reduce database load.

intermediate

GraphQL DataLoader Pattern

Coalesce individual load requests into batched calls with per-request caching to prevent N+1 queries and redundant fetches.

intermediate

API Rate Limiting Policy Template

A template for defining API rate limits per consumer tier, including burst allowances, quota periods, and escalation paths.

intermediate

Load Test Execution Plan Template

A template to plan, execute, and document load tests that measure system behavior under realistic or peak traffic.

intermediate

Core Web Vitals Audit Checklist

Checklist for auditing Core Web Vitals per page: LCP optimization steps, INP interaction tuning, CLS layout stability fixes, field data vs lab data analysis, CrUX integration, and remediation tracking with code examples for images, fonts, JavaScript, and CSS.

intermediate

Database Query Tuning Checklist

Checklist for systematic SQL query optimization: EXPLAIN plan analysis, index strategy, N+1 query detection, join optimization, pagination patterns, connection pooling, query caching, and slow query log triage with examples for PostgreSQL and MySQL.

intermediate

Load Test Plan Template

Template for planning and documenting load tests: test scenarios, user journey definitions, ramp-up strategies, success criteria, monitoring setup, tool selection (k6, JMeter, Locust), result analysis, and reporting with code examples for each tool.

intermediate

Performance Budget Template

Template for defining and enforcing web performance budgets: LCP, INP, CLS targets, resource budgets for JS, CSS, images, fonts, third-party scripts, CI/CD integration with Lighthouse CI, and alerting thresholds with examples for Next.js, Astro, and SPA architectures.

intermediate

Capacity Planning Template

A reusable template for planning system capacity, estimating growth, and preventing performance bottlenecks before they happen.

advanced

Complete Guide to LLM Application Architecture

Build production LLM applications end-to-end. Covers API layers, prompt management, streaming, caching, guardrails, observability, evaluation, and deployment patterns for reliable LLM-powered systems.

advanced

Complete Guide to LLM Cost Optimization

Optimize LLM costs in production. Covers model routing, prompt compression, caching, batch API, token management, semantic caching, prompt engineering for cost, monitoring, and budget control patterns for LLM applications.

advanced

Complete Guide to LLM Evaluation

Evaluate LLM applications in production. Covers RAGAS, LLM-as-judge, human evaluation, A/B testing, hallucination detection, toxicity scoring, regression testing, and building automated evaluation pipelines.

advanced

Complete Guide to OpenAI API Mastery

Master the OpenAI API in production. Covers chat completions, streaming, function calling, structured outputs, embeddings, fine-tuning, batch API, assistants API, rate limits, error handling, and cost optimization patterns.

advanced

Complete Guide to GraphQL Caching

Cache GraphQL responses at every layer: CDN, gateway, DataLoader, persisted queries, and client-side. Covers cache keys, invalidation, HTTP caching directives, and Apollo Client cache.

advanced

System Design Interview Guide: Key Concepts

A practical guide to system design interviews: scalability, databases, caching, load balancing, microservices, and how to structure your answer.

advanced

Complete Guide to Application-Level Caching

Implement in-memory, distributed, and hybrid caches at the application layer. Covers LRU caches, TTL caches, multi-tier strategies, cache sizing, thread safety, and production patterns for Python, Java, and Node.js.

advanced

Complete Guide to Cache Invalidation

Master cache invalidation strategies: TTL expiration, event-driven invalidation, versioned keys, tag-based purging, and write-through invalidation. Covers multi-tier invalidation, race conditions, and consistency patterns.

advanced

Complete Guide to CDN Caching Strategy

Design CDN caching for web applications and APIs. Covers edge caching, cache keys, cache headers, invalidation strategies, surrogate keys, and multi-CDN setups for global performance.

advanced

Complete Guide to Redis Caching Strategies

Master Redis caching with cache-aside, read-through, write-through, write-behind, and refresh-ahead patterns. Covers eviction policies, TTL tuning, serialization, and production operations.

advanced

Complete Guide to Go Concurrency

Master Go concurrency in production. Covers goroutines, channels, context, select, sync primitives, worker pools, pipelines, fan-out/fan-in, and patterns for high-throughput concurrent Go applications.

advanced

Complete Guide to Java Concurrency

Master Java concurrency in production. Covers threads, locks, CompletableFuture, virtual threads, executors, concurrent collections, memory model, and patterns for high-throughput parallel applications.

advanced

Complete Guide to Python Asyncio

Master asynchronous Python programming with asyncio. Covers coroutines, tasks, event loops, async/await, gather, semaphores, queues, HTTP clients, websockets, and debugging async code.

advanced

Complete Guide to Python Asyncio in Production

Run Python asyncio in production with confidence. Covers event loops, task management, debugging, cancellation, timeouts, backpressure, and patterns for high-concurrency async applications.

intermediate

Blob Storage: S3, GCS, and Azure Blob Patterns for Engineers

A practical guide to cloud blob storage: bucket design, access control, lifecycle policies, multipart uploads, presigned URLs, and cost optimization patterns for S3, Google Cloud Storage, and Azure Blob.

intermediate

Caching Strategies: From Browser to Database, a Complete

A practical guide to caching strategies: browser caching, CDN edge caching, application caching with Redis, and database query caching. Learn when to use each and how to avoid cache invalidation nightmares.

intermediate

Connection Pooling: Optimize Database Connections for Scale

A practical guide to database connection pooling: sizing pools, handling idle timeouts, detecting leaks, and configuring HikariCP, PgBouncer, and cloud-native pools for maximum throughput.

advanced

Database Sharding: Horizontal Partitioning in Practice

A practical guide to database sharding: choosing shard keys, routing queries, rebalancing data, and avoiding common pitfalls when scaling beyond a single database node.

intermediate

Full-Text Search — Implement Search That Actually Works

A practical guide to full-text search: PostgreSQL tsvector, Elasticsearch indexing, query design, relevance tuning, and building search that users trust with autocomplete, faceting, and typo tolerance.

intermediate

Read Replicas: Scale Reads Without Changing Application

A practical guide to read replicas: setting up replication, routing read queries, handling replication lag, and scaling read-heavy workloads with PostgreSQL, MySQL, and cloud-managed replicas.

advanced

Real-Time Analytics: From Events to Dashboards in Seconds

A practical guide to real-time analytics: event collection, stream processing, data warehousing, and building sub-second dashboards with Kafka, ClickHouse, Druid, and modern OLAP databases.

advanced

Complete Guide to MongoDB Indexing

Master MongoDB indexing. Covers single field, compound, text, geospatial, TTL, wildcard, hashed indexes, ESR rule, covered queries, explain plan analysis, index intersection, and partial indexes with practical examples.

advanced

Complete Guide to PostgreSQL Tuning

Optimize PostgreSQL for high throughput. Covers configuration tuning, indexing strategies, query optimization, connection pooling, partitioning, and vacuum management.

advanced

Complete Guide to SQL Query Optimization

Optimize SQL queries. Covers EXPLAIN plan analysis, index strategies, join optimization, N+1 query detection, query rewriting, materialized views, partitioning, connection pooling, and query caching with practical PostgreSQL and MySQL examples.

intermediate

Database Denormalization

A practical guide to database denormalization: when to trade storage for read performance, common patterns, and how to keep derived data consistent.

intermediate

Database Indexing Strategies — From B-Trees to BRIN

A practical guide to database indexes: B-Trees, Hash, GIN, GiST, BRIN, and partial indexes. Learn when to use each and how to avoid common indexing mistakes.

intermediate

SQL Performance Tuning — Indexes, Queries, and Explain Plans

A practical guide to optimizing SQL queries: indexing strategies, query rewriting, EXPLAIN plan analysis, and common anti-patterns to avoid.

intermediate

Time-Series Databases — InfluxDB, TimescaleDB

A practical guide to time-series databases: when to use a specialized TSDB, data model, retention policies, and choosing between InfluxDB, TimescaleDB, and ClickHouse.

intermediate

A/B Testing: Experimentation Frameworks for Data-Driven

A practical guide to A/B testing: experiment design, statistical significance, sample sizing, avoiding pitfalls, and building an experimentation culture in engineering teams.

intermediate

Blue-Green Deployment

A practical guide to blue-green deployments: architecture, traffic switching strategies, database migrations, and achieving zero-downtime releases with instant rollback capability.

intermediate

Canary Deployment: Gradual Rollouts with Safety Controls

A practical guide to canary deployments: traffic splitting strategies, automated promotion, rollback triggers, and safely rolling out new versions to a subset of users.

intermediate

Feature Flags: Progressive Release and Safe Experimentation

A practical guide to feature flags: implementation patterns, progressive rollouts, kill switches, A/B testing integration, and managing feature flag lifecycle at scale.

intermediate

Logging, Monitoring & Observability Guide

A guide to building observable systems with structured logging, metrics, and distributed tracing.

intermediate

Observability — Metrics, Logs, and Traces Complete Guide

A practical guide to observability: the three pillars (metrics, logs, traces), implementing with Prometheus, Grafana, Loki, Tempo/Jaeger, and building SLO-driven alerting.

intermediate

Site Reliability Engineering

A practical guide to SRE: defining SLIs, SLOs, and SLAs, managing error budgets, toil reduction, on-call rotations, and building a culture of reliability.

advanced

Complete Guide to Bundle Size Optimization

Reduce JavaScript bundle size. Covers tree shaking, code splitting, dynamic imports, dependency analysis, module federation, lazy loading, compression, polyfill management, and bundle monitoring with practical webpack, Vite, and Rollup examples.

advanced

Complete Guide to React 19 Features

Master React 19 features. Covers server components, use() hook, actions, form actions, useActionState, useOptimistic, useFormStatus, ref as prop, document metadata, asset loading, and React Compiler with practical code examples.

intermediate

Complete Guide to React Performance Optimization

Optimize React apps for speed. Covers memoization, virtualization, code splitting, bundle analysis, React Profiler, concurrent features, and Core Web Vitals.

advanced

Complete Guide to Web Performance and Core Web Vitals

Optimize Core Web Vitals. Covers LCP, INP, CLS measurement and improvement, image optimization, font loading, render-blocking resources, lazy loading, caching strategies, and performance monitoring with practical code examples.

intermediate

Distributed Tracing: End-to-End Request Flow Across

A practical guide to distributed tracing: instrumenting applications, trace propagation, sampling strategies, and diagnosing latency in microservice architectures with OpenTelemetry, Jaeger, and Zipkin.

intermediate

Metrics and Dashboards

A practical guide to metrics and dashboards: instrumenting applications, choosing metric types, building useful dashboards, and creating alerting pipelines with Prometheus, Grafana, and Datadog.

intermediate

Web Performance Optimization Guide

A thorough guide to optimizing web application performance for better Core Web Vitals and user experience.

intermediate

API Rate Limiting — Design Fair and Useful Throttling

A practical guide to API rate limiting: token bucket, leaky bucket, sliding window algorithms, choosing limits, and implementing resilient throttling for APIs.

intermediate

Capacity Planning — Forecast, Scale

A practical guide to capacity planning for cloud and on-premise infrastructure: demand forecasting, load testing, auto-scaling strategies, and avoiding over-provisioning.

intermediate

Cloud Cost Optimization

A practical guide to cloud cost optimization: right-sizing, reserved instances, spot instances, tagging strategies, and FinOps practices that reduce spend while maintaining performance.