source: trunk/misc/operations_helpers/munin/tahoe_estimate_files

Last change on this file was b856238, checked in by Alexandre Detiste <alexandre.detiste@…>, at 2024-02-15T15:53:34Z

remove old Python2 future statements

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#!/usr/bin/env python
2
3
4import sys, os.path
5
6if len(sys.argv) > 1 and sys.argv[1] == "config":
7    print("""\
8graph_title Tahoe File Estimate
9graph_vlabel files
10graph_category tahoe
11graph_info This graph shows the estimated number of files and directories present in the grid
12files.label files
13files.draw LINE2""")
14    sys.exit(0)
15
16# Edit this to point at some subset of storage directories.
17node_dirs = [os.path.expanduser("~amduser/prodnet/storage1"),
18             os.path.expanduser("~amduser/prodnet/storage2"),
19             os.path.expanduser("~amduser/prodnet/storage3"),
20             os.path.expanduser("~amduser/prodnet/storage4"),
21             ]
22
23sections = ["aa", "ab", "ac", "ad", "ae", "af", "ag", "ah", "ai", "aj"]
24# and edit this to reflect your default encoding's "total_shares" value, and
25# the total number of servers.
26N = 10
27num_servers = 20
28
29index_strings = set()
30for base in node_dirs:
31    for section in sections:
32        sampledir = os.path.join(base, "storage", "shares", section)
33        indices = os.listdir(sampledir)
34        index_strings.update(indices)
35unique_strings = len(index_strings)
36
37# the chance that any given file appears on any given server
38chance = 1.0 * N / num_servers
39
40# the chance that the file does *not* appear on the servers that we're
41# examining
42no_chance = (1-chance) ** len(node_dirs)
43
44# if a file has a 25% chance of not appearing in our sample, then we need to
45# raise our estimate by (1.25/1)
46correction = 1+no_chance
47#print "correction", correction
48
49files = unique_strings * (32*32/len(sections)) * correction
50print("files.value %d" % int(files))
Note: See TracBrowser for help on using the repository browser.