Skip to content

Vertical scaling

Course: Horizontal and vertical scaling, Indexes in DBs - chapter 2

Vertical scaling means increasing the size of your machine to support more load

Let’s run an infinite loop in a JS project and see how our CPU is used

let c = 0;
while (1) {
c++;
}

This confirms that only a single core of the machine is being used. We got 3 different processes using 100% CPU each.

use std::thread;
fn main() {
// Spawn three threads
for _ in 0..3 {
thread::spawn(|| {
let mut counter: f64 = 0.00;
loop {
counter += 0.001;
}
});
}
loop {
// Main thread does nothing but keep the program alive
}
}