jupyterlab / jupyterlab-desktop

JupyterLab desktop application, based on Electron.
BSD 3-Clause "New" or "Revised" License
3.71k stars 356 forks source link

Number of processes used. #715

Open karlglazebrook opened 1 year ago

karlglazebrook commented 1 year ago

This is not really a bug report, more something to discuss.

I am on MacOS 12.4 (though it does not depend on the version). I can't help but notice that Jupyter-lab-desktop creates an awful lot of background processes! After launch I find 10 processes and then one more for each notebook opened. 7 of them seem to be 'Render' processes that all look similar to the 'ps -auxg' command.

e.g. after opening one notebook the processes look like this.

(base) [Testing] 😀 ps auxgww | grep -i jupyter karl 45733 1.2 1.5 1220500020 253528 ?? S 5:41pm 0:07.31 /Applications/JupyterLab.app/Contents/Frameworks/JupyterLab Helper (Renderer).app/Contents/MacOS/JupyterLab Helper (Renderer) --type=renderer --user-data-dir=/Users/karl/Library/Application Support/jupyterlab-desktop --app-path=/Applications/JupyterLab.app/Contents/Resources/app.asar --enable-sandbox --lang=en-GB --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --renderer-client-id=9 --time-ticks-at-unix-epoch=-1696324385925515 --launch-time-ticks=682121217320 --shared-files --field-trial-handle=1718379636,r,2059750125431768657,1800723019089805542,262144 --disable-features=SpareRendererForSitePerProcess --seatbelt-client=69 karl 45682 0.6 0.2 35283704 40536 ?? S 5:41pm 0:00.42 /Applications/JupyterLab.app/Contents/Frameworks/JupyterLab Helper.app/Contents/MacOS/JupyterLab Helper --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-GB --service-sandbox-type=network --user-data-dir=/Users/karl/Library/Application Support/jupyterlab-desktop --shared-files --field-trial-handle=1718379636,r,2059750125431768657,1800723019089805542,262144 --disable-features=SpareRendererForSitePerProcess --seatbelt-client=38 karl 45714 0.4 1.1 35472268 183380 ?? S 5:41pm 0:03.33 python -m jupyterlab --no-browser --expose-app-in-browser --ServerApp.port=61009 --ServerApp.password= --ServerApp.token=jlab:srvr:b1134e1bb0654115c2c9f0f675c85bb42022f5 --LabApp.quit_button=False --JupyterApp.config_file_name= --ContentsManager.allow_hidden=True karl 45669 0.4 1.9 1212796576 325896 ?? S 5:41pm 0:04.79 /Applications/JupyterLab.app/Contents/MacOS/JupyterLab karl 45755 0.0 0.0 408628368 1648 s000 S+ 5:42pm 0:00.00 grep -i jupyter karl 45738 0.0 0.3 34577348 50016 ?? Ss 5:41pm 0:00.37 /Users/karl/anaconda3/bin/python -m ipykernel_launcher -f /Users/karl/Library/Jupyter/runtime/kernel-b99d5953-7835-442f-a6ce-db795e9d6037.json karl 45728 0.0 1.0 1220350552 167460 ?? S 5:41pm 0:01.50 /Applications/JupyterLab.app/Contents/Frameworks/JupyterLab Helper (Renderer).app/Contents/MacOS/JupyterLab Helper (Renderer) --type=renderer --user-data-dir=/Users/karl/Library/Application Support/jupyterlab-desktop --app-path=/Applications/JupyterLab.app/Contents/Resources/app.asar --enable-sandbox --lang=en-GB --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --renderer-client-id=8 --time-ticks-at-unix-epoch=-1696324385925515 --launch-time-ticks=682119828463 --shared-files --field-trial-handle=1718379636,r,2059750125431768657,1800723019089805542,262144 --disable-features=SpareRendererForSitePerProcess --seatbelt-client=69 karl 45687 0.0 0.5 1220830888 78780 ?? S 5:41pm 0:00.54 /Applications/JupyterLab.app/Contents/Frameworks/JupyterLab Helper (Renderer).app/Contents/MacOS/JupyterLab Helper (Renderer) --type=renderer --user-data-dir=/Users/karl/Library/Application Support/jupyterlab-desktop --app-path=/Applications/JupyterLab.app/Contents/Resources/app.asar --enable-sandbox --lang=en-GB --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --renderer-client-id=7 --time-ticks-at-unix-epoch=-1696324385925515 --launch-time-ticks=682117769367 --shared-files --field-trial-handle=1718379636,r,2059750125431768657,1800723019089805542,262144 --disable-features=SpareRendererForSitePerProcess --seatbelt-client=54 karl 45686 0.0 0.4 1220691908 73620 ?? S 5:41pm 0:00.50 /Applications/JupyterLab.app/Contents/Frameworks/JupyterLab Helper (Renderer).app/Contents/MacOS/JupyterLab Helper (Renderer) --type=renderer --user-data-dir=/Users/karl/Library/Application Support/jupyterlab-desktop --app-path=/Applications/JupyterLab.app/Contents/Resources/app.asar --enable-sandbox --lang=en-GB --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --renderer-client-id=6 --time-ticks-at-unix-epoch=-1696324385925515 --launch-time-ticks=682117710597 --shared-files --field-trial-handle=1718379636,r,2059750125431768657,1800723019089805542,262144 --disable-features=SpareRendererForSitePerProcess --seatbelt-client=54 karl 45685 0.0 1.0 1220832924 161264 ?? S 5:41pm 0:01.97 /Applications/JupyterLab.app/Contents/Frameworks/JupyterLab Helper (Renderer).app/Contents/MacOS/JupyterLab Helper (Renderer) --type=renderer --user-data-dir=/Users/karl/Library/Application Support/jupyterlab-desktop --app-path=/Applications/JupyterLab.app/Contents/Resources/app.asar --enable-sandbox --first-renderer-process --lang=en-GB --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --renderer-client-id=5 --time-ticks-at-unix-epoch=-1696324385925515 --launch-time-ticks=682117515316 --shared-files --field-trial-handle=1718379636,r,2059750125431768657,1800723019089805542,262144 --disable-features=SpareRendererForSitePerProcess --seatbelt-client=54 karl 45681 0.0 0.4 35598384 61708 ?? S 5:41pm 0:02.00 /Applications/JupyterLab.app/Contents/Frameworks/JupyterLab Helper (GPU).app/Contents/MacOS/JupyterLab Helper (GPU) --type=gpu-process --user-data-dir=/Users/karl/Library/Application Support/jupyterlab-desktop --gpu-preferences=WAAAAAAAAAAgAAAEAAAAAAAAAAAAAAAAAABgAAAAAAA4AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAcAAAAAAABoBwAAAAAAAHgCAABOAAAAcAIAAAAAAAB4AgAAAAAAAIACAAAAAA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OAAAAEAAAAAAAAAAIAAAADwAAABAAAAAAAAAACAAAABAAAAAQAAAAAAAAAAoAAAAAAAAAEAAAAAAAAAAKAAAAAQAAABAAAAAAAAAACgAAAAIAAAAQAAAAAAAAAAoAAAADAAAAEAAAAAAAAAAKAAAABgAAABAAAAAAAAAACgAAAAcAAAAQAAAAAAAAAAoAAAAIAAAAEAAAAAAAAAAKAAAACQAAABAAAAAAAAAACgAAAAsAAAAQAAAAAAAAAAoAAAAMAAAAEAAAAAAAAAAKAAAADgAAABAAAAAAAAAACgAAAA8AAAAQAAAAAAAAAAoAAAAQAAAACAAAAAAAAAAIAAAAAAAAAA== --shared-files --field-trial-handle=1718379636,r,2059750125431768657,1800723019089805542,262144 --disable-features=SpareRendererForSitePerProcess --seatbelt-client=38

In comparison running a regular command line 'jupyter lab' creates only one process and then one more for each notebook opened.

Just curious is this by design, a 'feature' of using Electron or actually a bug? (e.g. duplicate processes)

JasonWeill commented 1 year ago

@mbektas Thoughts about the process count associated with JupyterLab Desktop? Anything that we can do about this?

mbektas commented 12 months ago

@karlglazebrook thanks for bringing this up. it is expected to have multiple processes run as part of JupyterLab Desktop launch. It is due to electron.js usage as you guessed and it uses chromium browser which can create these processes for the webviews. Desktop app has some hidden views (e.g. Python environment selector) for better UI performance, those would require separate processes as well. Important thing here is that once you close the application, all those processes should properly terminate.

karlglazebrook commented 11 months ago

No worries. The thing I noticed is that there were way more processes than vanilla ‘jupyter-lab running in Chrome browser’ and I expect this is also causing the significantly longer startup time I notice.

Does this make sense, i.e. is expected from electron?

Karl

On 30 Oct 2023, at 11:02 am, Mehmet Bektas @.***> wrote:

@karlglazebrook https://github.com/karlglazebrook thanks for bringing this up. it is expected to have multiple processes run as part of JupyterLab Desktop launch. It is due to electron.js usage as you guessed and it uses chromium browser which can create these processes for the webviews. Desktop app has some hidden views (e.g. Python environment selector) for better UI performance, those would require separate processes as well. Important thing here is that once you close the application, all those processes should properly terminate.

— Reply to this email directly, view it on GitHub https://github.com/jupyterlab/jupyterlab-desktop/issues/715#issuecomment-1784281876, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADU7FGQUXCHP5X4N4TIDFWDYB3VANAVCNFSM6AAAAAA53OZBXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGI4DCOBXGY. You are receiving this because you were mentioned.

xgdgsc commented 10 months ago

How hard is it to provide a version that uses something like https://github.com/webview/webview instead of electron to minimize memory and disk usage?

mbektas commented 10 months ago

@karlglazebrook yes, this is expected to have in our configuration of Electron app. @xgdgsc it would be major work to migrate from Electron to webview project.

karlglazebrook commented 9 months ago

I am still wondering the reason it needs so many processes?