Ticket #1392: test_get_latencies_upgraded01.darcs.2.patch

File test_get_latencies_upgraded01.darcs.2.patch, 15.7 KB (added by arch_o_median, at 2011-04-26T21:17:36Z)
Line 
1Tue Apr 26 14:59:58 MDT 2011  wilcoxjg@gmail.com
2  * test_storage.py:  test_latencies now expects None in output categories that contain too few samples for the associated percentile to be unambiguously reported.
3
4Tue Apr 26 15:16:41 MDT 2011  wilcoxjg@gmail.com
5  * server.py:  get_latencies now reports percentiles _only_ if there are sufficient observations for the interpretation of the percentile to be unambiguous.
6
7New patches:
8
9[test_storage.py:  test_latencies now expects None in output categories that contain too few samples for the associated percentile to be unambiguously reported.
10wilcoxjg@gmail.com**20110426205958
11 Ignore-this: 2cf1920eb878f97394940584c470f43a
12] {
13hunk ./src/allmydata/test/test_storage.py 1314
14             ss.add_latency("allocate", 1.0 * i)
15         for i in range(1000):
16             ss.add_latency("renew", 1.0 * i)
17+        for i in range(20):
18+            ss.add_latency("write", 1.0 * i)
19         for i in range(10):
20             ss.add_latency("cancel", 2.0 * i)
21         ss.add_latency("get", 5.0)
22hunk ./src/allmydata/test/test_storage.py 1323
23         output = ss.get_latencies()
24 
25         self.failUnlessEqual(sorted(output.keys()),
26-                             sorted(["allocate", "renew", "cancel", "get"]))
27+                             sorted(["allocate", "renew", "cancel", "write", "get"]))
28         self.failUnlessEqual(len(ss.latencies["allocate"]), 1000)
29         self.failUnless(abs(output["allocate"]["mean"] - 9500) < 1, output)
30         self.failUnless(abs(output["allocate"]["01_0_percentile"] - 9010) < 1, output)
31hunk ./src/allmydata/test/test_storage.py 1344
32         self.failUnless(abs(output["renew"]["99_0_percentile"] - 990) < 1, output)
33         self.failUnless(abs(output["renew"]["99_9_percentile"] - 999) < 1, output)
34 
35+        self.failUnlessEqual(len(ss.latencies["write"]), 20)
36+        self.failUnless(abs(output["write"]["mean"] - 9) < 1, output)
37+        self.failUnless(output["write"]["01_0_percentile"] == None, output)
38+        self.failUnless(abs(output["write"]["10_0_percentile"] -  2) < 1, output)
39+        self.failUnless(abs(output["write"]["50_0_percentile"] - 10) < 1, output)
40+        self.failUnless(abs(output["write"]["90_0_percentile"] - 18) < 1, output)
41+        self.failUnless(abs(output["write"]["95_0_percentile"] - 19) < 1, output)
42+        self.failUnless(output["write"]["99_0_percentile"] == None, output)
43+        self.failUnless(output["write"]["99_9_percentile"] == None, output)
44+
45         self.failUnlessEqual(len(ss.latencies["cancel"]), 10)
46         self.failUnless(abs(output["cancel"]["mean"] - 9) < 1, output)
47hunk ./src/allmydata/test/test_storage.py 1356
48-        self.failUnless(abs(output["cancel"]["01_0_percentile"] -  0) < 1, output)
49+        self.failUnless(output["cancel"]["01_0_percentile"] == None, output)
50         self.failUnless(abs(output["cancel"]["10_0_percentile"] -  2) < 1, output)
51         self.failUnless(abs(output["cancel"]["50_0_percentile"] - 10) < 1, output)
52         self.failUnless(abs(output["cancel"]["90_0_percentile"] - 18) < 1, output)
53hunk ./src/allmydata/test/test_storage.py 1360
54-        self.failUnless(abs(output["cancel"]["95_0_percentile"] - 18) < 1, output)
55-        self.failUnless(abs(output["cancel"]["99_0_percentile"] - 18) < 1, output)
56-        self.failUnless(abs(output["cancel"]["99_9_percentile"] - 18) < 1, output)
57+        self.failUnless(output["cancel"]["95_0_percentile"] == None, output)
58+        self.failUnless(output["cancel"]["99_0_percentile"] == None, output)
59+        self.failUnless(output["cancel"]["99_9_percentile"] == None, output)
60 
61         self.failUnlessEqual(len(ss.latencies["get"]), 1)
62hunk ./src/allmydata/test/test_storage.py 1365
63-        self.failUnless(abs(output["get"]["mean"] - 5) < 1, output)
64-        self.failUnless(abs(output["get"]["01_0_percentile"] - 5) < 1, output)
65-        self.failUnless(abs(output["get"]["10_0_percentile"] - 5) < 1, output)
66-        self.failUnless(abs(output["get"]["50_0_percentile"] - 5) < 1, output)
67-        self.failUnless(abs(output["get"]["90_0_percentile"] - 5) < 1, output)
68-        self.failUnless(abs(output["get"]["95_0_percentile"] - 5) < 1, output)
69-        self.failUnless(abs(output["get"]["99_0_percentile"] - 5) < 1, output)
70-        self.failUnless(abs(output["get"]["99_9_percentile"] - 5) < 1, output)
71+        self.failUnless(output["get"]["mean"] == None, output)
72+        self.failUnless(output["get"]["01_0_percentile"] == None, output)
73+        self.failUnless(output["get"]["10_0_percentile"] == None, output)
74+        self.failUnless(output["get"]["50_0_percentile"] == None, output)
75+        self.failUnless(output["get"]["90_0_percentile"] == None, output)
76+        self.failUnless(output["get"]["95_0_percentile"] == None, output)
77+        self.failUnless(output["get"]["99_0_percentile"] == None, output)
78+        self.failUnless(output["get"]["99_9_percentile"] == None, output)
79 
80 def remove_tags(s):
81     s = re.sub(r'<[^>]*>', ' ', s)
82}
83[server.py:  get_latencies now reports percentiles _only_ if there are sufficient observations for the interpretation of the percentile to be unambiguous.
84wilcoxjg@gmail.com**20110426211641
85 Ignore-this: 546001f34d53e35ce2025b05b4ea66b6
86] {
87hunk ./src/allmydata/storage/server.py 119
88 
89     def get_latencies(self):
90         """Return a dict, indexed by category, that contains a dict of
91-        latency numbers for each category. Each dict will contain the
92+        latency numbers for each category. If there are sufficient samples
93+        for unambiguous interpretation, each dict will contain the
94         following keys: mean, 01_0_percentile, 10_0_percentile,
95         50_0_percentile (median), 90_0_percentile, 95_0_percentile,
96hunk ./src/allmydata/storage/server.py 123
97-        99_0_percentile, 99_9_percentile. If no samples have been collected
98-        for the given category, then that category name will not be present
99-        in the return value."""
100+        99_0_percentile, 99_9_percentile.  If there are insufficient
101+        samples for a given percentile to be interpreted unambiguously
102+        that percentile will be reported as None. If no samples have been
103+        collected for the given category, then that category name will
104+        not be present in the return value. """
105         # note that Amazon's Dynamo paper says they use 99.9% percentile.
106         output = {}
107         for category in self.latencies:
108hunk ./src/allmydata/storage/server.py 135
109                 continue
110             stats = {}
111             samples = self.latencies[category][:]
112-            samples.sort()
113             count = len(samples)
114hunk ./src/allmydata/storage/server.py 136
115-            stats["mean"] = sum(samples) / count
116-            stats["01_0_percentile"] = samples[int(0.01 * count)]
117-            stats["10_0_percentile"] = samples[int(0.1 * count)]
118-            stats["50_0_percentile"] = samples[int(0.5 * count)]
119-            stats["90_0_percentile"] = samples[int(0.9 * count)]
120-            stats["95_0_percentile"] = samples[int(0.95 * count)]
121-            stats["99_0_percentile"] = samples[int(0.99 * count)]
122-            stats["99_9_percentile"] = samples[int(0.999 * count)]
123+            stats["samplesize"] = count
124+            samples.sort()
125+            if count > 1:
126+                stats["mean"] = sum(samples) / count
127+            else:
128+                stats["mean"] = None
129+
130+            orderstatlist = [(0.01, "01_0_percentile", 100), (0.1, "10_0_percentile", 10),\
131+                             (0.50, "50_0_percentile", 10), (0.90, "90_0_percentile", 10),\
132+                             (0.95, "95_0_percentile", 20), (0.99, "99_0_percentile", 100),\
133+                             (0.999, "99_9_percentile", 1000)]
134+
135+            for percentile, percentilestring, minnumtoobserve in orderstatlist:
136+                if count >= minnumtoobserve:
137+                    stats[percentilestring] = samples[int(percentile*count)]
138+                else:
139+                    stats[percentilestring] = None
140+
141             output[category] = stats
142         return output
143 
144}
145
146Context:
147
148[corrected "k must never be smaller than N" to "k must never be greater than N"
149secorp@allmydata.org**20110425010308
150 Ignore-this: 233129505d6c70860087f22541805eac
151]
152[Fix a test failure in test_package_initialization on Python 2.4.x due to exceptions being stringified differently than in later versions of Python. refs #1389
153david-sarah@jacaranda.org**20110411190738
154 Ignore-this: 7847d26bc117c328c679f08a7baee519
155]
156[tests: add test for including the ImportError message and traceback entry in the summary of errors from importing dependencies. refs #1389
157david-sarah@jacaranda.org**20110410155844
158 Ignore-this: fbecdbeb0d06a0f875fe8d4030aabafa
159]
160[allmydata/__init__.py: preserve the message and last traceback entry (file, line number, function, and source line) of ImportErrors in the package versions string. fixes #1389
161david-sarah@jacaranda.org**20110410155705
162 Ignore-this: 2f87b8b327906cf8bfca9440a0904900
163]
164[remove unused variable detected by pyflakes
165zooko@zooko.com**20110407172231
166 Ignore-this: 7344652d5e0720af822070d91f03daf9
167]
168[allmydata/__init__.py: Nicer reporting of unparseable version numbers in dependencies. fixes #1388
169david-sarah@jacaranda.org**20110401202750
170 Ignore-this: 9c6bd599259d2405e1caadbb3e0d8c7f
171]
172[update FTP-and-SFTP.rst: the necessary patch is included in Twisted-10.1
173Brian Warner <warner@lothar.com>**20110325232511
174 Ignore-this: d5307faa6900f143193bfbe14e0f01a
175]
176[control.py: remove all uses of s.get_serverid()
177warner@lothar.com**20110227011203
178 Ignore-this: f80a787953bd7fa3d40e828bde00e855
179]
180[web: remove some uses of s.get_serverid(), not all
181warner@lothar.com**20110227011159
182 Ignore-this: a9347d9cf6436537a47edc6efde9f8be
183]
184[immutable/downloader/fetcher.py: remove all get_serverid() calls
185warner@lothar.com**20110227011156
186 Ignore-this: fb5ef018ade1749348b546ec24f7f09a
187]
188[immutable/downloader/fetcher.py: fix diversity bug in server-response handling
189warner@lothar.com**20110227011153
190 Ignore-this: bcd62232c9159371ae8a16ff63d22c1b
191 
192 When blocks terminate (either COMPLETE or CORRUPT/DEAD/BADSEGNUM), the
193 _shares_from_server dict was being popped incorrectly (using shnum as the
194 index instead of serverid). I'm still thinking through the consequences of
195 this bug. It was probably benign and really hard to detect. I think it would
196 cause us to incorrectly believe that we're pulling too many shares from a
197 server, and thus prefer a different server rather than asking for a second
198 share from the first server. The diversity code is intended to spread out the
199 number of shares simultaneously being requested from each server, but with
200 this bug, it might be spreading out the total number of shares requested at
201 all, not just simultaneously. (note that SegmentFetcher is scoped to a single
202 segment, so the effect doesn't last very long).
203]
204[immutable/downloader/share.py: reduce get_serverid(), one left, update ext deps
205warner@lothar.com**20110227011150
206 Ignore-this: d8d56dd8e7b280792b40105e13664554
207 
208 test_download.py: create+check MyShare instances better, make sure they share
209 Server objects, now that finder.py cares
210]
211[immutable/downloader/finder.py: reduce use of get_serverid(), one left
212warner@lothar.com**20110227011146
213 Ignore-this: 5785be173b491ae8a78faf5142892020
214]
215[immutable/offloaded.py: reduce use of get_serverid() a bit more
216warner@lothar.com**20110227011142
217 Ignore-this: b48acc1b2ae1b311da7f3ba4ffba38f
218]
219[immutable/upload.py: reduce use of get_serverid()
220warner@lothar.com**20110227011138
221 Ignore-this: ffdd7ff32bca890782119a6e9f1495f6
222]
223[immutable/checker.py: remove some uses of s.get_serverid(), not all
224warner@lothar.com**20110227011134
225 Ignore-this: e480a37efa9e94e8016d826c492f626e
226]
227[add remaining get_* methods to storage_client.Server, NoNetworkServer, and
228warner@lothar.com**20110227011132
229 Ignore-this: 6078279ddf42b179996a4b53bee8c421
230 MockIServer stubs
231]
232[upload.py: rearrange _make_trackers a bit, no behavior changes
233warner@lothar.com**20110227011128
234 Ignore-this: 296d4819e2af452b107177aef6ebb40f
235]
236[happinessutil.py: finally rename merge_peers to merge_servers
237warner@lothar.com**20110227011124
238 Ignore-this: c8cd381fea1dd888899cb71e4f86de6e
239]
240[test_upload.py: factor out FakeServerTracker
241warner@lothar.com**20110227011120
242 Ignore-this: 6c182cba90e908221099472cc159325b
243]
244[test_upload.py: server-vs-tracker cleanup
245warner@lothar.com**20110227011115
246 Ignore-this: 2915133be1a3ba456e8603885437e03
247]
248[happinessutil.py: server-vs-tracker cleanup
249warner@lothar.com**20110227011111
250 Ignore-this: b856c84033562d7d718cae7cb01085a9
251]
252[upload.py: more tracker-vs-server cleanup
253warner@lothar.com**20110227011107
254 Ignore-this: bb75ed2afef55e47c085b35def2de315
255]
256[upload.py: fix var names to avoid confusion between 'trackers' and 'servers'
257warner@lothar.com**20110227011103
258 Ignore-this: 5d5e3415b7d2732d92f42413c25d205d
259]
260[refactor: s/peer/server/ in immutable/upload, happinessutil.py, test_upload
261warner@lothar.com**20110227011100
262 Ignore-this: 7ea858755cbe5896ac212a925840fe68
263 
264 No behavioral changes, just updating variable/method names and log messages.
265 The effects outside these three files should be minimal: some exception
266 messages changed (to say "server" instead of "peer"), and some internal class
267 names were changed. A few things still use "peer" to minimize external
268 changes, like UploadResults.timings["peer_selection"] and
269 happinessutil.merge_peers, which can be changed later.
270]
271[storage_client.py: clean up test_add_server/test_add_descriptor, remove .test_servers
272warner@lothar.com**20110227011056
273 Ignore-this: efad933e78179d3d5fdcd6d1ef2b19cc
274]
275[test_client.py, upload.py:: remove KiB/MiB/etc constants, and other dead code
276warner@lothar.com**20110227011051
277 Ignore-this: dc83c5794c2afc4f81e592f689c0dc2d
278]
279[test: increase timeout on a network test because Francois's ARM machine hit that timeout
280zooko@zooko.com**20110317165909
281 Ignore-this: 380c345cdcbd196268ca5b65664ac85b
282 I'm skeptical that the test was proceeding correctly but ran out of time. It seems more likely that it had gotten hung. But if we raise the timeout to an even more extravagant number then we can be even more certain that the test was never going to finish.
283]
284[docs/configuration.rst: add a "Frontend Configuration" section
285Brian Warner <warner@lothar.com>**20110222014323
286 Ignore-this: 657018aa501fe4f0efef9851628444ca
287 
288 this points to docs/frontends/*.rst, which were previously underlinked
289]
290[web/filenode.py: avoid calling req.finish() on closed HTTP connections. Closes #1366
291"Brian Warner <warner@lothar.com>"**20110221061544
292 Ignore-this: 799d4de19933f2309b3c0c19a63bb888
293]
294[Add unit tests for cross_check_pkg_resources_versus_import, and a regression test for ref #1355. This requires a little refactoring to make it testable.
295david-sarah@jacaranda.org**20110221015817
296 Ignore-this: 51d181698f8c20d3aca58b057e9c475a
297]
298[allmydata/__init__.py: .name was used in place of the correct .__name__ when printing an exception. Also, robustify string formatting by using %r instead of %s in some places. fixes #1355.
299david-sarah@jacaranda.org**20110221020125
300 Ignore-this: b0744ed58f161bf188e037bad077fc48
301]
302[Refactor StorageFarmBroker handling of servers
303Brian Warner <warner@lothar.com>**20110221015804
304 Ignore-this: 842144ed92f5717699b8f580eab32a51
305 
306 Pass around IServer instance instead of (peerid, rref) tuple. Replace
307 "descriptor" with "server". Other replacements:
308 
309  get_all_servers -> get_connected_servers/get_known_servers
310  get_servers_for_index -> get_servers_for_psi (now returns IServers)
311 
312 This change still needs to be pushed further down: lots of code is now
313 getting the IServer and then distributing (peerid, rref) internally.
314 Instead, it ought to distribute the IServer internally and delay
315 extracting a serverid or rref until the last moment.
316 
317 no_network.py was updated to retain parallelism.
318]
319[TAG allmydata-tahoe-1.8.2
320warner@lothar.com**20110131020101]
321Patch bundle hash:
322b0cd7b8e35f8f9ccb234a36671df7ce51cb1c8e5