Created
March 30, 2018 07:29
-
-
Save bvp/e20b88f655d3d36258bce46499cb4be8 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
def humanReadableByteCount(long bytes) { | |
final int unit = 1024 | |
if (bytes < unit) return bytes + " B" | |
int exp = (int) (Math.log(bytes) / Math.log(unit)) | |
String pre = ("KMGTPE").charAt(exp-1) | |
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre) | |
} | |
def objects = 18045181L | |
def objectSize = 1024L | |
def platformMemory = 300 * 1024L * 1024L | |
def nodes = 2 | |
def backups = 1 | |
println "Objects: ${objects}" | |
println "Object size: ${objectSize}" | |
println "Nodes - ${nodes}" | |
println "Backups: ${backups}" | |
println "" | |
// Total number of objects X object size X 2 (one primary and one backup copy for each object): | |
def data1 = objects * objectSize * (backups+1) | |
println "data1 - ${data1} (${humanReadableByteCount(data1)})" | |
// Considering indexes: | |
def indexes = (long)(data1/100)*30 | |
def data2 = data1 + indexes | |
println "data2 - ${data2} (${humanReadableByteCount(data2)})" | |
// Approximate additional memory required by the platform: | |
def data3 = platformMemory * nodes | |
println "data3 - ${data3} (${humanReadableByteCount(data3)})" | |
// Total size: | |
def total = data2 + data3 | |
println "Total cache size in the cluster - ${total} (${humanReadableByteCount(total)})" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment