# Optimization Overview

⚡️ Tags: 📍Performance 📍Overview

# Best practices for code

Best practices for code

  • Use efficient data structures & algorithms
  • Avoid unnessessary code execution
  • Use caching to improve perf
  • Optimize database query
  • Use profiling tools to identify perf bottlenecks

# FE Performance

# Web Optimization

Web

# Web Perf Metrics

Web Perf Metrics

# FE Cheatsheet

FE

  • Compression
  • Selective Rendering
  • Loading sequence
  • Pritority-based loading
  • Pre-fetching
  • Code splitting
  • Tree shaking
  • Dynamic imports

# API Performance

API

# API Latency factors

api latency factors

# Reducing latency methods

latency

  • DB Indexing
    • Create the right indexes
    • Optimize & refactor slow running queries
  • Caching
    • Store frequently accessed data in a cache
    • Minimize costly db lookups
  • Load balancing
    • Distribute requests evenly between servers
    • Use the right LB type & the appropriate algorithm
  • CDN
    • Cache static content near the end-users
    • Reduce geographic distance to reduce latency
  • Async processing
    • Dont block the request flow for running tasks
    • Execute such task in the background
  • Data compression
    • Compress data before sending over network
    • use libs like gZip or zLib

# Latency numbers

Latency numbers

# Database scaling

DB Scaling

# Cloud Cost

# Hidden costs

Hidden costs

# Techniques

Techniques