0

I sent an ALTER statement that took a long time and I killed some minutes after and then I noticed that CPU usage is almost 100% (98%, 99%, etc).

The process is still being listed with "Killed" status. Reading some answers here, I understand that a killed process can take a long time because it needs to do some rollbacks.

But I didn't get why the database is still running and responding to the application with almost 100% of CPU usage. There are some kind of prioritization on the database tasks?

Thanks

6
  • Do you only have one CPU core on your server? If it weren't a killed process but instead another process running a query simultaneously (or another application connection), would you still be surprised that those connections didn't block each other?
    – mustaccio
    Aug 15, 2022 at 18:50
  • Thanks for your answer, I have 2 cores, you meant that the 100% CPU usage info on AWS refers to a single CPU? Tks! Aug 15, 2022 at 19:02
  • When you have 2 cpu's in linux, they believe you have 200% available. And you do since 1 cpu can be busy 100% and the other cpu can be busy 100%. Aug 15, 2022 at 21:34
  • When you have the opportunity to use an 8 cpu in linux you could find 800% busy reported. Aug 15, 2022 at 21:35
  • What was the ALTER statement? Which version of MySQL? Both can make a big difference in how to answer your question.
    – Rick James
    Aug 15, 2022 at 23:10

1 Answer 1

-1

You can set below parameter value if you have 2 core cpu :

innodb_thread_concurrency = CPU * 2

Default value is 0, A value of 0 (the default) is interpreted as infinite concurrency (no limit). This variable is intended for performance tuning on high concurrency systems

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.