-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Request idling containers exit when the container limit is reached
We let WebSocket connections keep {stable,beta,nightly} containers running after the execution finishes. These idle containers still count against the enforced container limits even though they aren't doing useful work. This change allows the owner of those idle containers to know that someone else wants their slot and then they can make the containers exit earlier than they otherwise would have. This can be best shown by setting the container limit very low (e.g. 2) and then opening that many plus one more browser tabs (e.g. 3). Before this change, the last tab would need to wait for the idle timeout (defaults to 60 seconds) before they could have a chance to run their code. = Known issues There's a race that can cause containers to spuriously exit, but that should only occur when we are near the cap of containers anyway. More details are in comments. = Future thoughts / limitations One WebSocket connection could have *both* an active container and an idle one (e.g. stable and nightly). This case is not handled, but it may also be comparatively rare. The non-WebSocket endpoints can request other containers to exit, but they won't ever decrement the exit request counter themselves. This means that if you hit the server many times at these endpoints, then future WebSocket connections will exit earlier than they need to. Hopefully this is also comparatively rare.
- Loading branch information
1 parent
6330754
commit 0b70019
Showing
3 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters