-
Notifications
You must be signed in to change notification settings - Fork 4
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
docs: add readme #8
base: main
Are you sure you want to change the base?
Conversation
@maartenbreddels I'm now starting to dig into this. I've been following the instructions in your readme. I got everything setup, but when I get to the following step
|
voila.tpl is from a very old voila, it could be you are using an old template that still uses that. How did you start voila? |
Ahh yeah thanks for the reminder. A |
So after first tests it seems to be working. Testing loading a 3d cube into Jdaviz via If everything checks out the next step will be to get this deployed in our test environment to do some more performance tests. We did some performance tests with the original voila simulating users hitting the voila server and spinning up kernels. (I don't think any notebooks run in these tests). Here are the results from those tests
For example, 1 user submitting 10 requests to the voila server had an average response time of 4 seconds from the voila server. When we scaled that up to 30 users, 10 requests each, the average response time jumped to 130 seconds, and 37% of the responses errored out with a 500 status code. This is with a dockerized Voila setup running 3 server instances. So I'll be interested to see how this this hotpot improvement affects this table. Maybe you have some thoughts on these numbers. Traceback
|
Another thought I had is when I start up Voila I'm seeing the initial spin up of the 3 kernels in the pool. However when I refresh the page with jdaviz loaded via voila-embed, I'm seeing voila initialize new kernels as opposed to using the ones in the pool. Is this the expected behaviour? And if so, are those new kernels also being pre-warmed? My guess is yes since I am seeing faster loading times but I just want to double check. |
This is a module not found, and what you can do is a try/catch around the import, since these come from my environment indeed. You might sometimes see these because voila is connecting to the kernel really early on I think, and it stills 'sees' this exception.
That does not seem right, it should spin up 1 kernel to fill the pool again, and yes, they are pre-warmed. |
Comparing the terminal output and the browser console, it looks like it initially spins up a number of kernels specified in the config (e.g. 3). voila-embed connects to the one of those three kernels initially but also spins up a new kernel and adds it to the pool. On each page refresh, voila-embed connects to a kernel in the pool but also adds a new kernel to the pool, even if it connects to a different kernel. Is there a way to see how many kernels are in the pool at any given moment? For example one page refresh displays this in the dev console
but at the same time you get this in the voila terminal
In this example, when I shutdown voila it shutdown 9 kernels in total, but I can't tell if they all belong in the same pool. |
Currently for production, in our use of |
@havok2063 Normal culling rules should not be used for the pool. There shouldn't really be any cases where the pool grows too large (if you can replicate such a state, that would be a bug). If you change the pool size during run time somehow, there is logic to scale down the current pool here: Lines 92 to 101 in 6d2f573
|
What you describe seems to me to be the intended behavior. If that is not what you would expect, would you mind outlining what you expected, and maybe adding some details about why such a behavior would be preferable? |
@vidartf I apologize as I'm not as familiar with the pooling manager. Is the pool meant to grow indefinitely or stay at a fixed size? In my tests I grew the pool size from 3 kernels to 10 very quickly. Our use case has lots of users navigating to a website which has voila embedded in it. Our biggest worry on our side for production is excessive pool growth, having kernels spun up that linger around for a while taking up system resources. We were using the culling parameters to control how those kernels get killed off. Naively I expected Maybe this behavior is already covered with |
@havok2063 Maybe it would be good to agree on some wording so we do not talk past each other. For me:
With that definition, kernels will go: pool, -> active -> shut down. The number of kernels that are in the pool should not increase over time, but the number of active kernels might (especially if you are not careful about shutting down / culling kernels after they are no longer in use). If you are seeing an increase in the number of kernels in the pool, this is a bug, and we should try to get a way to reproduce it. If you are seeing an increase in the number of active kernels, I would recommend considering:
|
@vidartf Ok, so using the defined language ... we've been using https://github.com/mariobuikhuizen/voila-embed to embed our notebooks into webpages. In the original voila, there are no pooled or active kernels when the server is started. Each site visit activates a new kernel with a one-to-one mapping between the client and the server. Start Voila
Loading the browser page activates a kernel and it displays the following in the browser console Another site visit produces
to check for inactive kernels every minute and cull them if they've been idle for 2 mins. When I switch to using the
Listing the file directory shows 3 kernel JSON files, in the pool.
Now when a user visits the website, we see a discrepancy occur between the client and the server. The browser displays
So I think the browser is activating one of the original kernels in the pool, but it seems like it's also creating a new separate kernel. I don't know if this kernel (2166..) is considered active or simply in the pool, but presumably it is being added to the pool since the browser is actively connecting to a different kernel. The file directory now displays 4 kernel JSON files
A new page visit, or second page refresh does the same thing,
This seems like a bug to me, but I don't know if it's in
You mention in a previous comment that we should not use normal culling rules with the pool. I took this to mean that we should not use the |
Thanks for the details. So when you are connecting to the server with the pool, this happens:
Active kernels should be culled, but the prewarmed kernels in the pool should not (by definition they will be idle until a user connects). Therefore, we have added code to this package so that the culling rules do not apply to the pool, meaning you should use the culling config as normal: hotpot_km/hotpot_km/mapping.py Lines 13 to 15 in 6d2f573
|
@vidartf Thanks for the clarification. That's helpful. I did a quick test where I started a new voila instance with |
And this was with the latest release (0.2.2)? Would you mind capturing the output with |
Ahh no I just checked and was still running |
Is the environment for the pooled kernels hard coded? Somehow the manager/ipykernel tries to execute python from a "test" environment, which has not been configured within this document. |
cc @havok2063
I think it would be good if we explain how to use this package with voila. This example is very much focused on the use case at STScI, for @havok2063 , but at least this is a start.