md_doc_xds-test-descriptions.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.17"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>GRPC C++: xDS (Load-Balancing) Interop Test Case Descriptions</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="search/searchdata.js"></script>
  14. <script type="text/javascript" src="search/search.js"></script>
  15. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  19. <div id="titlearea">
  20. <table cellspacing="0" cellpadding="0">
  21. <tbody>
  22. <tr style="height: 56px;">
  23. <td id="projectalign" style="padding-left: 0.5em;">
  24. <div id="projectname">GRPC C++
  25. &#160;<span id="projectnumber">1.33.1</span>
  26. </div>
  27. </td>
  28. </tr>
  29. </tbody>
  30. </table>
  31. </div>
  32. <!-- end header part -->
  33. <!-- Generated by Doxygen 1.8.17 -->
  34. <script type="text/javascript">
  35. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  36. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  37. /* @license-end */
  38. </script>
  39. <script type="text/javascript" src="menudata.js"></script>
  40. <script type="text/javascript" src="menu.js"></script>
  41. <script type="text/javascript">
  42. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  43. $(function() {
  44. initMenu('',true,false,'search.php','Search');
  45. $(document).ready(function() { init_search(); });
  46. });
  47. /* @license-end */</script>
  48. <div id="main-nav"></div>
  49. <!-- window showing the filter options -->
  50. <div id="MSearchSelectWindow"
  51. onmouseover="return searchBox.OnSearchSelectShow()"
  52. onmouseout="return searchBox.OnSearchSelectHide()"
  53. onkeydown="return searchBox.OnSearchSelectKey(event)">
  54. </div>
  55. <!-- iframe showing the search results (closed by default) -->
  56. <div id="MSearchResultsWindow">
  57. <iframe src="javascript:void(0)" frameborder="0"
  58. name="MSearchResults" id="MSearchResults">
  59. </iframe>
  60. </div>
  61. </div><!-- top -->
  62. <div class="PageDoc"><div class="header">
  63. <div class="headertitle">
  64. <div class="title">xDS (Load-Balancing) Interop Test Case Descriptions </div> </div>
  65. </div><!--header-->
  66. <div class="contents">
  67. <div class="textblock"><p>Client and server use <a href="../src/proto/grpc/testing/test.proto">test.proto</a>.</p>
  68. <h1><a class="anchor" id="autotoc_md240"></a>
  69. Server</h1>
  70. <p>The code for the xDS test server can be found at: <a href="https://github.com/grpc/grpc-java/blob/master/interop-testing/src/main/java/io/grpc/testing/integration/XdsTestServer.java">Java</a> (other language implementations are in progress).</p>
  71. <p>Server should accept these arguments:</p>
  72. <ul>
  73. <li>&ndash;port=PORT<ul>
  74. <li>The port the server will run on.</li>
  75. </ul>
  76. </li>
  77. </ul>
  78. <h1><a class="anchor" id="autotoc_md241"></a>
  79. Client</h1>
  80. <p>The base behavior of the xDS test client is to send a constant QPS of unary messages and record the remote-peer distribution of the responses. Further, the client must expose an implementation of the <code>LoadBalancerStatsService</code> gRPC service to allow the test driver to validate the load balancing behavior for a particular test case (see below for more details).</p>
  81. <p>The code for the xDS test client can be at: <a href="https://github.com/grpc/grpc-java/blob/master/interop-testing/src/main/java/io/grpc/testing/integration/XdsTestClient.java">Java</a> (other language implementations are in progress).</p>
  82. <p>Clients should accept these arguments:</p>
  83. <ul>
  84. <li>&ndash;fail_on_failed_rpcs=BOOL<ul>
  85. <li>If true, the client should exit with a non-zero return code if any RPCs fail after at least one RPC has succeeded, indicating a valid xDS config was received. This accounts for any startup-related delays in receiving an initial config from the load balancer. Default is false.</li>
  86. </ul>
  87. </li>
  88. <li>&ndash;num_channels=CHANNELS<ul>
  89. <li>The number of channels to create to the server.</li>
  90. </ul>
  91. </li>
  92. <li>&ndash;qps=QPS<ul>
  93. <li>The QPS per channel.</li>
  94. </ul>
  95. </li>
  96. <li>&ndash;server=HOSTNAME:PORT<ul>
  97. <li>The server host to connect to. For example, "localhost:8080"</li>
  98. </ul>
  99. </li>
  100. <li>&ndash;stats_port=PORT<ul>
  101. <li>The port for to expose the client's <code>LoadBalancerStatsService</code> implementation.</li>
  102. </ul>
  103. </li>
  104. <li>&ndash;rpc_timeout_sec=SEC<ul>
  105. <li>The timeout to set on all outbound RPCs. Default is 20.</li>
  106. </ul>
  107. </li>
  108. </ul>
  109. <h1><a class="anchor" id="autotoc_md242"></a>
  110. Test Driver</h1>
  111. <p>Note that, unlike our other interop tests, neither the client nor the server has any notion of which of the following test scenarios is under test. Instead, a separate test driver is responsible for configuring the load balancer and the server backends, running the client, and then querying the client's <code>LoadBalancerStatsService</code> to validate load balancer behavior for each of the tests described below.</p>
  112. <h1><a class="anchor" id="autotoc_md243"></a>
  113. LoadBalancerStatsService</h1>
  114. <p>The service is defined as:</p>
  115. <div class="fragment"><div class="line">message LoadBalancerStatsRequest {</div>
  116. <div class="line"> // Request stats for the next num_rpcs sent by client.</div>
  117. <div class="line"> int32 num_rpcs = 1;</div>
  118. <div class="line"> // If num_rpcs have not completed within timeout_sec, return partial results.</div>
  119. <div class="line"> int32 timeout_sec = 2;</div>
  120. <div class="line">}</div>
  121. <div class="line"> </div>
  122. <div class="line">message LoadBalancerStatsResponse {</div>
  123. <div class="line"> // The number of completed RPCs for each peer.</div>
  124. <div class="line"> map&lt;string, int32&gt; rpcs_by_peer = 1;</div>
  125. <div class="line"> // The number of RPCs that failed to record a remote peer.</div>
  126. <div class="line"> int32 num_failures = 2;</div>
  127. <div class="line">}</div>
  128. <div class="line"> </div>
  129. <div class="line">service LoadBalancerStatsService {</div>
  130. <div class="line"> // Gets the backend distribution for RPCs sent by a test client.</div>
  131. <div class="line"> rpc GetClientStats(LoadBalancerStatsRequest)</div>
  132. <div class="line"> returns (LoadBalancerStatsResponse) {}</div>
  133. <div class="line">}</div>
  134. </div><!-- fragment --><p>Note that the <code>LoadBalancerStatsResponse</code> contains the remote peer distribution of the next <code>num_rpcs</code> <em>sent</em> by the client after receiving the <code>LoadBalancerStatsRequest</code>. It is important that the remote peer distribution be recorded for a block of consecutive outgoing RPCs, to validate the intended distribution from the load balancer, rather than just looking at the next <code>num_rpcs</code> responses received from backends, as different backends may respond at different rates.</p>
  135. <h1><a class="anchor" id="autotoc_md244"></a>
  136. Test Cases</h1>
  137. <h2><a class="anchor" id="autotoc_md245"></a>
  138. ping_pong</h2>
  139. <p>This test verifies that every backend receives traffic.</p>
  140. <p>Client parameters:</p>
  141. <ol type="1">
  142. <li>&ndash;num_channels=1</li>
  143. </ol>
  144. <ol type="1">
  145. <li>&ndash;qps=100</li>
  146. </ol>
  147. <ol type="1">
  148. <li>&ndash;fail_on_failed_rpc=true</li>
  149. </ol>
  150. <p>Load balancer configuration:</p>
  151. <ol type="1">
  152. <li>4 backends are created in a single managed instance group (MIG).</li>
  153. </ol>
  154. <p>Test driver asserts:</p>
  155. <ol type="1">
  156. <li>All backends receive at least one RPC</li>
  157. </ol>
  158. <h2><a class="anchor" id="autotoc_md246"></a>
  159. round_robin</h2>
  160. <p>This test verifies that RPCs are evenly routed according to an unweighted round robin policy.</p>
  161. <p>Client parameters:</p>
  162. <ol type="1">
  163. <li>&ndash;num_channels=1</li>
  164. </ol>
  165. <ol type="1">
  166. <li>&ndash;qps=100</li>
  167. </ol>
  168. <ol type="1">
  169. <li>&ndash;fail_on_failed_rpc=true</li>
  170. </ol>
  171. <p>Load balancer configuration:</p>
  172. <ol type="1">
  173. <li>4 backends are created in a single MIG.</li>
  174. </ol>
  175. <p>Test driver asserts that:</p>
  176. <ol type="1">
  177. <li>Once all backends receive at least one RPC, the following 100 RPCs are evenly distributed across the 4 backends.</li>
  178. </ol>
  179. <h2><a class="anchor" id="autotoc_md247"></a>
  180. backends_restart</h2>
  181. <p>This test verifies that the load balancer will resume sending traffic to a set of backends that is stopped and then resumed.</p>
  182. <p>Client parameters:</p>
  183. <ol type="1">
  184. <li>&ndash;num_channels=1</li>
  185. </ol>
  186. <ol type="1">
  187. <li>&ndash;qps=100</li>
  188. </ol>
  189. <p>Load balancer configuration:</p>
  190. <ol type="1">
  191. <li>4 backends are created in a single MIG.</li>
  192. </ol>
  193. <p>Test driver asserts:</p>
  194. <ol type="1">
  195. <li>All backends receive at least one RPC.</li>
  196. </ol>
  197. <p>The test driver records the peer distribution for a subsequent block of 100 RPCs then stops the backends.</p>
  198. <p>Test driver asserts:</p>
  199. <ol type="1">
  200. <li>No RPCs from the client are successful.</li>
  201. </ol>
  202. <p>The test driver resumes the backends.</p>
  203. <p>Test driver asserts:</p>
  204. <ol type="1">
  205. <li>Once all backends receive at least one RPC, the distribution for a block of 100 RPCs is the same as the distribution recorded prior to restart.</li>
  206. </ol>
  207. <h2><a class="anchor" id="autotoc_md248"></a>
  208. secondary_locality_gets_requests_on_primary_failure</h2>
  209. <p>This test verifies that backends in a secondary locality receive traffic when all backends in the primary locality fail.</p>
  210. <p>Client parameters:</p>
  211. <ol type="1">
  212. <li>&ndash;num_channels=1</li>
  213. </ol>
  214. <ol type="1">
  215. <li>&ndash;qps=100</li>
  216. </ol>
  217. <p>Load balancer configuration:</p>
  218. <ol type="1">
  219. <li>The primary MIG with 2 backends in the same zone as the client</li>
  220. </ol>
  221. <ol type="1">
  222. <li>The secondary MIG with 2 backends in a different zone</li>
  223. </ol>
  224. <p>Test driver asserts:</p>
  225. <ol type="1">
  226. <li>All backends in the primary locality receive at least 1 RPC.</li>
  227. </ol>
  228. <ol type="1">
  229. <li>No backends in the secondary locality receive RPCs.</li>
  230. </ol>
  231. <p>The test driver stops the backends in the primary locality.</p>
  232. <p>Test driver asserts:</p>
  233. <ol type="1">
  234. <li>All backends in the secondary locality receive at least 1 RPC.</li>
  235. </ol>
  236. <p>The test driver resumes the backends in the primary locality.</p>
  237. <p>Test driver asserts:</p>
  238. <ol type="1">
  239. <li>All backends in the primary locality receive at least 1 RPC.</li>
  240. </ol>
  241. <ol type="1">
  242. <li>No backends in the secondary locality receive RPCs.</li>
  243. </ol>
  244. <h2><a class="anchor" id="autotoc_md249"></a>
  245. secondary_locality_gets_no_requests_on_partial_primary_failure</h2>
  246. <p>This test verifies that backends in a failover locality do not receive traffic when at least one of the backends in the primary locality remain healthy.</p>
  247. <p><b>Note:</b> Future TD features may change the expected behavior and require changes to this test case.</p>
  248. <p>Client parameters:</p>
  249. <ol type="1">
  250. <li>&ndash;num_channels=1</li>
  251. </ol>
  252. <ol type="1">
  253. <li>&ndash;qps=100</li>
  254. </ol>
  255. <p>Load balancer configuration:</p>
  256. <ol type="1">
  257. <li>The primary MIG with 2 backends in the same zone as the client</li>
  258. </ol>
  259. <ol type="1">
  260. <li>The secondary MIG with 2 backends in a different zone</li>
  261. </ol>
  262. <p>Test driver asserts:</p>
  263. <ol type="1">
  264. <li>All backends in the primary locality receive at least 1 RPC.</li>
  265. </ol>
  266. <ol type="1">
  267. <li>No backends in the secondary locality receive RPCs.</li>
  268. </ol>
  269. <p>The test driver stops one of the backends in the primary locality.</p>
  270. <p>Test driver asserts:</p>
  271. <ol type="1">
  272. <li>All backends in the primary locality receive at least 1 RPC.</li>
  273. </ol>
  274. <ol type="1">
  275. <li>No backends in the secondary locality receive RPCs.</li>
  276. </ol>
  277. <h2><a class="anchor" id="autotoc_md250"></a>
  278. remove_instance_group</h2>
  279. <p>This test verifies that a remaining instance group can successfully serve RPCs after removal of another instance group in the same zone.</p>
  280. <p>Client parameters:</p>
  281. <ol type="1">
  282. <li>&ndash;num_channels=1</li>
  283. </ol>
  284. <ol type="1">
  285. <li>&ndash;qps=100</li>
  286. </ol>
  287. <p>Load balancer configuration:</p>
  288. <ol type="1">
  289. <li>Two MIGs with two backends each, using rate balancing mode.</li>
  290. </ol>
  291. <p>Test driver asserts:</p>
  292. <ol type="1">
  293. <li>All backends receive at least one RPC.</li>
  294. </ol>
  295. <p>The test driver removes one MIG.</p>
  296. <p>Test driver asserts:</p>
  297. <ol type="1">
  298. <li>All RPCs are directed to the two remaining backends (no RPC failures).</li>
  299. </ol>
  300. <h2><a class="anchor" id="autotoc_md251"></a>
  301. change_backend_service</h2>
  302. <p>This test verifies that the backend service can be replaced and traffic routed to the new backends.</p>
  303. <p>Client parameters:</p>
  304. <ol type="1">
  305. <li>&ndash;num_channels=1</li>
  306. </ol>
  307. <ol type="1">
  308. <li>&ndash;qps=100</li>
  309. </ol>
  310. <ol type="1">
  311. <li>&ndash;fail_on_failed_rpc=true</li>
  312. </ol>
  313. <p>Load balancer configuration:</p>
  314. <ol type="1">
  315. <li>One MIG with two backends</li>
  316. </ol>
  317. <p>Test driver asserts:</p>
  318. <ol type="1">
  319. <li>All backends receive at least one RPC.</li>
  320. </ol>
  321. <p>The test driver creates a new backend service containing a MIG with two backends and changes the TD URL map to point to this new backend service.</p>
  322. <p>Test driver asserts:</p>
  323. <ol type="1">
  324. <li>All RPCs are directed to the new backend service.</li>
  325. </ol>
  326. <h2><a class="anchor" id="autotoc_md252"></a>
  327. traffic_splitting</h2>
  328. <p>This test verifies that the traffic will be distributed between backend services with the correct weights when route action is set to weighted backend services.</p>
  329. <p>Client parameters:</p>
  330. <ol type="1">
  331. <li>&ndash;num_channels=1</li>
  332. </ol>
  333. <ol type="1">
  334. <li>&ndash;qps=100</li>
  335. </ol>
  336. <p>Load balancer configuration:</p>
  337. <ol type="1">
  338. <li>One MIG with one backend</li>
  339. </ol>
  340. <p>Assert:</p>
  341. <ol type="1">
  342. <li>Once all backends receive at least one RPC, the following 1000 RPCs are all sent to MIG_a.</li>
  343. </ol>
  344. <p>The test driver adds a new MIG with 1 backend, and changes the route action to weighted backend services with {a: 20, b: 80}.</p>
  345. <p>Assert:</p>
  346. <ol type="1">
  347. <li>Once all backends receive at least one RPC, the following 1000 RPCs are distributed across the 2 backends as a: 20, b: 80.</li>
  348. </ol>
  349. <h2><a class="anchor" id="autotoc_md253"></a>
  350. gentle_failover</h2>
  351. <p>This test verifies that traffic is partially diverted to a secondary locality when &gt; 50% of the instances in the primary locality are unhealthy.</p>
  352. <p>Client parameters:</p>
  353. <ol type="1">
  354. <li>&ndash;num_channels=1</li>
  355. </ol>
  356. <ol type="1">
  357. <li>&ndash;qps=100</li>
  358. </ol>
  359. <p>Load balancer configuration:</p>
  360. <ol type="1">
  361. <li>The primary MIG with 3 backends in the same zone as the client</li>
  362. </ol>
  363. <ol type="1">
  364. <li>The secondary MIG with 2 backends in a different zone</li>
  365. </ol>
  366. <p>Test driver asserts:</p>
  367. <ol type="1">
  368. <li>All backends in the primary locality receive at least 1 RPC.</li>
  369. </ol>
  370. <ol type="1">
  371. <li>No backends in the secondary locality receive RPCs.</li>
  372. </ol>
  373. <p>The test driver stops 2 of 3 backends in the primary locality.</p>
  374. <p>Test driver asserts:</p>
  375. <ol type="1">
  376. <li>All backends in the secondary locality receive at least 1 RPC.</li>
  377. </ol>
  378. <ol type="1">
  379. <li>The remaining backend in the primary locality receives at least 1 RPC.</li>
  380. </ol>
  381. <p>The test driver resumes the backends in the primary locality.</p>
  382. <p>Test driver asserts:</p>
  383. <ol type="1">
  384. <li>All backends in the primary locality receive at least 1 RPC.</li>
  385. </ol>
  386. <ol type="1">
  387. <li>No backends in the secondary locality receive RPCs. </li>
  388. </ol>
  389. </div></div><!-- contents -->
  390. </div><!-- PageDoc -->
  391. <!-- start footer part -->
  392. <hr class="footer"/><address class="footer"><small>
  393. Generated on Thu Oct 22 2020 20:24:52 for GRPC C++ by &#160;<a href="http://www.doxygen.org/index.html">
  394. <img class="footer" src="doxygen.png" alt="doxygen"/>
  395. </a> 1.8.17
  396. </small></address>
  397. </body>
  398. </html>