Skip to content

Commit 5b1102c

Browse files
committed
add overbook factor
1 parent cdb051c commit 5b1102c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

webapp/app.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ def check_memory():
111111
memory limit amount, you have to consider it like a check written to your
112112
account, you never know when it may be cashed.
113113
"""
114-
remaining_budget = initial_memory_budget - len(docker_client.containers()) * CONTAINER_MEM_LIMIT
114+
# the overbook factor says that each container is unlikely to be using its
115+
# full memory limit, and so this is a guestimate of how much you can overbook
116+
# your memory
117+
overbook_factor = .8
118+
remaining_budget = initial_memory_budget - len(docker_client.containers()) * CONTAINER_MEM_LIMIT * overbook_factor
115119
if remaining_budget < MEM_MIN:
116120
raise ContainerException("Sorry, not enough free memory to start your container")
117121

0 commit comments

Comments
 (0)