jupyter-resource-usage icon indicating copy to clipboard operation
jupyter-resource-usage copied to clipboard

Switching user in jupyter makes /api/metrics slowly

Open zenglw06 opened this issue 3 years ago • 3 comments

When I add some users in jupyter, constantly switching users makes the response of /api/metrics slowly.

Suppose there are two users root and jov, I try the following command,

#  default user is jov, now switch to root
sudo su 

# switch to jov
su jov

# switch to root
sudo su
# switch to jov
su jov
...

before switching users, the response time of /api/metrics is 300ms After switching uses, the response time of /api/metrics is 1600ms.

This is too weird

zenglw06 avatar May 07 '21 11:05 zenglw06

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar May 07 '21 11:05 welcome[bot]

Supplementary note

If i try 'exit' command in the terminal, the response time of /api/merics return to normal level

zenglw06 avatar May 07 '21 11:05 zenglw06

The response time is mainly influenced by the time the following get-function takes:
https://github.com/jupyter-server/jupyter-resource-usage/blob/master/jupyter_resource_usage/api.py#L20

I would assume the time the psutil-calls answer are different depending on how many processes/users are active on the system. This seems not to be an issue of jupyter-resource-usage.

jhgoebbert avatar Jul 20 '22 09:07 jhgoebbert