Ticket #1392: test_get_latencies_upgraded01.darcs.patch

File test_get_latencies_upgraded01.darcs.patch, 14.6 KB (added by arch_o_median, at 2011-04-26T21:04:54Z)
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:02:52 MDT 2011  wilcoxjg@gmail.com
5  * server.py: in function get_latencies order statistics (percentiles) are only reported if there are sufficient samples for their interpretation 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: in function get_latencies order statistics (percentiles) are only reported if there are sufficient samples for their interpretation to be unambiguous.
84wilcoxjg@gmail.com**20110426210252
85 Ignore-this: f57006ceb25bf1c732baa5320b80265f
86] {
87hunk ./src/allmydata/storage/server.py 132
88                 continue
89             stats = {}
90             samples = self.latencies[category][:]
91-            samples.sort()
92             count = len(samples)
93hunk ./src/allmydata/storage/server.py 133
94-            stats["mean"] = sum(samples) / count
95-            stats["01_0_percentile"] = samples[int(0.01 * count)]
96-            stats["10_0_percentile"] = samples[int(0.1 * count)]
97-            stats["50_0_percentile"] = samples[int(0.5 * count)]
98-            stats["90_0_percentile"] = samples[int(0.9 * count)]
99-            stats["95_0_percentile"] = samples[int(0.95 * count)]
100-            stats["99_0_percentile"] = samples[int(0.99 * count)]
101-            stats["99_9_percentile"] = samples[int(0.999 * count)]
102+            stats["samplesize"] = count
103+            samples.sort()
104+            if count > 1:
105+                stats["mean"] = sum(samples) / count
106+            else:
107+                stats["mean"] = None
108+
109+            orderstatlist = [(0.01, "01_0_percentile", 100), (0.1, "10_0_percentile", 10),\
110+                             (0.50, "50_0_percentile", 10), (0.90, "90_0_percentile", 10),\
111+                             (0.95, "95_0_percentile", 20), (0.99, "99_0_percentile", 100),\
112+                             (0.999, "99_9_percentile", 1000)]
113+
114+            for percentile, percentilestring, minnumtoobserve in orderstatlist:
115+                if count >= minnumtoobserve:
116+                    stats[percentilestring] = samples[int(percentile*count)]
117+                else:
118+                    stats[percentilestring] = None
119+
120             output[category] = stats
121         return output
122 
123}
124
125Context:
126
127[corrected "k must never be smaller than N" to "k must never be greater than N"
128secorp@allmydata.org**20110425010308
129 Ignore-this: 233129505d6c70860087f22541805eac
130]
131[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
132david-sarah@jacaranda.org**20110411190738
133 Ignore-this: 7847d26bc117c328c679f08a7baee519
134]
135[tests: add test for including the ImportError message and traceback entry in the summary of errors from importing dependencies. refs #1389
136david-sarah@jacaranda.org**20110410155844
137 Ignore-this: fbecdbeb0d06a0f875fe8d4030aabafa
138]
139[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
140david-sarah@jacaranda.org**20110410155705
141 Ignore-this: 2f87b8b327906cf8bfca9440a0904900
142]
143[remove unused variable detected by pyflakes
144zooko@zooko.com**20110407172231
145 Ignore-this: 7344652d5e0720af822070d91f03daf9
146]
147[allmydata/__init__.py: Nicer reporting of unparseable version numbers in dependencies. fixes #1388
148david-sarah@jacaranda.org**20110401202750
149 Ignore-this: 9c6bd599259d2405e1caadbb3e0d8c7f
150]
151[update FTP-and-SFTP.rst: the necessary patch is included in Twisted-10.1
152Brian Warner <warner@lothar.com>**20110325232511
153 Ignore-this: d5307faa6900f143193bfbe14e0f01a
154]
155[control.py: remove all uses of s.get_serverid()
156warner@lothar.com**20110227011203
157 Ignore-this: f80a787953bd7fa3d40e828bde00e855
158]
159[web: remove some uses of s.get_serverid(), not all
160warner@lothar.com**20110227011159
161 Ignore-this: a9347d9cf6436537a47edc6efde9f8be
162]
163[immutable/downloader/fetcher.py: remove all get_serverid() calls
164warner@lothar.com**20110227011156
165 Ignore-this: fb5ef018ade1749348b546ec24f7f09a
166]
167[immutable/downloader/fetcher.py: fix diversity bug in server-response handling
168warner@lothar.com**20110227011153
169 Ignore-this: bcd62232c9159371ae8a16ff63d22c1b
170 
171 When blocks terminate (either COMPLETE or CORRUPT/DEAD/BADSEGNUM), the
172 _shares_from_server dict was being popped incorrectly (using shnum as the
173 index instead of serverid). I'm still thinking through the consequences of
174 this bug. It was probably benign and really hard to detect. I think it would
175 cause us to incorrectly believe that we're pulling too many shares from a
176 server, and thus prefer a different server rather than asking for a second
177 share from the first server. The diversity code is intended to spread out the
178 number of shares simultaneously being requested from each server, but with
179 this bug, it might be spreading out the total number of shares requested at
180 all, not just simultaneously. (note that SegmentFetcher is scoped to a single
181 segment, so the effect doesn't last very long).
182]
183[immutable/downloader/share.py: reduce get_serverid(), one left, update ext deps
184warner@lothar.com**20110227011150
185 Ignore-this: d8d56dd8e7b280792b40105e13664554
186 
187 test_download.py: create+check MyShare instances better, make sure they share
188 Server objects, now that finder.py cares
189]
190[immutable/downloader/finder.py: reduce use of get_serverid(), one left
191warner@lothar.com**20110227011146
192 Ignore-this: 5785be173b491ae8a78faf5142892020
193]
194[immutable/offloaded.py: reduce use of get_serverid() a bit more
195warner@lothar.com**20110227011142
196 Ignore-this: b48acc1b2ae1b311da7f3ba4ffba38f
197]
198[immutable/upload.py: reduce use of get_serverid()
199warner@lothar.com**20110227011138
200 Ignore-this: ffdd7ff32bca890782119a6e9f1495f6
201]
202[immutable/checker.py: remove some uses of s.get_serverid(), not all
203warner@lothar.com**20110227011134
204 Ignore-this: e480a37efa9e94e8016d826c492f626e
205]
206[add remaining get_* methods to storage_client.Server, NoNetworkServer, and
207warner@lothar.com**20110227011132
208 Ignore-this: 6078279ddf42b179996a4b53bee8c421
209 MockIServer stubs
210]
211[upload.py: rearrange _make_trackers a bit, no behavior changes
212warner@lothar.com**20110227011128
213 Ignore-this: 296d4819e2af452b107177aef6ebb40f
214]
215[happinessutil.py: finally rename merge_peers to merge_servers
216warner@lothar.com**20110227011124
217 Ignore-this: c8cd381fea1dd888899cb71e4f86de6e
218]
219[test_upload.py: factor out FakeServerTracker
220warner@lothar.com**20110227011120
221 Ignore-this: 6c182cba90e908221099472cc159325b
222]
223[test_upload.py: server-vs-tracker cleanup
224warner@lothar.com**20110227011115
225 Ignore-this: 2915133be1a3ba456e8603885437e03
226]
227[happinessutil.py: server-vs-tracker cleanup
228warner@lothar.com**20110227011111
229 Ignore-this: b856c84033562d7d718cae7cb01085a9
230]
231[upload.py: more tracker-vs-server cleanup
232warner@lothar.com**20110227011107
233 Ignore-this: bb75ed2afef55e47c085b35def2de315
234]
235[upload.py: fix var names to avoid confusion between 'trackers' and 'servers'
236warner@lothar.com**20110227011103
237 Ignore-this: 5d5e3415b7d2732d92f42413c25d205d
238]
239[refactor: s/peer/server/ in immutable/upload, happinessutil.py, test_upload
240warner@lothar.com**20110227011100
241 Ignore-this: 7ea858755cbe5896ac212a925840fe68
242 
243 No behavioral changes, just updating variable/method names and log messages.
244 The effects outside these three files should be minimal: some exception
245 messages changed (to say "server" instead of "peer"), and some internal class
246 names were changed. A few things still use "peer" to minimize external
247 changes, like UploadResults.timings["peer_selection"] and
248 happinessutil.merge_peers, which can be changed later.
249]
250[storage_client.py: clean up test_add_server/test_add_descriptor, remove .test_servers
251warner@lothar.com**20110227011056
252 Ignore-this: efad933e78179d3d5fdcd6d1ef2b19cc
253]
254[test_client.py, upload.py:: remove KiB/MiB/etc constants, and other dead code
255warner@lothar.com**20110227011051
256 Ignore-this: dc83c5794c2afc4f81e592f689c0dc2d
257]
258[test: increase timeout on a network test because Francois's ARM machine hit that timeout
259zooko@zooko.com**20110317165909
260 Ignore-this: 380c345cdcbd196268ca5b65664ac85b
261 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.
262]
263[docs/configuration.rst: add a "Frontend Configuration" section
264Brian Warner <warner@lothar.com>**20110222014323
265 Ignore-this: 657018aa501fe4f0efef9851628444ca
266 
267 this points to docs/frontends/*.rst, which were previously underlinked
268]
269[web/filenode.py: avoid calling req.finish() on closed HTTP connections. Closes #1366
270"Brian Warner <warner@lothar.com>"**20110221061544
271 Ignore-this: 799d4de19933f2309b3c0c19a63bb888
272]
273[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.
274david-sarah@jacaranda.org**20110221015817
275 Ignore-this: 51d181698f8c20d3aca58b057e9c475a
276]
277[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.
278david-sarah@jacaranda.org**20110221020125
279 Ignore-this: b0744ed58f161bf188e037bad077fc48
280]
281[Refactor StorageFarmBroker handling of servers
282Brian Warner <warner@lothar.com>**20110221015804
283 Ignore-this: 842144ed92f5717699b8f580eab32a51
284 
285 Pass around IServer instance instead of (peerid, rref) tuple. Replace
286 "descriptor" with "server". Other replacements:
287 
288  get_all_servers -> get_connected_servers/get_known_servers
289  get_servers_for_index -> get_servers_for_psi (now returns IServers)
290 
291 This change still needs to be pushed further down: lots of code is now
292 getting the IServer and then distributing (peerid, rref) internally.
293 Instead, it ought to distribute the IServer internally and delay
294 extracting a serverid or rref until the last moment.
295 
296 no_network.py was updated to retain parallelism.
297]
298[TAG allmydata-tahoe-1.8.2
299warner@lothar.com**20110131020101]
300Patch bundle hash:
301ec106bd9d3232d74d6c0e2b86e22ed311ccaa183