scenario_config.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  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. # target number of RPCs outstanding on across all client channels in
  45. # non-ping-pong tests (since we can only specify per-channel numbers, the
  46. # actual target will be slightly higher)
  47. OUTSTANDING_REQUESTS={
  48. 'async': 6400,
  49. 'sync': 1000
  50. }
  51. # wide is the number of client channels in multi-channel tests (1 otherwise)
  52. WIDE=64
  53. def _get_secargs(is_secure):
  54. if is_secure:
  55. return SECURE_SECARGS
  56. else:
  57. return None
  58. def remove_nonproto_fields(scenario):
  59. """Remove special-purpose that contains some extra info about the scenario
  60. but don't belong to the ScenarioConfig protobuf message"""
  61. scenario.pop('CATEGORIES', None)
  62. scenario.pop('CLIENT_LANGUAGE', None)
  63. scenario.pop('SERVER_LANGUAGE', None)
  64. return scenario
  65. def geometric_progression(start, stop, step):
  66. n = start
  67. while n < stop:
  68. yield int(round(n))
  69. n *= step
  70. def _payload_type(use_generic_payload, req_size, resp_size):
  71. r = {}
  72. sizes = {
  73. 'req_size': req_size,
  74. 'resp_size': resp_size,
  75. }
  76. if use_generic_payload:
  77. r['bytebuf_params'] = sizes
  78. else:
  79. r['simple_params'] = sizes
  80. def _ping_pong_scenario(name, rpc_type,
  81. client_type, server_type,
  82. secure=True,
  83. use_generic_payload=False,
  84. req_size=0,
  85. resp_size=0,
  86. unconstrained_client=None,
  87. client_language=None,
  88. server_language=None,
  89. async_server_threads=0,
  90. warmup_seconds=WARMUP_SECONDS,
  91. categories=DEFAULT_CATEGORIES,
  92. channels=None,
  93. outstanding=None,
  94. resource_quota_size=None):
  95. """Creates a basic ping pong scenario."""
  96. scenario = {
  97. 'name': name,
  98. 'num_servers': 1,
  99. 'num_clients': 1,
  100. 'client_config': {
  101. 'client_type': client_type,
  102. 'security_params': _get_secargs(secure),
  103. 'outstanding_rpcs_per_channel': 1,
  104. 'client_channels': 1,
  105. 'async_client_threads': 1,
  106. 'rpc_type': rpc_type,
  107. 'load_params': {
  108. 'closed_loop': {}
  109. },
  110. 'histogram_params': HISTOGRAM_PARAMS,
  111. },
  112. 'server_config': {
  113. 'server_type': server_type,
  114. 'security_params': _get_secargs(secure),
  115. 'async_server_threads': async_server_threads,
  116. },
  117. 'warmup_seconds': warmup_seconds,
  118. 'benchmark_seconds': BENCHMARK_SECONDS
  119. }
  120. if resource_quota_size:
  121. scenario['server_config']['resource_quota_size'] = resource_quota_size
  122. if use_generic_payload:
  123. if server_type != 'ASYNC_GENERIC_SERVER':
  124. raise Exception('Use ASYNC_GENERIC_SERVER for generic payload.')
  125. scenario['client_config']['payload_config'] = _payload_type(use_generic_payload, req_size, resp_size)
  126. scenario['server_config']['payload_config'] = _payload_type(use_generic_payload, req_size, resp_size)
  127. if unconstrained_client:
  128. outstanding_calls = outstanding if outstanding is not None else OUTSTANDING_REQUESTS[unconstrained_client]
  129. wide = channels if channels is not None else WIDE
  130. deep = int(math.ceil(1.0 * outstanding_calls / wide))
  131. scenario['num_clients'] = 0 # use as many client as available.
  132. scenario['client_config']['outstanding_rpcs_per_channel'] = deep
  133. scenario['client_config']['client_channels'] = wide
  134. scenario['client_config']['async_client_threads'] = 0
  135. else:
  136. scenario['client_config']['outstanding_rpcs_per_channel'] = 1
  137. scenario['client_config']['client_channels'] = 1
  138. scenario['client_config']['async_client_threads'] = 1
  139. if client_language:
  140. # the CLIENT_LANGUAGE field is recognized by run_performance_tests.py
  141. scenario['CLIENT_LANGUAGE'] = client_language
  142. if server_language:
  143. # the SERVER_LANGUAGE field is recognized by run_performance_tests.py
  144. scenario['SERVER_LANGUAGE'] = server_language
  145. if categories:
  146. scenario['CATEGORIES'] = categories
  147. return scenario
  148. class CXXLanguage:
  149. def __init__(self):
  150. self.safename = 'cxx'
  151. def worker_cmdline(self):
  152. return ['bins/opt/qps_worker']
  153. def worker_port_offset(self):
  154. return 0
  155. def scenarios(self):
  156. # TODO(ctiller): add 70% load latency test
  157. for secure in [True, False]:
  158. secstr = 'secure' if secure else 'insecure'
  159. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  160. yield _ping_pong_scenario(
  161. 'cpp_generic_async_streaming_ping_pong_%s' % secstr,
  162. rpc_type='STREAMING',
  163. client_type='ASYNC_CLIENT',
  164. server_type='ASYNC_GENERIC_SERVER',
  165. use_generic_payload=True, async_server_threads=1,
  166. secure=secure,
  167. categories=smoketest_categories)
  168. yield _ping_pong_scenario(
  169. 'cpp_generic_async_streaming_qps_unconstrained_%s' % secstr,
  170. rpc_type='STREAMING',
  171. client_type='ASYNC_CLIENT',
  172. server_type='ASYNC_GENERIC_SERVER',
  173. unconstrained_client='async', use_generic_payload=True,
  174. secure=secure,
  175. categories=smoketest_categories+[SCALABLE])
  176. yield _ping_pong_scenario(
  177. 'cpp_generic_async_streaming_qps_one_server_core_%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. async_server_threads=1,
  183. secure=secure)
  184. yield _ping_pong_scenario(
  185. 'cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_%s' %
  186. (secstr),
  187. rpc_type='UNARY',
  188. client_type='ASYNC_CLIENT',
  189. server_type='SYNC_SERVER',
  190. unconstrained_client='async',
  191. secure=secure,
  192. categories=smoketest_categories + [SCALABLE])
  193. yield _ping_pong_scenario(
  194. 'cpp_protobuf_async_client_sync_server_streaming_qps_unconstrained_%s' % secstr,
  195. rpc_type='STREAMING',
  196. client_type='ASYNC_CLIENT',
  197. server_type='SYNC_SERVER',
  198. unconstrained_client='async',
  199. secure=secure,
  200. categories=smoketest_categories+[SCALABLE])
  201. for rpc_type in ['unary', 'streaming']:
  202. for synchronicity in ['sync', 'async']:
  203. yield _ping_pong_scenario(
  204. 'cpp_protobuf_%s_%s_ping_pong_%s' % (synchronicity, rpc_type, secstr),
  205. rpc_type=rpc_type.upper(),
  206. client_type='%s_CLIENT' % synchronicity.upper(),
  207. server_type='%s_SERVER' % synchronicity.upper(),
  208. async_server_threads=1,
  209. secure=secure)
  210. yield _ping_pong_scenario(
  211. 'cpp_protobuf_%s_%s_qps_unconstrained_%s' % (synchronicity, rpc_type, secstr),
  212. rpc_type=rpc_type.upper(),
  213. client_type='%s_CLIENT' % synchronicity.upper(),
  214. server_type='%s_SERVER' % synchronicity.upper(),
  215. unconstrained_client=synchronicity,
  216. secure=secure,
  217. categories=smoketest_categories+[SCALABLE])
  218. yield _ping_pong_scenario(
  219. 'cpp_protobuf_%s_%s_qps_unconstrained_%s_500kib_resource_quota' % (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. resource_quota_size=500*1024)
  227. for channels in geometric_progression(1, 20000, math.sqrt(10)):
  228. for outstanding in geometric_progression(1, 200000, math.sqrt(10)):
  229. if synchronicity == 'sync' and outstanding > 1200: continue
  230. if outstanding < channels: continue
  231. yield _ping_pong_scenario(
  232. 'cpp_protobuf_%s_%s_qps_unconstrained_%s_%d_channels_%d_outstanding' % (synchronicity, rpc_type, secstr, channels, outstanding),
  233. rpc_type=rpc_type.upper(),
  234. client_type='%s_CLIENT' % synchronicity.upper(),
  235. server_type='%s_SERVER' % synchronicity.upper(),
  236. unconstrained_client=synchronicity, secure=secure,
  237. categories=[SWEEP], channels=channels, outstanding=outstanding)
  238. def __str__(self):
  239. return 'c++'
  240. class CSharpLanguage:
  241. def __init__(self):
  242. self.safename = str(self)
  243. def worker_cmdline(self):
  244. return ['tools/run_tests/performance/run_worker_csharp.sh']
  245. def worker_port_offset(self):
  246. return 100
  247. def scenarios(self):
  248. yield _ping_pong_scenario(
  249. 'csharp_generic_async_streaming_ping_pong', rpc_type='STREAMING',
  250. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  251. use_generic_payload=True,
  252. categories=[SMOKETEST, SCALABLE])
  253. yield _ping_pong_scenario(
  254. 'csharp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  255. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  256. yield _ping_pong_scenario(
  257. 'csharp_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  258. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  259. categories=[SMOKETEST, SCALABLE])
  260. yield _ping_pong_scenario(
  261. 'csharp_protobuf_sync_to_async_unary_ping_pong', rpc_type='UNARY',
  262. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER')
  263. yield _ping_pong_scenario(
  264. 'csharp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  265. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  266. unconstrained_client='async',
  267. categories=[SMOKETEST,SCALABLE])
  268. yield _ping_pong_scenario(
  269. 'csharp_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING',
  270. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  271. unconstrained_client='async',
  272. categories=[SCALABLE])
  273. yield _ping_pong_scenario(
  274. 'csharp_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  275. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  276. server_language='c++', async_server_threads=1,
  277. categories=[SMOKETEST, SCALABLE])
  278. yield _ping_pong_scenario(
  279. 'csharp_to_cpp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  280. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  281. server_language='c++', async_server_threads=1)
  282. yield _ping_pong_scenario(
  283. 'csharp_to_cpp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  284. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  285. unconstrained_client='async', server_language='c++',
  286. categories=[SCALABLE])
  287. yield _ping_pong_scenario(
  288. 'csharp_to_cpp_protobuf_sync_to_async_unary_qps_unconstrained', rpc_type='UNARY',
  289. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  290. unconstrained_client='sync', server_language='c++',
  291. categories=[SCALABLE])
  292. yield _ping_pong_scenario(
  293. 'cpp_to_csharp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  294. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  295. unconstrained_client='async', client_language='c++',
  296. categories=[SCALABLE])
  297. def __str__(self):
  298. return 'csharp'
  299. class NodeLanguage:
  300. def __init__(self):
  301. pass
  302. self.safename = str(self)
  303. def worker_cmdline(self):
  304. return ['tools/run_tests/performance/run_worker_node.sh',
  305. '--benchmark_impl=grpc']
  306. def worker_port_offset(self):
  307. return 200
  308. def scenarios(self):
  309. # TODO(jtattermusch): make this scenario work
  310. #yield _ping_pong_scenario(
  311. # 'node_generic_async_streaming_ping_pong', rpc_type='STREAMING',
  312. # client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  313. # use_generic_payload=True)
  314. # TODO(jtattermusch): make this scenario work
  315. #yield _ping_pong_scenario(
  316. # 'node_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  317. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  318. yield _ping_pong_scenario(
  319. 'node_protobuf_unary_ping_pong', rpc_type='UNARY',
  320. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  321. categories=[SCALABLE, SMOKETEST])
  322. yield _ping_pong_scenario(
  323. 'cpp_to_node_unary_ping_pong', rpc_type='UNARY',
  324. client_type='ASYNC_CLIENT', server_type='async_server',
  325. client_language='c++')
  326. yield _ping_pong_scenario(
  327. 'node_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  328. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  329. unconstrained_client='async',
  330. categories=[SCALABLE, SMOKETEST])
  331. # TODO(jtattermusch): make this scenario work
  332. #yield _ping_pong_scenario(
  333. # 'node_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING',
  334. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  335. # unconstrained_client='async')
  336. # TODO(jtattermusch): make this scenario work
  337. #yield _ping_pong_scenario(
  338. # 'node_to_cpp_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  339. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  340. # server_language='c++', async_server_threads=1)
  341. # TODO(jtattermusch): make this scenario work
  342. #yield _ping_pong_scenario(
  343. # 'node_to_cpp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  344. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  345. # server_language='c++', async_server_threads=1)
  346. def __str__(self):
  347. return 'node'
  348. class PythonLanguage:
  349. def __init__(self):
  350. self.safename = 'python'
  351. def worker_cmdline(self):
  352. return ['tools/run_tests/performance/run_worker_python.sh']
  353. def worker_port_offset(self):
  354. return 500
  355. def scenarios(self):
  356. yield _ping_pong_scenario(
  357. 'python_generic_sync_streaming_ping_pong', rpc_type='STREAMING',
  358. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  359. use_generic_payload=True,
  360. categories=[SMOKETEST, SCALABLE])
  361. yield _ping_pong_scenario(
  362. 'python_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  363. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER')
  364. yield _ping_pong_scenario(
  365. 'python_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  366. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  367. yield _ping_pong_scenario(
  368. 'python_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  369. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  370. categories=[SMOKETEST, SCALABLE])
  371. yield _ping_pong_scenario(
  372. 'python_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY',
  373. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  374. unconstrained_client='sync')
  375. yield _ping_pong_scenario(
  376. 'python_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING',
  377. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  378. unconstrained_client='sync')
  379. yield _ping_pong_scenario(
  380. 'python_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  381. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  382. server_language='c++', async_server_threads=1,
  383. categories=[SMOKETEST, SCALABLE])
  384. yield _ping_pong_scenario(
  385. 'python_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  386. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
  387. server_language='c++', async_server_threads=1)
  388. def __str__(self):
  389. return 'python'
  390. class RubyLanguage:
  391. def __init__(self):
  392. pass
  393. self.safename = str(self)
  394. def worker_cmdline(self):
  395. return ['tools/run_tests/performance/run_worker_ruby.sh']
  396. def worker_port_offset(self):
  397. return 300
  398. def scenarios(self):
  399. yield _ping_pong_scenario(
  400. 'ruby_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  401. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  402. categories=[SMOKETEST, SCALABLE])
  403. yield _ping_pong_scenario(
  404. 'ruby_protobuf_unary_ping_pong', rpc_type='UNARY',
  405. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  406. categories=[SMOKETEST, SCALABLE])
  407. yield _ping_pong_scenario(
  408. 'ruby_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY',
  409. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  410. unconstrained_client='sync')
  411. yield _ping_pong_scenario(
  412. 'ruby_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING',
  413. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  414. unconstrained_client='sync')
  415. yield _ping_pong_scenario(
  416. 'ruby_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  417. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  418. server_language='c++', async_server_threads=1)
  419. yield _ping_pong_scenario(
  420. 'ruby_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  421. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  422. server_language='c++', async_server_threads=1)
  423. def __str__(self):
  424. return 'ruby'
  425. class JavaLanguage:
  426. def __init__(self):
  427. pass
  428. self.safename = str(self)
  429. def worker_cmdline(self):
  430. return ['tools/run_tests/performance/run_worker_java.sh']
  431. def worker_port_offset(self):
  432. return 400
  433. def scenarios(self):
  434. for secure in [True, False]:
  435. secstr = 'secure' if secure else 'insecure'
  436. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  437. yield _ping_pong_scenario(
  438. 'java_generic_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  439. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  440. use_generic_payload=True, async_server_threads=1,
  441. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  442. categories=smoketest_categories)
  443. yield _ping_pong_scenario(
  444. 'java_protobuf_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  445. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  446. async_server_threads=1,
  447. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  448. yield _ping_pong_scenario(
  449. 'java_protobuf_async_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  450. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  451. async_server_threads=1,
  452. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  453. categories=smoketest_categories)
  454. yield _ping_pong_scenario(
  455. 'java_protobuf_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  456. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  457. async_server_threads=1,
  458. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  459. yield _ping_pong_scenario(
  460. 'java_protobuf_async_unary_qps_unconstrained_%s' % secstr, rpc_type='UNARY',
  461. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  462. unconstrained_client='async',
  463. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  464. categories=smoketest_categories+[SCALABLE])
  465. yield _ping_pong_scenario(
  466. 'java_protobuf_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  467. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  468. unconstrained_client='async',
  469. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  470. categories=[SCALABLE])
  471. yield _ping_pong_scenario(
  472. 'java_generic_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  473. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  474. unconstrained_client='async', use_generic_payload=True,
  475. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  476. categories=[SCALABLE])
  477. yield _ping_pong_scenario(
  478. 'java_generic_async_streaming_qps_one_server_core_%s' % secstr, rpc_type='STREAMING',
  479. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  480. unconstrained_client='async', use_generic_payload=True,
  481. async_server_threads=1,
  482. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  483. # TODO(jtattermusch): add scenarios java vs C++
  484. def __str__(self):
  485. return 'java'
  486. class GoLanguage:
  487. def __init__(self):
  488. pass
  489. self.safename = str(self)
  490. def worker_cmdline(self):
  491. return ['tools/run_tests/performance/run_worker_go.sh']
  492. def worker_port_offset(self):
  493. return 600
  494. def scenarios(self):
  495. for secure in [True, False]:
  496. secstr = 'secure' if secure else 'insecure'
  497. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  498. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  499. # but that's mostly because of lack of better name of the enum value.
  500. yield _ping_pong_scenario(
  501. 'go_generic_sync_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  502. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  503. use_generic_payload=True, async_server_threads=1,
  504. secure=secure,
  505. categories=smoketest_categories)
  506. yield _ping_pong_scenario(
  507. 'go_protobuf_sync_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  508. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  509. async_server_threads=1,
  510. secure=secure)
  511. yield _ping_pong_scenario(
  512. 'go_protobuf_sync_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  513. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  514. async_server_threads=1,
  515. secure=secure,
  516. categories=smoketest_categories)
  517. # unconstrained_client='async' is intended (client uses goroutines)
  518. yield _ping_pong_scenario(
  519. 'go_protobuf_sync_unary_qps_unconstrained_%s' % secstr, rpc_type='UNARY',
  520. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  521. unconstrained_client='async',
  522. secure=secure,
  523. categories=smoketest_categories+[SCALABLE])
  524. # unconstrained_client='async' is intended (client uses goroutines)
  525. yield _ping_pong_scenario(
  526. 'go_protobuf_sync_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  527. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  528. unconstrained_client='async',
  529. secure=secure,
  530. categories=[SCALABLE])
  531. # unconstrained_client='async' is intended (client uses goroutines)
  532. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  533. # but that's mostly because of lack of better name of the enum value.
  534. yield _ping_pong_scenario(
  535. 'go_generic_sync_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  536. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  537. unconstrained_client='async', use_generic_payload=True,
  538. secure=secure,
  539. categories=[SCALABLE])
  540. # TODO(jtattermusch): add scenarios go vs C++
  541. def __str__(self):
  542. return 'go'
  543. class NodeExpressLanguage:
  544. def __init__(self):
  545. pass
  546. self.safename = str(self)
  547. def worker_cmdline(self):
  548. return ['tools/run_tests/performance/run_worker_node.sh',
  549. '--benchmark_impl=express']
  550. def worker_port_offset(self):
  551. return 700
  552. def scenarios(self):
  553. yield _ping_pong_scenario(
  554. 'node_express_json_unary_ping_pong', rpc_type='UNARY',
  555. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  556. categories=[SCALABLE, SMOKETEST])
  557. yield _ping_pong_scenario(
  558. 'node_express_json_async_unary_qps_unconstrained', rpc_type='UNARY',
  559. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  560. unconstrained_client='async',
  561. categories=[SCALABLE, SMOKETEST])
  562. def __str__(self):
  563. return 'node_express'
  564. LANGUAGES = {
  565. 'c++' : CXXLanguage(),
  566. 'csharp' : CSharpLanguage(),
  567. 'node' : NodeLanguage(),
  568. 'node_express': NodeExpressLanguage(),
  569. 'ruby' : RubyLanguage(),
  570. 'java' : JavaLanguage(),
  571. 'python' : PythonLanguage(),
  572. 'go' : GoLanguage(),
  573. }