CPU > 80% - how can I debug?
I am running a laravel application on a Ubuntu 14.04 digital ocean vps and I am using New Relic to monitor the server.
I got an email alert that my CPU usage was above 80%. I logged in to New Relic and now it's showing my CPU usage at 99% for 18 hours now. But when I log into my shell and run 'top' the CPU usage of the processes don't even sum up to 10%.
What could be wrong? Which are other commands I could run to check the real usage and what is using it so much? (Perhaps an infinite loop on the application?)
This is my htop result:
And this is htop after shift+K
Any links or help would be greatly appreciated.
performance cpu
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am running a laravel application on a Ubuntu 14.04 digital ocean vps and I am using New Relic to monitor the server.
I got an email alert that my CPU usage was above 80%. I logged in to New Relic and now it's showing my CPU usage at 99% for 18 hours now. But when I log into my shell and run 'top' the CPU usage of the processes don't even sum up to 10%.
What could be wrong? Which are other commands I could run to check the real usage and what is using it so much? (Perhaps an infinite loop on the application?)
This is my htop result:
And this is htop after shift+K
Any links or help would be greatly appreciated.
performance cpu
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
My first question is: What properly written PHP process has a run-duration of 1h24 minutes?
– Otheus
Nov 6 '15 at 19:31
Maybe Otheus's attitude would make sense if we were in the 90's, but 'Why are you using PHP for that' this is totally not the way to respond to a unix system admin question
– karimkorun
Jul 16 '18 at 13:44
add a comment |
I am running a laravel application on a Ubuntu 14.04 digital ocean vps and I am using New Relic to monitor the server.
I got an email alert that my CPU usage was above 80%. I logged in to New Relic and now it's showing my CPU usage at 99% for 18 hours now. But when I log into my shell and run 'top' the CPU usage of the processes don't even sum up to 10%.
What could be wrong? Which are other commands I could run to check the real usage and what is using it so much? (Perhaps an infinite loop on the application?)
This is my htop result:
And this is htop after shift+K
Any links or help would be greatly appreciated.
performance cpu
I am running a laravel application on a Ubuntu 14.04 digital ocean vps and I am using New Relic to monitor the server.
I got an email alert that my CPU usage was above 80%. I logged in to New Relic and now it's showing my CPU usage at 99% for 18 hours now. But when I log into my shell and run 'top' the CPU usage of the processes don't even sum up to 10%.
What could be wrong? Which are other commands I could run to check the real usage and what is using it so much? (Perhaps an infinite loop on the application?)
This is my htop result:
And this is htop after shift+K
Any links or help would be greatly appreciated.
performance cpu
performance cpu
edited Nov 6 '15 at 19:11
asked Nov 6 '15 at 17:12
raphadko
1186
1186
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
My first question is: What properly written PHP process has a run-duration of 1h24 minutes?
– Otheus
Nov 6 '15 at 19:31
Maybe Otheus's attitude would make sense if we were in the 90's, but 'Why are you using PHP for that' this is totally not the way to respond to a unix system admin question
– karimkorun
Jul 16 '18 at 13:44
add a comment |
1
My first question is: What properly written PHP process has a run-duration of 1h24 minutes?
– Otheus
Nov 6 '15 at 19:31
Maybe Otheus's attitude would make sense if we were in the 90's, but 'Why are you using PHP for that' this is totally not the way to respond to a unix system admin question
– karimkorun
Jul 16 '18 at 13:44
1
1
My first question is: What properly written PHP process has a run-duration of 1h24 minutes?
– Otheus
Nov 6 '15 at 19:31
My first question is: What properly written PHP process has a run-duration of 1h24 minutes?
– Otheus
Nov 6 '15 at 19:31
Maybe Otheus's attitude would make sense if we were in the 90's, but 'Why are you using PHP for that' this is totally not the way to respond to a unix system admin question
– karimkorun
Jul 16 '18 at 13:44
Maybe Otheus's attitude would make sense if we were in the 90's, but 'Why are you using PHP for that' this is totally not the way to respond to a unix system admin question
– karimkorun
Jul 16 '18 at 13:44
add a comment |
3 Answers
3
active
oldest
votes
I had a similar problem and I did run TOP command in background and redirect it to a txt file
top > top.txt &
Thank you can see which process waste your CPU
add a comment |
There are a few options. My preference is the program htop
which isn't generally installed by default but is available for almost all distros. It gives you the same info as top
but with a MUCH richer feature set. It's great for interactively finding the problem process but it's not great for scripting. If you want to incorporate something into a monitoring script the command ps -eo pid,pcpu,comm
will be your friend. It prints all of the current processes along with their PID and CPU usage in a fairly easy-to-parse format.
htop shows the same as top, the sum of all usage is about 9%. the other command ps... shows everything at 0.0, some at 0.2
– raphadko
Nov 6 '15 at 17:41
What is the load average on the server (it's shown in the top right corner ofhtop
)?
– David King
Nov 6 '15 at 17:54
1.22, 1.30, 1.31
– raphadko
Nov 6 '15 at 18:10
and CPU that show on top of htop, shows 100%
– raphadko
Nov 6 '15 at 18:10
edited the question with more information
– raphadko
Nov 6 '15 at 18:22
|
show 3 more comments
I'm not sure what's going on, but my guess is that the individual process's %CPU column isn't telling you what you think it tells you. From top's manpage:
k: %CPU -- CPU usage
The task’s share of the elapsed CPU time since the last screen update,
expressed as a percentage of total CPU time.
Let's say you're refreshing every 4 seconds. The total CPU time it consumed in those 2 seconds is 6% over those 4 seconds. But let's say in one of those seconds, it spurted and used 24% of CPU time. I'm not saying this is happening, but it could be.
I am happy with top
here. I can see CPU usage broken down by CPU and further by user
, sys
, nice
, idle
, wait
(on I/O), servicing hardware and software interrupts (hi, si). You can probably get this in htop
as well. As long as you have 1 CPU that is at least 20% idle, there's little to actually worry about, unless your fan is bothering you. But if you're worried, maybe what's happening is %wait and %hi/%si are very high, in which case no individual process is having a high CPU usage, but rather, the kernel is very very busy for some reason.
You can get detailed cpu time inhtop
via the setup menu but idle is never included in cpu usage stats. If the cpu was 20% idle that would show up inhtop
even without detailed stats
– David King
Nov 6 '15 at 21:14
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f241309%2fcpu-80-how-can-i-debug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I had a similar problem and I did run TOP command in background and redirect it to a txt file
top > top.txt &
Thank you can see which process waste your CPU
add a comment |
I had a similar problem and I did run TOP command in background and redirect it to a txt file
top > top.txt &
Thank you can see which process waste your CPU
add a comment |
I had a similar problem and I did run TOP command in background and redirect it to a txt file
top > top.txt &
Thank you can see which process waste your CPU
I had a similar problem and I did run TOP command in background and redirect it to a txt file
top > top.txt &
Thank you can see which process waste your CPU
answered Nov 6 '15 at 17:24
Federi
45321229
45321229
add a comment |
add a comment |
There are a few options. My preference is the program htop
which isn't generally installed by default but is available for almost all distros. It gives you the same info as top
but with a MUCH richer feature set. It's great for interactively finding the problem process but it's not great for scripting. If you want to incorporate something into a monitoring script the command ps -eo pid,pcpu,comm
will be your friend. It prints all of the current processes along with their PID and CPU usage in a fairly easy-to-parse format.
htop shows the same as top, the sum of all usage is about 9%. the other command ps... shows everything at 0.0, some at 0.2
– raphadko
Nov 6 '15 at 17:41
What is the load average on the server (it's shown in the top right corner ofhtop
)?
– David King
Nov 6 '15 at 17:54
1.22, 1.30, 1.31
– raphadko
Nov 6 '15 at 18:10
and CPU that show on top of htop, shows 100%
– raphadko
Nov 6 '15 at 18:10
edited the question with more information
– raphadko
Nov 6 '15 at 18:22
|
show 3 more comments
There are a few options. My preference is the program htop
which isn't generally installed by default but is available for almost all distros. It gives you the same info as top
but with a MUCH richer feature set. It's great for interactively finding the problem process but it's not great for scripting. If you want to incorporate something into a monitoring script the command ps -eo pid,pcpu,comm
will be your friend. It prints all of the current processes along with their PID and CPU usage in a fairly easy-to-parse format.
htop shows the same as top, the sum of all usage is about 9%. the other command ps... shows everything at 0.0, some at 0.2
– raphadko
Nov 6 '15 at 17:41
What is the load average on the server (it's shown in the top right corner ofhtop
)?
– David King
Nov 6 '15 at 17:54
1.22, 1.30, 1.31
– raphadko
Nov 6 '15 at 18:10
and CPU that show on top of htop, shows 100%
– raphadko
Nov 6 '15 at 18:10
edited the question with more information
– raphadko
Nov 6 '15 at 18:22
|
show 3 more comments
There are a few options. My preference is the program htop
which isn't generally installed by default but is available for almost all distros. It gives you the same info as top
but with a MUCH richer feature set. It's great for interactively finding the problem process but it's not great for scripting. If you want to incorporate something into a monitoring script the command ps -eo pid,pcpu,comm
will be your friend. It prints all of the current processes along with their PID and CPU usage in a fairly easy-to-parse format.
There are a few options. My preference is the program htop
which isn't generally installed by default but is available for almost all distros. It gives you the same info as top
but with a MUCH richer feature set. It's great for interactively finding the problem process but it's not great for scripting. If you want to incorporate something into a monitoring script the command ps -eo pid,pcpu,comm
will be your friend. It prints all of the current processes along with their PID and CPU usage in a fairly easy-to-parse format.
answered Nov 6 '15 at 17:38
David King
2,818421
2,818421
htop shows the same as top, the sum of all usage is about 9%. the other command ps... shows everything at 0.0, some at 0.2
– raphadko
Nov 6 '15 at 17:41
What is the load average on the server (it's shown in the top right corner ofhtop
)?
– David King
Nov 6 '15 at 17:54
1.22, 1.30, 1.31
– raphadko
Nov 6 '15 at 18:10
and CPU that show on top of htop, shows 100%
– raphadko
Nov 6 '15 at 18:10
edited the question with more information
– raphadko
Nov 6 '15 at 18:22
|
show 3 more comments
htop shows the same as top, the sum of all usage is about 9%. the other command ps... shows everything at 0.0, some at 0.2
– raphadko
Nov 6 '15 at 17:41
What is the load average on the server (it's shown in the top right corner ofhtop
)?
– David King
Nov 6 '15 at 17:54
1.22, 1.30, 1.31
– raphadko
Nov 6 '15 at 18:10
and CPU that show on top of htop, shows 100%
– raphadko
Nov 6 '15 at 18:10
edited the question with more information
– raphadko
Nov 6 '15 at 18:22
htop shows the same as top, the sum of all usage is about 9%. the other command ps... shows everything at 0.0, some at 0.2
– raphadko
Nov 6 '15 at 17:41
htop shows the same as top, the sum of all usage is about 9%. the other command ps... shows everything at 0.0, some at 0.2
– raphadko
Nov 6 '15 at 17:41
What is the load average on the server (it's shown in the top right corner of
htop
)?– David King
Nov 6 '15 at 17:54
What is the load average on the server (it's shown in the top right corner of
htop
)?– David King
Nov 6 '15 at 17:54
1.22, 1.30, 1.31
– raphadko
Nov 6 '15 at 18:10
1.22, 1.30, 1.31
– raphadko
Nov 6 '15 at 18:10
and CPU that show on top of htop, shows 100%
– raphadko
Nov 6 '15 at 18:10
and CPU that show on top of htop, shows 100%
– raphadko
Nov 6 '15 at 18:10
edited the question with more information
– raphadko
Nov 6 '15 at 18:22
edited the question with more information
– raphadko
Nov 6 '15 at 18:22
|
show 3 more comments
I'm not sure what's going on, but my guess is that the individual process's %CPU column isn't telling you what you think it tells you. From top's manpage:
k: %CPU -- CPU usage
The task’s share of the elapsed CPU time since the last screen update,
expressed as a percentage of total CPU time.
Let's say you're refreshing every 4 seconds. The total CPU time it consumed in those 2 seconds is 6% over those 4 seconds. But let's say in one of those seconds, it spurted and used 24% of CPU time. I'm not saying this is happening, but it could be.
I am happy with top
here. I can see CPU usage broken down by CPU and further by user
, sys
, nice
, idle
, wait
(on I/O), servicing hardware and software interrupts (hi, si). You can probably get this in htop
as well. As long as you have 1 CPU that is at least 20% idle, there's little to actually worry about, unless your fan is bothering you. But if you're worried, maybe what's happening is %wait and %hi/%si are very high, in which case no individual process is having a high CPU usage, but rather, the kernel is very very busy for some reason.
You can get detailed cpu time inhtop
via the setup menu but idle is never included in cpu usage stats. If the cpu was 20% idle that would show up inhtop
even without detailed stats
– David King
Nov 6 '15 at 21:14
add a comment |
I'm not sure what's going on, but my guess is that the individual process's %CPU column isn't telling you what you think it tells you. From top's manpage:
k: %CPU -- CPU usage
The task’s share of the elapsed CPU time since the last screen update,
expressed as a percentage of total CPU time.
Let's say you're refreshing every 4 seconds. The total CPU time it consumed in those 2 seconds is 6% over those 4 seconds. But let's say in one of those seconds, it spurted and used 24% of CPU time. I'm not saying this is happening, but it could be.
I am happy with top
here. I can see CPU usage broken down by CPU and further by user
, sys
, nice
, idle
, wait
(on I/O), servicing hardware and software interrupts (hi, si). You can probably get this in htop
as well. As long as you have 1 CPU that is at least 20% idle, there's little to actually worry about, unless your fan is bothering you. But if you're worried, maybe what's happening is %wait and %hi/%si are very high, in which case no individual process is having a high CPU usage, but rather, the kernel is very very busy for some reason.
You can get detailed cpu time inhtop
via the setup menu but idle is never included in cpu usage stats. If the cpu was 20% idle that would show up inhtop
even without detailed stats
– David King
Nov 6 '15 at 21:14
add a comment |
I'm not sure what's going on, but my guess is that the individual process's %CPU column isn't telling you what you think it tells you. From top's manpage:
k: %CPU -- CPU usage
The task’s share of the elapsed CPU time since the last screen update,
expressed as a percentage of total CPU time.
Let's say you're refreshing every 4 seconds. The total CPU time it consumed in those 2 seconds is 6% over those 4 seconds. But let's say in one of those seconds, it spurted and used 24% of CPU time. I'm not saying this is happening, but it could be.
I am happy with top
here. I can see CPU usage broken down by CPU and further by user
, sys
, nice
, idle
, wait
(on I/O), servicing hardware and software interrupts (hi, si). You can probably get this in htop
as well. As long as you have 1 CPU that is at least 20% idle, there's little to actually worry about, unless your fan is bothering you. But if you're worried, maybe what's happening is %wait and %hi/%si are very high, in which case no individual process is having a high CPU usage, but rather, the kernel is very very busy for some reason.
I'm not sure what's going on, but my guess is that the individual process's %CPU column isn't telling you what you think it tells you. From top's manpage:
k: %CPU -- CPU usage
The task’s share of the elapsed CPU time since the last screen update,
expressed as a percentage of total CPU time.
Let's say you're refreshing every 4 seconds. The total CPU time it consumed in those 2 seconds is 6% over those 4 seconds. But let's say in one of those seconds, it spurted and used 24% of CPU time. I'm not saying this is happening, but it could be.
I am happy with top
here. I can see CPU usage broken down by CPU and further by user
, sys
, nice
, idle
, wait
(on I/O), servicing hardware and software interrupts (hi, si). You can probably get this in htop
as well. As long as you have 1 CPU that is at least 20% idle, there's little to actually worry about, unless your fan is bothering you. But if you're worried, maybe what's happening is %wait and %hi/%si are very high, in which case no individual process is having a high CPU usage, but rather, the kernel is very very busy for some reason.
answered Nov 6 '15 at 19:44
Otheus
3,364931
3,364931
You can get detailed cpu time inhtop
via the setup menu but idle is never included in cpu usage stats. If the cpu was 20% idle that would show up inhtop
even without detailed stats
– David King
Nov 6 '15 at 21:14
add a comment |
You can get detailed cpu time inhtop
via the setup menu but idle is never included in cpu usage stats. If the cpu was 20% idle that would show up inhtop
even without detailed stats
– David King
Nov 6 '15 at 21:14
You can get detailed cpu time in
htop
via the setup menu but idle is never included in cpu usage stats. If the cpu was 20% idle that would show up in htop
even without detailed stats– David King
Nov 6 '15 at 21:14
You can get detailed cpu time in
htop
via the setup menu but idle is never included in cpu usage stats. If the cpu was 20% idle that would show up in htop
even without detailed stats– David King
Nov 6 '15 at 21:14
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f241309%2fcpu-80-how-can-i-debug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
My first question is: What properly written PHP process has a run-duration of 1h24 minutes?
– Otheus
Nov 6 '15 at 19:31
Maybe Otheus's attitude would make sense if we were in the 90's, but 'Why are you using PHP for that' this is totally not the way to respond to a unix system admin question
– karimkorun
Jul 16 '18 at 13:44