I’m using python 3.11 + jupyterhub 4.0.2 + jupyterlab 4.0.5 and am currently having a problem with jupyterhub-singleuser consuming constant and high CPU even when the user is not connected to the web console. I am launching it like so via jupyterhub_config.py
CPU usage never goes down? Are you testing this locally on your workstation using LocalProcessSpawner? Do you see anything strange in logs? Could you share them?
How is your JupyterHub deployed? Even if you have logged out of JupyterLab, the backend server keeps running until you terminate the single user server. I was talking about the logs of that single user server.
Thank you for the response. I don’t know where the logs for the single user server are located? I only see the logs for the running of jupyterhub -f jupyterhub_config.py. Here’s my config
In that case your single user server logs will be logged along with JupyterHub logs. In any case, if you dont see anything strange in the logs, I assume it must be down to either polling or PeriodicCallbacks that backend jupyter_server uses. I am not quite sure though but this is my guess!
It looks like jupyter_resource_usage could be the culprit. Try uninstalling it from your singleuser environment and see if that significantly reduces your CPU usage?
Oh my, thank you. I found jupyter-resource-usage=1.0.1 installed via conda-forge. I removed it and now jupyterhub-singleuser appears to be completely idle.
If I am right, that must be Prometheus metrics endpoint that is consuming the CPU. @akrherz Could you try with --ResourceUseDisplay.enable_prometheus_metrics=False in c.Spawner.args?
That seems to be working as well. I reinstalled the extension, set your suggested flag to False and observed no CPU usage. Setting it back to True caused the CPU usage to return.
Not entirely sure, but it’s probably there so the metrics can be collected and displayed somewhere else alongside other metrics, for example in a Grafana dashboard.
Not entirely sure, but it’s probably there so the metrics can be collected and displayed somewhere else alongside other metrics, for example in a Grafana dashboard.
That is what I thought but I do not see this handler registered with any endpoint.