Forums

CPU Usage

How can I find out what has been using my cpu time?

You can see it for the running processes in the process list at the bottom of the task and console pages.

Thanks fjl for the pointer. No tasks are currently running and processes listed are

CPU    Time started              Command
===    ============              =======
57.65  2021-03-16 at 18:04:18    /usr/local/bin/python3.5 /usr/bin/jupyterhub-singleuser --user=snyler --port=50431 --cookie-name=jupyter-hub-token-snyler --base  -url=/user/snyler --hub-prefix=/hub/ --hub-api-url=http://127.0.0.1:8081/hub/api --ip=localhost --debug
0      2021-03-16 at 18:04:18    /usr/local/bin/python3.5 /usr/local/bin/sudospawner --logging=debug
18.77  2021-03-16 at 18:04:23    /usr/local/bin/python3.8 -m IPython.kernel -f /home/snyler/.local/share/jupyter/runtime/kernel-65fd3746-1e45-4f44-87d7-5fe10a6cbae9.json
0      2021-03-22 at 10:42:36    sshd: snyler

Which I assume is baseline activity for the account

If possible I would like to see a breakdown of what has used the cpu over the last quota period, currently my cpu usage is showing CPU Usage: 57% used – 1141.36s of 2,000s. Resets in 7 hours, 18 minutes

I can't think of what I have been doing that would have used that much.

I also look after a client account which runs an always on task but does not have that level of cpu usage, would have expected that account to be using more cpu.

If you have Jupyter running, that's probably the culprit -- and while we don't keep detailed CPU time records over time, I can see that all of the current numbers you're seeing are coming from notebooks.

The running processes table only shows the CPU usage for processes that are running right now, but the Jupyter root process (jupyterhub-singleuser) does a heartbeat where it periodically spawns a subprocess that starts up, burns 100% CPU for a second or two, and then exits. So it can wind up using a lot of CPU over time, but that time never shows up in the running processes table.

If you kill those Jupyter processes -- all three of the ones in that table apart from the sshd one -- then that will stop CPU time from being drained.

Thanks Giles, I'll kill those and monitor over the next day or so. Cheers

Sure -- let us know if you find anything confusing!