Last active
January 11, 2022 17:50
-
-
Save dboitnot/4ea1393801ce32a451e059fce05f4365 to your computer and use it in GitHub Desktop.
Simulate packing to size an container cluster
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
#!/usr/bin/env python3 | |
containers = [ | |
3172, # UI Gateway | |
5196, # UI tomcat | |
1224, # Transit UI | |
1224, # Controller | |
1224, # ScribeUI | |
1224, # Applicant API | |
1224, # Composer | |
1224, # API Services | |
] | |
containers = containers * 12 # There will be 12 instances of DW hosted in this cluster. | |
instance_size = 32768 # t2/t3.2xlarge | |
instances = [] | |
def place(n): | |
if n > instance_size: | |
raise ValueError("n greater than instances size") | |
for i in range(len(instances)): | |
if instances[i] >= n: | |
instances[i] = instances[i] - n | |
return | |
instances.append(instance_size - n) | |
for c in containers: | |
place(c) | |
print(instances) | |
print("instance count:", len(instances)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment