loading...

re: What happens to MySQL when hitting 100% CPU usage? VIEW POST

FULL DISCUSSION
 

Hey Ben, how did that end?

It was not necessarily a bad thing, you didn't specify the scope of these 5 queries. Maybe you were inserting millions of row on dozens of columns or just a few rows with a few columns.

You could have connected to the server and try to query it to see what was going on in the meantime.

 

Each query inserts around 250000 rows or updates them, about 20 columns.

I saw the process list and the server was running fine, what I’m asking is why when the CPU was at 100% was it able to still serve requests ?

 

what I’m asking is why when the CPU was at 100% was it able to still serve requests ?

A combination of OS multi tasking, multi core and MySQL multi threading.

I'm not sure what sort of machines MySQL RDS runs on but is probably running on a Linux distribution which supports multiple threads running on a multi core CPU. This means that you effectively have N CPUs used by various threads. I'm not familiar with MySQL's architecture but I guess each connection is assigned a thread in a pool.

Even if you have a single CPU core each connection is handled by a separate unit of work (the thread), scheduled with a time slice by the kernel scheduler.

100% doesn't mean that your CPU is effectively disabled, it means that the computations inside that process are using 100% of the CPU allotted in a single scheduling period.

Most requests are I/O bound, so they don't bother the CPU much.

There are ways to overwhelm a database but if it can't handle 4 simultaneous inserts, then it's a toy DB :D

code of conduct - report abuse