DEV Community

Scaling & DB Optimization

Vertical scaling increases a machine's capacity to handle more requests per second. In single-threaded languages like Node.js, vertical scaling primarily boosts memory and storage, not processing power. For computationally intensive tasks in Node.js, cluster modules and worker threads are necessary. Multi-threaded languages like Rust, Go, and Java benefit more from vertical scaling due to their ability to utilize multiple cores. Capacity estimation involves calculating server needs, handling traffic spikes, and meeting service level agreements (SLAs). Auto-scaling groups dynamically adjust server instances based on metrics like CPU usage. Persistent connections, as in chess apps, require careful scaling to manage disconnections during downscaling. Different applications have unique scaling strategies; Replit uses a warm pool, while YouTube employs a queue-based approach. SLAs define performance expectations and availability; calculations determine acceptable downtime. Horizontal scaling adds more instances to handle increased load, often using auto-scaling groups or containerization. Key terminology includes load balancers, AMIs, target groups, launch templates, SSH, and inbound rules. Database indexing speeds up read operations using data structures like B-trees, but slows down writes. Database normalization reduces data redundancy by decomposing tables into various normal forms (1NF, 2NF, 3NF, BCNF, etc.), aiming for 3NF or BCNF to balance efficiency and data integrity.
favicon
dev.to
dev.to
Image for the article: Scaling & DB Optimization
Create attached notes ...