OnixS C++ CME Market Data Handler  4.8.0.10
API documentation
Pages/BenchmarkingResults.md
Go to the documentation of this file.
1 \addtogroup benchmarking-results
2 
3 \brief Latest achievements in market data processing performance.
4 
5 \section benchmarking-preface Preface
6 
7 Benchmarking was performed using CME MDP emulator which
8 transmits data previously recorded on channels 360 and
9 384 of real CME production environment.
10 
11 Simulated environment makes pauses (_Sending Delay_) between
12 two packets sent to determine the influence of network activity
13 onto market data processing performance.
14 
15 Benchmarking measures _Market Data Processing Latency_ - the
16 time used by C++ CME Market Data Handler to process market data
17 starting with the moment when the Handler receives a packet from the
18 network till the moment when the Handler passes the results of a
19 packet processing to the users through correspondent callbacks.
20 
21 Benchmarking results were obtained by the _Benchmark_ sample supplied
22 in a distribution package, and include latency for **Messaging events**,
23 **Direct Book Updates** and **MBO Book Updates**.
24 
25 Benchmarking was done on a machine with Intel
26 Core i7-7700K CPU running Ubuntu 17.04 Linux.
27 
28 \section benchmarking-market-data Market Data Traits
29 
30 At the moment of benchmarking, 99% of messages, sent by MDP, contained
31 a single atomic operation over the book for a particular instrument.
32 
33 The following table summarizes characteristics of market data on the channels:
34 
35 <center>
36 
37  Trait | 360 | 384
38 ------------------------------------------------------|---------:|---------:
39  Instruments on the channel | 4069 | 1905
40  Average packet size in bytes | 429 | 178
41  Average/maximal number of bids/offers in direct book | 10/10 | 7/10
42  Average/maximal number of bids/offers in MBO book | 794/1569 | 270/690
43 
44 </center>
45 
46 \section benchmarking-messaging Messaging Latency
47 
48 The given major release introduced a redesigned messaging subsystem.
49 Messaging the latency defines time since the moment of data reception
50 till the moment when received data is validated by a processing session
51 and passed to the users through the new OnixS::CME::MDH::MarketDataListener
52 callbacks.
53 
54 <center>
55  <table>
56  <tr>
57  <th rowspan=3>Sending<br>Delay<br> (ms)</th>
58  <th colspan=12>Latency (&mu;s)</th>
59  </tr>
60  <tr>
61  <th colspan=6>360</th>
62  <th colspan=6>384</th>
63  </tr>
64  <tr>
65  <th>Minimal</th>
66  <th>Median</th>
67  <th>Mean</th>
68  <th>95%</th>
69  <th>99%</th>
70  <th>Maximal</th>
71  <th>Minimal</th>
72  <th>Median</th>
73  <th>Mean</th>
74  <th>95%</th>
75  <th>99%</th>
76  <th>Maximal</th>
77  </tr>
78  <tr>
79  <td align=right>0</td>
80  <td align=right>0.047</td>
81  <td align=right>0.049</td>
82  <td align=right>0.052</td>
83  <td align=right>0.066</td>
84  <td align=right>0.099</td>
85  <td align=right>0.378</td>
86  <td align=right>0.047</td>
87  <td align=right>0.048</td>
88  <td align=right>0.051</td>
89  <td align=right>0.060</td>
90  <td align=right>0.081</td>
91  <td align=right>0.435</td>
92  </tr>
93  <tr>
94  <td align=right>10</td>
95  <td align=right>0.079</td>
96  <td align=right>0.095</td>
97  <td align=right>0.096</td>
98  <td align=right>0.117</td>
99  <td align=right>0.135</td>
100  <td align=right>0.386</td>
101  <td align=right>0.047</td>
102  <td align=right>0.097</td>
103  <td align=right>0.087</td>
104  <td align=right>0.120</td>
105  <td align=right>0.153</td>
106  <td align=right>0.975</td>
107  </tr>
108  <tr>
109  <td align=right>50</td>
110  <td align=right>0.047</td>
111  <td align=right>0.071</td>
112  <td align=right>0.075</td>
113  <td align=right>0.110</td>
114  <td align=right>0.129</td>
115  <td align=right>0.592</td>
116  <td align=right>0.052</td>
117  <td align=right>0.082</td>
118  <td align=right>0.084</td>
119  <td align=right>0.120</td>
120  <td align=right>0.187</td>
121  <td align=right>0.571</td>
122  </tr>
123  </table>
124 </center>
125 
126 The visual presentation of latency depending on the interval
127 between two transmitted packets depicted on the following chart:
128 
129 ![Messaging Latency](@ref Latency-Messaging.jpg)
130 
131 \section benchmarking-book Book Maintenance Latency
132 
133 Book maintenance latency represents the time spent by the Handler
134 starting from the moment data is received till the moment when
135 an updated order book is supplied through a correspondent callback.
136 Depending on the type of book, different callbacks are invoked by the
137 Handler.
138 
139 \warning The Handler publishes book updates at the end
140 of a certain market event like the _end of real quotes_
141 (atomic updates into direct and MBO books) or the _end of
142 implied quotes_ (atomic updates into implied books). Also,
143 in general, an event may consist of multiple messages
144 distributed across multiple packets. Therefore, the latency
145 for different types of books may differ significantly.
146 
147 \subsection benchmarking-direct-book Market By Price, Direct Book
148 
149 Measurements for direct book updates are gathered into the following table:
150 
151 <center>
152  <table>
153  <tr>
154  <th rowspan=3>Sending<br>Delay<br> (ms)</th>
155  <th colspan=12>Latency (&mu;s)</th>
156  </tr>
157  <tr>
158  <th colspan=6>360</th>
159  <th colspan=6>384</th>
160  </tr>
161  <tr>
162  <th>Minimal</th>
163  <th>Median</th>
164  <th>Mean</th>
165  <th>95%</th>
166  <th>99%</th>
167  <th>Maximal</th>
168  <th>Minimal</th>
169  <th>Median</th>
170  <th>Mean</th>
171  <th>95%</th>
172  <th>99%</th>
173  <th>Maximal</th>
174  </tr>
175  <tr>
176  <td align=right>0</td>
177  <td align=right>0.104</td>
178  <td align=right>0.169</td>
179  <td align=right>0.183</td>
180  <td align=right>0.289</td>
181  <td align=right>0.379</td>
182  <td align=right>0.780</td>
183  <td align=right>0.107</td>
184  <td align=right>0.202</td>
185  <td align=right>0.214</td>
186  <td align=right>0.307</td>
187  <td align=right>0.378</td>
188  <td align=right>0.855</td>
189  </tr>
190  <tr>
191  <td align=right>10</td>
192  <td align=right>0.115</td>
193  <td align=right>0.217</td>
194  <td align=right>0.239</td>
195  <td align=right>0.390</td>
196  <td align=right>0.512</td>
197  <td align=right>1.420</td>
198  <td align=right>0.109</td>
199  <td align=right>0.225</td>
200  <td align=right>0.236</td>
201  <td align=right>0.344</td>
202  <td align=right>0.450</td>
203  <td align=right>1.678</td>
204  </tr>
205  <tr>
206  <td align=right>50</td>
207  <td align=right>0.126</td>
208  <td align=right>0.233</td>
209  <td align=right>0.250</td>
210  <td align=right>0.386</td>
211  <td align=right>0.469</td>
212  <td align=right>1.102</td>
213  <td align=right>0.128</td>
214  <td align=right>0.284</td>
215  <td align=right>0.301</td>
216  <td align=right>0.480</td>
217  <td align=right>0.700</td>
218  <td align=right>1.706</td>
219  </tr>
220  </table>
221 </center>
222 
223 Following diagram depicts table values visually:
224 
225 ![Direct Book Update Latency](@ref Latency-DirectBookUpdate.jpg)
226 
227 \subsection benchmarking-mbo-book Market By Order
228 
229 The following table presents benchmarking results for MBO book updates:
230 
231 <center>
232  <table>
233  <tr>
234  <th rowspan=3>Sending<br>Delay<br> (ms)</th>
235  <th colspan=12>Latency (&mu;s)</th>
236  </tr>
237  <tr>
238  <th colspan=6>360</th>
239  <th colspan=6>384</th>
240  </tr>
241  <tr>
242  <th>Minimal</th>
243  <th>Median</th>
244  <th>Mean</th>
245  <th>95%</th>
246  <th>99%</th>
247  <th>Maximal</th>
248  <th>Minimal</th>
249  <th>Median</th>
250  <th>Mean</th>
251  <th>95%</th>
252  <th>99%</th>
253  <th>Maximal</th>
254  </tr>
255  <tr>
256  <td align=right>0</td>
257  <td align=right>0.108</td>
258  <td align=right>0.252</td>
259  <td align=right>0.462</td>
260  <td align=right>1.591</td>
261  <td align=right>3.372</td>
262  <td align=right>8.223</td>
263  <td align=right>0.151</td>
264  <td align=right>0.300</td>
265  <td align=right>0.362</td>
266  <td align=right>0.704</td>
267  <td align=right>0.905</td>
268  <td align=right>3.158</td>
269  </tr>
270  <tr>
271  <td align=right>10</td>
272  <td align=right>0.181</td>
273  <td align=right>0.391</td>
274  <td align=right>0.653</td>
275  <td align=right>1.960</td>
276  <td align=right>4.022</td>
277  <td align=right>12.457</td>
278  <td align=right>0.125</td>
279  <td align=right>0.312</td>
280  <td align=right>0.394</td>
281  <td align=right>0.848</td>
282  <td align=right>1.056</td>
283  <td align=right>3.776</td>
284  </tr>
285  <tr>
286  <td align=right>50</td>
287  <td align=right>0.154</td>
288  <td align=right>0.395</td>
289  <td align=right>0.642</td>
290  <td align=right>1.933</td>
291  <td align=right>3.866</td>
292  <td align=right>14.535</td>
293  <td align=right>0.145</td>
294  <td align=right>0.370</td>
295  <td align=right>0.478</td>
296  <td align=right>1.015</td>
297  <td align=right>1.267</td>
298  <td align=right>4.188</td>
299  </tr>
300  </table>
301 </center>
302 
303 The diagram below displays the results visually:
304 
305 ![MBO Book Update Latency](@ref Latency-MboBookUpdate.jpg)
306 
307 \subsection benchmarking-book-conclusions Conclusions and Important Notes
308 
309 **Minimal latency of a book maintenance machinery is almost 10
310 times less in comparison to the book maintenance latency measured
311 for previous major release**. Such performance boost is achieved
312 by reducing processing time at session (messaging) level.
313 
314 Also, in spite of both previous and latest major releases use
315 almost the same book maintenance machinery, **improvements implemented
316 in latest release provide significant (up to 25 times) reduction of
317 median latency compare to previous major releases** due to switching
318 using new memory management strategies and more effective data structures.
319 
320 \note An important aspect of measuring an order book maintenance
321 latency is that order books are passed to the user at the end of
322 market event which in general may consist of multiple packets and
323 messages. Therefore, amount of data proportionally increases the
324 latency. One of the possible ways to have better latency is to use
325 a per-security book update notification strategy which instructs
326 the Handler to expose book as soon as a chain of atomic updates
327 is ended for a particular security without waiting for the end
328 of the entire event. This feature is supported by the Handler,
329 but it's not officially approved by CME. Therefore, using noted
330 book update notification strategy is on customer's risk.