scenario_config.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. # Copyright 2016, Google Inc.
  2. # All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions are
  6. # met:
  7. #
  8. # * Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. # * Redistributions in binary form must reproduce the above
  11. # copyright notice, this list of conditions and the following disclaimer
  12. # in the documentation and/or other materials provided with the
  13. # distribution.
  14. # * Neither the name of Google Inc. nor the names of its
  15. # contributors may be used to endorse or promote products derived from
  16. # this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. # performance scenario configuration for various languages
  30. import math
  31. WARMUP_SECONDS=5
  32. JAVA_WARMUP_SECONDS=15 # Java needs more warmup time for JIT to kick in.
  33. BENCHMARK_SECONDS=30
  34. SMOKETEST='smoketest'
  35. SCALABLE='scalable'
  36. SWEEP='sweep'
  37. DEFAULT_CATEGORIES=[SCALABLE, SMOKETEST]
  38. SECURE_SECARGS = {'use_test_ca': True,
  39. 'server_host_override': 'foo.test.google.fr'}
  40. HISTOGRAM_PARAMS = {
  41. 'resolution': 0.01,
  42. 'max_possible': 60e9,
  43. }
  44. EMPTY_GENERIC_PAYLOAD = {
  45. 'bytebuf_params': {
  46. 'req_size': 0,
  47. 'resp_size': 0,
  48. }
  49. }
  50. EMPTY_PROTO_PAYLOAD = {
  51. 'simple_params': {
  52. 'req_size': 0,
  53. 'resp_size': 0,
  54. }
  55. }
  56. BIG_GENERIC_PAYLOAD = {
  57. 'bytebuf_params': {
  58. 'req_size': 65536,
  59. 'resp_size': 65536,
  60. }
  61. }
  62. # target number of RPCs outstanding on across all client channels in
  63. # non-ping-pong tests (since we can only specify per-channel numbers, the
  64. # actual target will be slightly higher)
  65. OUTSTANDING_REQUESTS={
  66. 'async': 6400,
  67. 'sync': 1000
  68. }
  69. # wide is the number of client channels in multi-channel tests (1 otherwise)
  70. WIDE=64
  71. def _get_secargs(is_secure):
  72. if is_secure:
  73. return SECURE_SECARGS
  74. else:
  75. return None
  76. def remove_nonproto_fields(scenario):
  77. """Remove special-purpose that contains some extra info about the scenario
  78. but don't belong to the ScenarioConfig protobuf message"""
  79. scenario.pop('CATEGORIES', None)
  80. scenario.pop('CLIENT_LANGUAGE', None)
  81. scenario.pop('SERVER_LANGUAGE', None)
  82. return scenario
  83. def geometric_progression(start, stop, step):
  84. n = start
  85. while n < stop:
  86. yield int(round(n))
  87. n *= step
  88. def _ping_pong_scenario(name, rpc_type,
  89. client_type, server_type,
  90. secure=True,
  91. use_generic_payload=False,
  92. unconstrained_client=None,
  93. client_language=None,
  94. server_language=None,
  95. server_core_limit=0,
  96. async_server_threads=0,
  97. warmup_seconds=WARMUP_SECONDS,
  98. categories=DEFAULT_CATEGORIES,
  99. channels=None,
  100. outstanding=None):
  101. """Creates a basic ping pong scenario."""
  102. scenario = {
  103. 'name': name,
  104. 'num_servers': 1,
  105. 'num_clients': 1,
  106. 'client_config': {
  107. 'client_type': client_type,
  108. 'security_params': _get_secargs(secure),
  109. 'outstanding_rpcs_per_channel': 1,
  110. 'client_channels': 1,
  111. 'async_client_threads': 1,
  112. 'rpc_type': rpc_type,
  113. 'load_params': {
  114. 'closed_loop': {}
  115. },
  116. 'histogram_params': HISTOGRAM_PARAMS,
  117. },
  118. 'server_config': {
  119. 'server_type': server_type,
  120. 'security_params': _get_secargs(secure),
  121. 'core_limit': server_core_limit,
  122. 'async_server_threads': async_server_threads,
  123. },
  124. 'warmup_seconds': warmup_seconds,
  125. 'benchmark_seconds': BENCHMARK_SECONDS
  126. }
  127. if use_generic_payload:
  128. if server_type != 'ASYNC_GENERIC_SERVER':
  129. raise Exception('Use ASYNC_GENERIC_SERVER for generic payload.')
  130. scenario['client_config']['payload_config'] = EMPTY_GENERIC_PAYLOAD
  131. scenario['server_config']['payload_config'] = EMPTY_GENERIC_PAYLOAD
  132. else:
  133. # For proto payload, only the client should get the config.
  134. scenario['client_config']['payload_config'] = EMPTY_PROTO_PAYLOAD
  135. if unconstrained_client:
  136. outstanding_calls = outstanding if outstanding is not None else OUTSTANDING_REQUESTS[unconstrained_client]
  137. wide = channels if channels is not None else WIDE
  138. deep = int(math.ceil(1.0 * outstanding_calls / wide))
  139. scenario['num_clients'] = 0 # use as many client as available.
  140. scenario['client_config']['outstanding_rpcs_per_channel'] = deep
  141. scenario['client_config']['client_channels'] = wide
  142. scenario['client_config']['async_client_threads'] = 0
  143. else:
  144. scenario['client_config']['outstanding_rpcs_per_channel'] = 1
  145. scenario['client_config']['client_channels'] = 1
  146. scenario['client_config']['async_client_threads'] = 1
  147. if client_language:
  148. # the CLIENT_LANGUAGE field is recognized by run_performance_tests.py
  149. scenario['CLIENT_LANGUAGE'] = client_language
  150. if server_language:
  151. # the SERVER_LANGUAGE field is recognized by run_performance_tests.py
  152. scenario['SERVER_LANGUAGE'] = server_language
  153. if categories:
  154. scenario['CATEGORIES'] = categories
  155. return scenario
  156. class CXXLanguage:
  157. def __init__(self):
  158. self.safename = 'cxx'
  159. def worker_cmdline(self):
  160. return ['bins/opt/qps_worker']
  161. def worker_port_offset(self):
  162. return 0
  163. def scenarios(self):
  164. # TODO(ctiller): add 70% load latency test
  165. for secure in [True, False]:
  166. secstr = 'secure' if secure else 'insecure'
  167. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  168. yield _ping_pong_scenario(
  169. 'cpp_generic_async_streaming_ping_pong_%s' % secstr,
  170. rpc_type='STREAMING',
  171. client_type='ASYNC_CLIENT',
  172. server_type='ASYNC_GENERIC_SERVER',
  173. use_generic_payload=True, server_core_limit=1, async_server_threads=1,
  174. secure=secure,
  175. categories=smoketest_categories)
  176. yield _ping_pong_scenario(
  177. 'cpp_generic_async_streaming_qps_unconstrained_%s' % secstr,
  178. rpc_type='STREAMING',
  179. client_type='ASYNC_CLIENT',
  180. server_type='ASYNC_GENERIC_SERVER',
  181. unconstrained_client='async', use_generic_payload=True,
  182. secure=secure,
  183. categories=smoketest_categories+[SCALABLE])
  184. yield _ping_pong_scenario(
  185. 'cpp_generic_async_streaming_qps_one_server_core_%s' % secstr,
  186. rpc_type='STREAMING',
  187. client_type='ASYNC_CLIENT',
  188. server_type='ASYNC_GENERIC_SERVER',
  189. unconstrained_client='async', use_generic_payload=True,
  190. server_core_limit=1, async_server_threads=1,
  191. secure=secure)
  192. yield _ping_pong_scenario(
  193. 'cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_%s' %
  194. (secstr),
  195. rpc_type='UNARY',
  196. client_type='ASYNC_CLIENT',
  197. server_type='SYNC_SERVER',
  198. unconstrained_client='async',
  199. secure=secure,
  200. categories=smoketest_categories + [SCALABLE])
  201. yield _ping_pong_scenario(
  202. 'cpp_protobuf_async_client_sync_server_streaming_qps_unconstrained_%s' % secstr,
  203. rpc_type='STREAMING',
  204. client_type='ASYNC_CLIENT',
  205. server_type='SYNC_SERVER',
  206. unconstrained_client='async',
  207. secure=secure,
  208. categories=smoketest_categories+[SCALABLE])
  209. for rpc_type in ['unary', 'streaming']:
  210. for synchronicity in ['sync', 'async']:
  211. yield _ping_pong_scenario(
  212. 'cpp_protobuf_%s_%s_ping_pong_%s' % (synchronicity, rpc_type, secstr),
  213. rpc_type=rpc_type.upper(),
  214. client_type='%s_CLIENT' % synchronicity.upper(),
  215. server_type='%s_SERVER' % synchronicity.upper(),
  216. server_core_limit=1, async_server_threads=1,
  217. secure=secure)
  218. yield _ping_pong_scenario(
  219. 'cpp_protobuf_%s_%s_qps_unconstrained_%s' % (synchronicity, rpc_type, secstr),
  220. rpc_type=rpc_type.upper(),
  221. client_type='%s_CLIENT' % synchronicity.upper(),
  222. server_type='%s_SERVER' % synchronicity.upper(),
  223. unconstrained_client=synchronicity,
  224. secure=secure,
  225. categories=smoketest_categories+[SCALABLE])
  226. for channels in geometric_progression(1, 20000, math.sqrt(10)):
  227. for outstanding in geometric_progression(1, 200000, math.sqrt(10)):
  228. if synchronicity == 'sync' and outstanding > 1200: continue
  229. if outstanding < channels: continue
  230. yield _ping_pong_scenario(
  231. 'cpp_protobuf_%s_%s_qps_unconstrained_%s_%d_channels_%d_outstanding' % (synchronicity, rpc_type, secstr, channels, outstanding),
  232. rpc_type=rpc_type.upper(),
  233. client_type='%s_CLIENT' % synchronicity.upper(),
  234. server_type='%s_SERVER' % synchronicity.upper(),
  235. unconstrained_client=synchronicity, secure=secure,
  236. categories=[SWEEP], channels=channels, outstanding=outstanding)
  237. def __str__(self):
  238. return 'c++'
  239. class CSharpLanguage:
  240. def __init__(self):
  241. self.safename = str(self)
  242. def worker_cmdline(self):
  243. return ['tools/run_tests/performance/run_worker_csharp.sh']
  244. def worker_port_offset(self):
  245. return 100
  246. def scenarios(self):
  247. yield _ping_pong_scenario(
  248. 'csharp_generic_async_streaming_ping_pong', rpc_type='STREAMING',
  249. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  250. use_generic_payload=True,
  251. categories=[SMOKETEST, SCALABLE])
  252. yield _ping_pong_scenario(
  253. 'csharp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  254. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  255. yield _ping_pong_scenario(
  256. 'csharp_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  257. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  258. categories=[SMOKETEST, SCALABLE])
  259. yield _ping_pong_scenario(
  260. 'csharp_protobuf_sync_to_async_unary_ping_pong', rpc_type='UNARY',
  261. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER')
  262. yield _ping_pong_scenario(
  263. 'csharp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  264. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  265. unconstrained_client='async',
  266. categories=[SMOKETEST,SCALABLE])
  267. yield _ping_pong_scenario(
  268. 'csharp_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING',
  269. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  270. unconstrained_client='async',
  271. categories=[SCALABLE])
  272. yield _ping_pong_scenario(
  273. 'csharp_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  274. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  275. server_language='c++', server_core_limit=1, async_server_threads=1,
  276. categories=[SMOKETEST, SCALABLE])
  277. yield _ping_pong_scenario(
  278. 'csharp_to_cpp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  279. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  280. server_language='c++', server_core_limit=1, async_server_threads=1)
  281. yield _ping_pong_scenario(
  282. 'csharp_to_cpp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  283. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  284. unconstrained_client='async', server_language='c++',
  285. categories=[SCALABLE])
  286. yield _ping_pong_scenario(
  287. 'csharp_to_cpp_protobuf_sync_to_async_unary_qps_unconstrained', rpc_type='UNARY',
  288. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  289. unconstrained_client='sync', server_language='c++',
  290. categories=[SCALABLE])
  291. yield _ping_pong_scenario(
  292. 'cpp_to_csharp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  293. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  294. unconstrained_client='async', client_language='c++',
  295. categories=[SCALABLE])
  296. def __str__(self):
  297. return 'csharp'
  298. class NodeLanguage:
  299. def __init__(self):
  300. pass
  301. self.safename = str(self)
  302. def worker_cmdline(self):
  303. return ['tools/run_tests/performance/run_worker_node.sh']
  304. def worker_port_offset(self):
  305. return 200
  306. def scenarios(self):
  307. # TODO(jtattermusch): make this scenario work
  308. #yield _ping_pong_scenario(
  309. # 'node_generic_async_streaming_ping_pong', rpc_type='STREAMING',
  310. # client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  311. # use_generic_payload=True)
  312. # TODO(jtattermusch): make this scenario work
  313. #yield _ping_pong_scenario(
  314. # 'node_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  315. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  316. yield _ping_pong_scenario(
  317. 'node_protobuf_unary_ping_pong', rpc_type='UNARY',
  318. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  319. categories=[SCALABLE, SMOKETEST])
  320. yield _ping_pong_scenario(
  321. 'cpp_to_node_unary_ping_pong', rpc_type='UNARY',
  322. client_type='ASYNC_CLIENT', server_type='async_server',
  323. client_language='c++')
  324. yield _ping_pong_scenario(
  325. 'node_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  326. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  327. unconstrained_client='async',
  328. categories=[SCALABLE, SMOKETEST])
  329. # TODO(jtattermusch): make this scenario work
  330. #yield _ping_pong_scenario(
  331. # 'node_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING',
  332. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  333. # unconstrained_client='async')
  334. # TODO(jtattermusch): make this scenario work
  335. #yield _ping_pong_scenario(
  336. # 'node_to_cpp_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  337. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  338. # server_language='c++', server_core_limit=1, async_server_threads=1)
  339. # TODO(jtattermusch): make this scenario work
  340. #yield _ping_pong_scenario(
  341. # 'node_to_cpp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  342. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  343. # server_language='c++', server_core_limit=1, async_server_threads=1)
  344. def __str__(self):
  345. return 'node'
  346. class PythonLanguage:
  347. def __init__(self):
  348. self.safename = 'python'
  349. def worker_cmdline(self):
  350. return ['tools/run_tests/performance/run_worker_python.sh']
  351. def worker_port_offset(self):
  352. return 500
  353. def scenarios(self):
  354. yield _ping_pong_scenario(
  355. 'python_generic_sync_streaming_ping_pong', rpc_type='STREAMING',
  356. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  357. use_generic_payload=True,
  358. categories=[SMOKETEST, SCALABLE])
  359. yield _ping_pong_scenario(
  360. 'python_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  361. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER')
  362. yield _ping_pong_scenario(
  363. 'python_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  364. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  365. yield _ping_pong_scenario(
  366. 'python_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  367. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  368. categories=[SMOKETEST, SCALABLE])
  369. yield _ping_pong_scenario(
  370. 'python_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY',
  371. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  372. unconstrained_client='sync')
  373. yield _ping_pong_scenario(
  374. 'python_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING',
  375. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  376. unconstrained_client='sync')
  377. yield _ping_pong_scenario(
  378. 'python_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  379. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  380. server_language='c++', server_core_limit=1, async_server_threads=1,
  381. categories=[SMOKETEST, SCALABLE])
  382. yield _ping_pong_scenario(
  383. 'python_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  384. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  385. server_language='c++', server_core_limit=1, async_server_threads=1)
  386. def __str__(self):
  387. return 'python'
  388. class RubyLanguage:
  389. def __init__(self):
  390. pass
  391. self.safename = str(self)
  392. def worker_cmdline(self):
  393. return ['tools/run_tests/performance/run_worker_ruby.sh']
  394. def worker_port_offset(self):
  395. return 300
  396. def scenarios(self):
  397. yield _ping_pong_scenario(
  398. 'ruby_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  399. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  400. categories=[SMOKETEST, SCALABLE])
  401. yield _ping_pong_scenario(
  402. 'ruby_protobuf_unary_ping_pong', rpc_type='UNARY',
  403. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  404. categories=[SMOKETEST, SCALABLE])
  405. yield _ping_pong_scenario(
  406. 'ruby_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY',
  407. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  408. unconstrained_client='sync')
  409. yield _ping_pong_scenario(
  410. 'ruby_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING',
  411. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  412. unconstrained_client='sync')
  413. yield _ping_pong_scenario(
  414. 'ruby_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  415. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  416. server_language='c++', server_core_limit=1, async_server_threads=1)
  417. yield _ping_pong_scenario(
  418. 'ruby_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  419. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  420. server_language='c++', server_core_limit=1, async_server_threads=1)
  421. def __str__(self):
  422. return 'ruby'
  423. class JavaLanguage:
  424. def __init__(self):
  425. pass
  426. self.safename = str(self)
  427. def worker_cmdline(self):
  428. return ['tools/run_tests/performance/run_worker_java.sh']
  429. def worker_port_offset(self):
  430. return 400
  431. def scenarios(self):
  432. for secure in [True, False]:
  433. secstr = 'secure' if secure else 'insecure'
  434. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  435. yield _ping_pong_scenario(
  436. 'java_generic_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  437. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  438. use_generic_payload=True, async_server_threads=1,
  439. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  440. categories=smoketest_categories)
  441. yield _ping_pong_scenario(
  442. 'java_protobuf_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  443. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  444. async_server_threads=1,
  445. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  446. yield _ping_pong_scenario(
  447. 'java_protobuf_async_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  448. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  449. async_server_threads=1,
  450. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  451. categories=smoketest_categories)
  452. yield _ping_pong_scenario(
  453. 'java_protobuf_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  454. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  455. async_server_threads=1,
  456. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  457. yield _ping_pong_scenario(
  458. 'java_protobuf_async_unary_qps_unconstrained_%s' % secstr, rpc_type='UNARY',
  459. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  460. unconstrained_client='async',
  461. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  462. categories=smoketest_categories+[SCALABLE])
  463. yield _ping_pong_scenario(
  464. 'java_protobuf_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  465. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  466. unconstrained_client='async',
  467. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  468. categories=[SCALABLE])
  469. yield _ping_pong_scenario(
  470. 'java_generic_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  471. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  472. unconstrained_client='async', use_generic_payload=True,
  473. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  474. categories=[SCALABLE])
  475. yield _ping_pong_scenario(
  476. 'java_generic_async_streaming_qps_one_server_core_%s' % secstr, rpc_type='STREAMING',
  477. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  478. unconstrained_client='async', use_generic_payload=True,
  479. async_server_threads=1,
  480. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  481. # TODO(jtattermusch): add scenarios java vs C++
  482. def __str__(self):
  483. return 'java'
  484. class GoLanguage:
  485. def __init__(self):
  486. pass
  487. self.safename = str(self)
  488. def worker_cmdline(self):
  489. return ['tools/run_tests/performance/run_worker_go.sh']
  490. def worker_port_offset(self):
  491. return 600
  492. def scenarios(self):
  493. for secure in [True, False]:
  494. secstr = 'secure' if secure else 'insecure'
  495. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  496. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  497. # but that's mostly because of lack of better name of the enum value.
  498. yield _ping_pong_scenario(
  499. 'go_generic_sync_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  500. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  501. use_generic_payload=True, async_server_threads=1,
  502. secure=secure,
  503. categories=smoketest_categories)
  504. yield _ping_pong_scenario(
  505. 'go_protobuf_sync_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  506. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  507. async_server_threads=1,
  508. secure=secure)
  509. yield _ping_pong_scenario(
  510. 'go_protobuf_sync_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  511. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  512. async_server_threads=1,
  513. secure=secure,
  514. categories=smoketest_categories)
  515. # unconstrained_client='async' is intended (client uses goroutines)
  516. yield _ping_pong_scenario(
  517. 'go_protobuf_sync_unary_qps_unconstrained_%s' % secstr, rpc_type='UNARY',
  518. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  519. unconstrained_client='async',
  520. secure=secure,
  521. categories=smoketest_categories+[SCALABLE])
  522. # unconstrained_client='async' is intended (client uses goroutines)
  523. yield _ping_pong_scenario(
  524. 'go_protobuf_sync_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  525. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  526. unconstrained_client='async',
  527. secure=secure,
  528. categories=[SCALABLE])
  529. # unconstrained_client='async' is intended (client uses goroutines)
  530. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  531. # but that's mostly because of lack of better name of the enum value.
  532. yield _ping_pong_scenario(
  533. 'go_generic_sync_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  534. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  535. unconstrained_client='async', use_generic_payload=True,
  536. secure=secure,
  537. categories=[SCALABLE])
  538. # TODO(jtattermusch): add scenarios go vs C++
  539. def __str__(self):
  540. return 'go'
  541. LANGUAGES = {
  542. 'c++' : CXXLanguage(),
  543. 'csharp' : CSharpLanguage(),
  544. 'node' : NodeLanguage(),
  545. 'ruby' : RubyLanguage(),
  546. 'java' : JavaLanguage(),
  547. 'python' : PythonLanguage(),
  548. 'go' : GoLanguage(),
  549. }