Skip to content
StackPractices

Tag: performance

Browse 81 practical software engineering resources tagged with "performance". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving performance.

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

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

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

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

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

Batch Processing Patterns

Design reliable batch processing pipelines for large datasets with retry logic, idempotency, and observability.

High-Performance DataFrame Operations with Polars

How to use Polars for fast DataFrame operations with lazy evaluation, expression API, streaming, and interop with pandas for large datasets.

UUID Generation: v4, v7, and ULID Comparison

Compare UUID v4, v7, ULID, and nanoid for generating unique identifiers with different tradeoffs in randomness, sortability, performance, and database index locality

Database Connection Pooling

Configure and tune database connection pools to maximize throughput while preventing connection exhaustion.

Database Replication

Set up and manage database replication for high availability, read scaling, and disaster recovery with primary-replica architectures.

Node.js Caching with Redis: Cache-Aside and TTL Patterns

Cache API responses in Node.js with Redis using cache-aside and TTL patterns

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

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

Analyze and Optimize SQL Indexes with EXPLAIN

Identify missing, unused, and inefficient indexes by reading execution plans and measuring query cost with EXPLAIN.

Partition Large Tables by Date or Range

Split huge SQL tables into smaller partitions by date, range, or list to improve query performance and maintenance.

Bash Parallel Execution

How to run shell commands in parallel with xargs, GNU parallel, and Bash background jobs while controlling concurrency and collecting results.

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.

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.

JavaScript Event Loop

Understand how the JavaScript event loop works internally and how to write non-blocking code.

When to Use useMemo and useCallback

How and when to use React's useMemo and useCallback hooks for performance optimization, and when they add unnecessary overhead.

Virtualize Long Lists with react-window

How to render large lists efficiently in React using react-window for DOM virtualization, including fixed and variable height rows and grid layouts.

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

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

Real User Monitoring

Monitor actual user experiences with Core Web Vitals, session replay, and performance analytics to identify real-world bottlenecks.

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

Implement Cache Invalidation Strategies

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

Caching Strategies

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

Implement CDN Edge Caching

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

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

Optimize Queries with Database Indexing

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

Debounce and Throttle

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

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.

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

Optimize Slow Database Queries

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

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

Web Performance Optimization

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

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

Reduce AWS Lambda Cold Start with Provisioned Concurrency

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

Cache-Aside Pattern

Load data into the cache on demand from the backing store. A caching pattern that gives the application full control over what and when to cache.

Content Delivery Network (CDN) Pattern

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

Eager Loading Pattern

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

Entity-Component-System (ECS) Pattern

Compose entities from pure data components and process them with systems, enabling high-performance and flexible game object architecture without deep inheritance.

Materialized View Pattern

Precompute and store expensive query results in a read-optimized cache to avoid repeated costly aggregation or joins across large datasets.

Object Pool Pattern

Reuse expensive objects instead of creating and destroying them repeatedly. A creational pattern for managing scarce resources efficiently.

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

Read-Through Cache Pattern

A transparent cache layer that intercepts read requests, fetches from the data source on miss, and populates the cache automatically.

Refresh-Ahead Cache Pattern

Proactively refresh cache entries before they expire to eliminate cache misses on hot keys and maintain consistent read latency.

Serverless Warm Pool Pattern

Keep Lambda functions warm by sending periodic ping events to reduce cold start latency for latency-sensitive workloads.

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.

Two-Level Cache Pattern

Combine an L1 in-memory cache with an L2 distributed cache to reduce latency for hot keys while maintaining cache consistency across instances.

Write-Behind Cache Pattern

Write to cache synchronously and persist to the database asynchronously for high-throughput write workloads with eventual consistency.

Write-Through Cache Pattern

Synchronously write to both cache and backing store so the cache always has the latest data without TTL-based invalidation.

Islands Architecture

How to ship interactivity only where needed using islands architecture. Covers Astro islands, partial hydration, React islands, and performance benefits.

API Rate Limiting Policy Template

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

API Performance Budget Template

A template for setting and tracking API latency and throughput performance budgets.

CDN Cache Rules Template

Template for defining CDN caching rules and edge behavior: cache keys, TTL by content type, query parameter handling, header forwarding, purge strategies, and origin shield configuration with code examples.

Thread Pool Sizing Template

Template for documenting thread pool configuration per service: pool type selection, sizing formulas, CPU vs I/O bound tuning, queue strategies, rejection policies, monitoring metrics, and tuning examples for Java, Python, Go, and Node.js.

Capacity Planning Forecast Template

A structured template for forecasting infrastructure growth, identifying resource bottlenecks, and planning capacity before traffic surges cause outages.

Load Test Execution Plan Template

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

Performance Regression Template

A template for comparing benchmarks and creating action plans when performance degrades.

Weekly Ops Review Template

A template for summarizing incidents, costs, performance, and action items in weekly operations reviews.

Frontend Performance Budget Template

A template for defining JS, CSS, image, and font budgets per route with enforcement strategies and monitoring thresholds.

GraphQL Schema Review Checklist

Checklist for reviewing GraphQL schemas: naming conventions, type design, pagination, error handling, security, performance, deprecation, and federation readiness with code examples and validation rules.

Serverless Cold Start Runbook

Runbook for diagnosing and mitigating serverless cold starts: causes, measurement, optimization strategies (provisioned concurrency, warmers, initialization tuning), and monitoring with code examples for AWS Lambda, Azure, and GCP.

Capacity Planning Template

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

Load Test Report Template

A standardized template for documenting load test results and recommendations.

GraphQL vs REST — When to Choose and How to Migrate

A decision guide comparing GraphQL and REST APIs: use cases, performance, caching, tooling, and migration strategies for engineering teams.

gRPC in Microservices — High-Performance RPC Guide

A practical guide to gRPC for microservices: Protocol Buffers, streaming, load balancing, and migration from REST for high-performance RPC.

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.

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.

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.

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.

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.

Complete Guide to PostgreSQL Tuning

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

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.

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.

Logging, Monitoring & Observability Guide

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

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.

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.

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.

Web Performance Optimization Guide

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