Last active
February 20, 2020 15:05
-
-
Save kolotaev/eb702bec19863e12741e42101b8d6c6e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import gzip | |
import sys | |
s = """ | |
aaaa | |
""" | |
se = s.encode("utf8") | |
sez = gzip.compress(se) | |
raw_size = len(se) | |
zipped_size = len(sez) | |
print('raw: ', raw_size / 1000, ' kB') | |
print('gzipped: ', zipped_size / 1000, ' kB') | |
rps = int(sys.argv[1]) if len(sys.argv) == 2 else 100 | |
seconds_in_month = 60 * 60 * 24 * 30 | |
rpm = seconds_in_month * rps | |
takes = zipped_size * rpm / 1000000000000 | |
print('gzipped takes %f TB monthly at %i requests per_second rate' % (takes, rps)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment