-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving page load time #380
Comments
Thanks @mlucool for reporting this. Jupyterlab already has a If I'm not mistaken, the way it works currently is:
Also, some plugins request a hard reload on events (e.g. I think the [2, 3] could be fixed by storing the settings requested from the server but not loaded (waiting for the transform() function).
|
@brichet I think this is resolved by the two PR you made, isn't it? |
It's supposed too. |
Closing as resolved |
Problem
As I was debugging jupyter-server/jupyter_server#312, I found that certain lab APIs used for pageload are called many times without caching. This leads to a large increase in pageload time in at least some circumstances, namely if the FS is slow, this doubles my page load time for a bare bones jupyterlab from ~3s to ~6s.
This can be traced to
get_settings
. Using%%time
:With a settings_dir that is fast (SSD), I see:
With my setting_dir on a slower file system (NFS):
Why this matters is this API is called 17 times to load the page leading to up to (401-70)*17=5.6s more time to load the page (this is a max, in practice some settings are faster to load than
schema_name=''
)Digging deeper via pyinsturment, the cause for me is mostly in _get_user_settings:
Surprisingly this is blaming loads, which does not match my mental model, but json5.loads is not known to be fast (and often it is passing in a schema that never changes as its the default and not from userspace).
The fact that there are 17 calls adds a bit more pain as I think there is some HTTP1.1 head of line blocking and/or tornado being single threaded blocking going on which forces this to be serialized.
Creating reproducers here is a bit hard, but adding this here seems to simulate it ok-ish (I'm not sure it's realistic):
Proposed Solution
There are a number of ways to fix this. To squeeze as much performance as we can from this, I propose we:
With this change I suspect in my fast setup we'd save ~1s of the 3s page load time and 5s on my slow setup, which is pretty substantial!
CC @afshin
The text was updated successfully, but these errors were encountered: