grpc/cpp/md_doc_xds-test-description...

383 lines
15 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GRPC C++: xDS (Load-Balancing) Interop Test Case Descriptions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">GRPC C++
&#160;<span id="projectnumber">1.31.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">xDS (Load-Balancing) Interop Test Case Descriptions </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Client and server use <a href="../src/proto/grpc/testing/test.proto">test.proto</a>.</p>
<h1><a class="anchor" id="autotoc_md240"></a>
Server</h1>
<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>
<p>Server should accept these arguments:</p>
<ul>
<li>&ndash;port=PORT<ul>
<li>The port the server will run on.</li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md241"></a>
Client</h1>
<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>
<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>
<p>Clients should accept these arguments:</p>
<ul>
<li>&ndash;fail_on_failed_rpcs=BOOL<ul>
<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>
</ul>
</li>
<li>&ndash;num_channels=CHANNELS<ul>
<li>The number of channels to create to the server.</li>
</ul>
</li>
<li>&ndash;qps=QPS<ul>
<li>The QPS per channel.</li>
</ul>
</li>
<li>&ndash;server=HOSTNAME:PORT<ul>
<li>The server host to connect to. For example, "localhost:8080"</li>
</ul>
</li>
<li>&ndash;stats_port=PORT<ul>
<li>The port for to expose the client's <code>LoadBalancerStatsService</code> implementation.</li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md242"></a>
Test Driver</h1>
<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>
<h1><a class="anchor" id="autotoc_md243"></a>
LoadBalancerStatsService</h1>
<p>The service is defined as:</p>
<div class="fragment"><div class="line">message LoadBalancerStatsRequest {</div>
<div class="line"> // Request stats for the next num_rpcs sent by client.</div>
<div class="line"> int32 num_rpcs = 1;</div>
<div class="line"> // If num_rpcs have not completed within timeout_sec, return partial results.</div>
<div class="line"> int32 timeout_sec = 2;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line">message LoadBalancerStatsResponse {</div>
<div class="line"> // The number of completed RPCs for each peer.</div>
<div class="line"> map&lt;string, int32&gt; rpcs_by_peer = 1;</div>
<div class="line"> // The number of RPCs that failed to record a remote peer.</div>
<div class="line"> int32 num_failures = 2;</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line">service LoadBalancerStatsService {</div>
<div class="line"> // Gets the backend distribution for RPCs sent by a test client.</div>
<div class="line"> rpc GetClientStats(LoadBalancerStatsRequest)</div>
<div class="line"> returns (LoadBalancerStatsResponse) {}</div>
<div class="line">}</div>
</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>
<h1><a class="anchor" id="autotoc_md244"></a>
Test Cases</h1>
<h2><a class="anchor" id="autotoc_md245"></a>
ping_pong</h2>
<p>This test verifies that every backend receives traffic.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<ol type="1">
<li>&ndash;fail_on_failed_rpc=true</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>4 backends are created in a single managed instance group (MIG).</li>
</ol>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends receive at least one RPC</li>
</ol>
<h2><a class="anchor" id="autotoc_md246"></a>
round_robin</h2>
<p>This test verifies that RPCs are evenly routed according to an unweighted round robin policy.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<ol type="1">
<li>&ndash;fail_on_failed_rpc=true</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>4 backends are created in a single MIG.</li>
</ol>
<p>Test driver asserts that:</p>
<ol type="1">
<li>Once all backends receive at least one RPC, the following 100 RPCs are evenly distributed across the 4 backends.</li>
</ol>
<h2><a class="anchor" id="autotoc_md247"></a>
backends_restart</h2>
<p>This test verifies that the load balancer will resume sending traffic to a set of backends that is stopped and then resumed.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>4 backends are created in a single MIG.</li>
</ol>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends receive at least one RPC.</li>
</ol>
<p>The test driver records the peer distribution for a subsequent block of 100 RPCs then stops the backends.</p>
<p>Test driver asserts:</p>
<ol type="1">
<li>No RPCs from the client are successful.</li>
</ol>
<p>The test driver resumes the backends.</p>
<p>Test driver asserts:</p>
<ol type="1">
<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>
</ol>
<h2><a class="anchor" id="autotoc_md248"></a>
secondary_locality_gets_requests_on_primary_failure</h2>
<p>This test verifies that backends in a secondary locality receive traffic when all backends in the primary locality fail.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>The primary MIG with 2 backends in the same zone as the client</li>
</ol>
<ol type="1">
<li>The secondary MIG with 2 backends in a different zone</li>
</ol>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends in the primary locality receive at least 1 RPC.</li>
</ol>
<ol type="1">
<li>No backends in the secondary locality receive RPCs.</li>
</ol>
<p>The test driver stops the backends in the primary locality.</p>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends in the secondary locality receive at least 1 RPC.</li>
</ol>
<p>The test driver resumes the backends in the primary locality.</p>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends in the primary locality receive at least 1 RPC.</li>
</ol>
<ol type="1">
<li>No backends in the secondary locality receive RPCs.</li>
</ol>
<h2><a class="anchor" id="autotoc_md249"></a>
secondary_locality_gets_no_requests_on_partial_primary_failure</h2>
<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>
<p><b>Note:</b> Future TD features may change the expected behavior and require changes to this test case.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>The primary MIG with 2 backends in the same zone as the client</li>
</ol>
<ol type="1">
<li>The secondary MIG with 2 backends in a different zone</li>
</ol>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends in the primary locality receive at least 1 RPC.</li>
</ol>
<ol type="1">
<li>No backends in the secondary locality receive RPCs.</li>
</ol>
<p>The test driver stops one of the backends in the primary locality.</p>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends in the primary locality receive at least 1 RPC.</li>
</ol>
<ol type="1">
<li>No backends in the secondary locality receive RPCs.</li>
</ol>
<h2><a class="anchor" id="autotoc_md250"></a>
new_instance_group_receives_traffic</h2>
<p>This test verifies that new instance groups added to a backend service in the same zone receive traffic.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<ol type="1">
<li>&ndash;fail_on_failed_rpc=true</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>One MIG with two backends, using rate balancing mode.</li>
</ol>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends receive at least one RPC.</li>
</ol>
<p>The test driver adds a new MIG with two backends in the same zone.</p>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends in each MIG receive at least one RPC.</li>
</ol>
<h2><a class="anchor" id="autotoc_md251"></a>
remove_instance_group</h2>
<p>This test verifies that a remaining instance group can successfully serve RPCs after removal of another instance group in the same zone.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>Two MIGs with two backends each, using rate balancing mode.</li>
</ol>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends receive at least one RPC.</li>
</ol>
<p>The test driver removes one MIG.</p>
<p>Test driver asserts:</p>
<ol type="1">
<li>All RPCs are directed to the two remaining backends (no RPC failures).</li>
</ol>
<h2><a class="anchor" id="autotoc_md252"></a>
change_backend_service</h2>
<p>This test verifies that the backend service can be replaced and traffic routed to the new backends.</p>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<ol type="1">
<li>&ndash;fail_on_failed_rpc=true</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>One MIG with two backends</li>
</ol>
<p>Test driver asserts:</p>
<ol type="1">
<li>All backends receive at least one RPC.</li>
</ol>
<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>
<p>Test driver asserts:</p>
<ol type="1">
<li>All RPCs are directed to the new backend service.</li>
</ol>
<h2><a class="anchor" id="autotoc_md253"></a>
traffic_splitting</h2>
<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>
<p>Client parameters:</p>
<ol type="1">
<li>&ndash;num_channels=1</li>
</ol>
<ol type="1">
<li>&ndash;qps=100</li>
</ol>
<p>Load balancer configuration:</p>
<ol type="1">
<li>One MIG with one backend</li>
</ol>
<p>Assert:</p>
<ol type="1">
<li>Once all backends receive at least one RPC, the following 1000 RPCs are all sent to MIG_a.</li>
</ol>
<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>
<p>Assert:</p>
<ol type="1">
<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>
</ol>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 18 2020 16:24:48 for GRPC C++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>