What is database query optimization?
Techniques to improve query performance: use indexes, avoid SELECT *, limit result sets, optimize joins, use query execution plans, denormalize when needed, partition large tables.
What is lazy loading?
Lazy loading defers loading resources until they’re needed. Reduces initial load time and resource usage. Used for images, modules, data. Trade-off: potential delay when resource is accessed.
What is prefetching?
Prefetching loads resources before they’re needed based on predictions. Reduces perceived latency. Examples: browser DNS prefetch, link prefetch, data prefetch in applications.
What is connection keep-alive?
Keep-alive reuses TCP connections for multiple requests instead of creating new connections. Reduces overhead of TCP handshakes. Controlled by HTTP headers and timeouts.
What is compression?
Compression reduces data size for transmission and storage. Gzip/Brotli for text, image formats for pictures, video codecs. Trade CPU for bandwidth. Improves transfer speed.
What is content minification?
Minification removes unnecessary characters from code (whitespace, comments) without changing functionality. Reduces file size for JavaScript, CSS, HTML. Improves load times.
What is pagination?
Pagination divides large result sets into smaller pages. Reduces memory usage, improves response time, better UX. Implementation: offset-based (simple) or cursor-based (consistent).
What is database connection pooling?
Maintaining a pool of reusable database connections instead of creating new ones per request. Reduces connection overhead and limits concurrent connections to prevent database overload.
What is asynchronous processing?
Async processing handles operations without blocking. Tasks run in background while main thread continues. Improves responsiveness and throughput. Used for I/O operations, long-running tasks.
What is read-through vs write-through cache?
Read-through: cache automatically loads from DB on miss. Write-through: writes go to cache, then synchronously to DB. Both simplify application code but have different consistency/performance trade-offs.