scenario_config.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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. WARMUP_SECONDS=5
  31. JAVA_WARMUP_SECONDS=15 # Java needs more warmup time for JIT to kick in.
  32. BENCHMARK_SECONDS=30
  33. SMOKETEST='smoketest'
  34. SECURE_SECARGS = {'use_test_ca': True,
  35. 'server_host_override': 'foo.test.google.fr'}
  36. HISTOGRAM_PARAMS = {
  37. 'resolution': 0.01,
  38. 'max_possible': 60e9,
  39. }
  40. EMPTY_GENERIC_PAYLOAD = {
  41. 'bytebuf_params': {
  42. 'req_size': 0,
  43. 'resp_size': 0,
  44. }
  45. }
  46. EMPTY_PROTO_PAYLOAD = {
  47. 'simple_params': {
  48. 'req_size': 0,
  49. 'resp_size': 0,
  50. }
  51. }
  52. BIG_GENERIC_PAYLOAD = {
  53. 'bytebuf_params': {
  54. 'req_size': 65536,
  55. 'resp_size': 65536,
  56. }
  57. }
  58. # deep is the number of RPCs outstanding on a channel in non-ping-pong tests
  59. # (the value used is 1 otherwise)
  60. DEEP=100
  61. # wide is the number of client channels in multi-channel tests (1 otherwise)
  62. WIDE=64
  63. def _get_secargs(is_secure):
  64. if is_secure:
  65. return SECURE_SECARGS
  66. else:
  67. return None
  68. def remove_nonproto_fields(scenario):
  69. """Remove special-purpose that contains some extra info about the scenario
  70. but don't belong to the ScenarioConfig protobuf message"""
  71. scenario.pop('CATEGORIES', None)
  72. scenario.pop('CLIENT_LANGUAGE', None)
  73. scenario.pop('SERVER_LANGUAGE', None)
  74. return scenario
  75. def _ping_pong_scenario(name, rpc_type,
  76. client_type, server_type,
  77. secure=True,
  78. use_generic_payload=False,
  79. use_unconstrained_client=False,
  80. client_language=None,
  81. server_language=None,
  82. server_core_limit=0,
  83. async_server_threads=0,
  84. warmup_seconds=WARMUP_SECONDS,
  85. categories=[]):
  86. """Creates a basic ping pong scenario."""
  87. scenario = {
  88. 'name': name,
  89. 'num_servers': 1,
  90. 'num_clients': 1,
  91. 'client_config': {
  92. 'client_type': client_type,
  93. 'security_params': _get_secargs(secure),
  94. 'outstanding_rpcs_per_channel': 1,
  95. 'client_channels': 1,
  96. 'async_client_threads': 1,
  97. 'rpc_type': rpc_type,
  98. 'load_params': {
  99. 'closed_loop': {}
  100. },
  101. 'histogram_params': HISTOGRAM_PARAMS,
  102. },
  103. 'server_config': {
  104. 'server_type': server_type,
  105. 'security_params': _get_secargs(secure),
  106. 'core_limit': server_core_limit,
  107. 'async_server_threads': async_server_threads,
  108. },
  109. 'warmup_seconds': warmup_seconds,
  110. 'benchmark_seconds': BENCHMARK_SECONDS
  111. }
  112. if use_generic_payload:
  113. if server_type != 'ASYNC_GENERIC_SERVER':
  114. raise Exception('Use ASYNC_GENERIC_SERVER for generic payload.')
  115. scenario['client_config']['payload_config'] = EMPTY_GENERIC_PAYLOAD
  116. scenario['server_config']['payload_config'] = EMPTY_GENERIC_PAYLOAD
  117. else:
  118. # For proto payload, only the client should get the config.
  119. scenario['client_config']['payload_config'] = EMPTY_PROTO_PAYLOAD
  120. if use_unconstrained_client:
  121. scenario['num_clients'] = 0 # use as many client as available.
  122. # TODO(jtattermusch): for SYNC_CLIENT, this will create 100*64 threads
  123. # and that's probably too much (at least for wrapped languages).
  124. scenario['client_config']['outstanding_rpcs_per_channel'] = DEEP
  125. scenario['client_config']['client_channels'] = WIDE
  126. scenario['client_config']['async_client_threads'] = 0
  127. else:
  128. scenario['client_config']['outstanding_rpcs_per_channel'] = 1
  129. scenario['client_config']['client_channels'] = 1
  130. scenario['client_config']['async_client_threads'] = 1
  131. if client_language:
  132. # the CLIENT_LANGUAGE field is recognized by run_performance_tests.py
  133. scenario['CLIENT_LANGUAGE'] = client_language
  134. if server_language:
  135. # the SERVER_LANGUAGE field is recognized by run_performance_tests.py
  136. scenario['SERVER_LANGUAGE'] = server_language
  137. if categories:
  138. scenario['CATEGORIES'] = categories
  139. return scenario
  140. class CXXLanguage:
  141. def __init__(self):
  142. self.safename = 'cxx'
  143. def worker_cmdline(self):
  144. return ['bins/opt/qps_worker']
  145. def worker_port_offset(self):
  146. return 0
  147. def scenarios(self):
  148. # TODO(ctiller): add 70% load latency test
  149. for secure in [True, False]:
  150. secstr = 'secure' if secure else 'insecure'
  151. smoketest_categories = [SMOKETEST] if secure else None
  152. yield _ping_pong_scenario(
  153. 'cpp_generic_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  154. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  155. use_generic_payload=True, server_core_limit=1, async_server_threads=1,
  156. secure=secure,
  157. categories=smoketest_categories)
  158. yield _ping_pong_scenario(
  159. 'cpp_protobuf_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  160. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  161. server_core_limit=1, async_server_threads=1,
  162. secure=secure)
  163. yield _ping_pong_scenario(
  164. 'cpp_protobuf_async_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  165. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  166. server_core_limit=1, async_server_threads=1,
  167. secure=secure,
  168. categories=smoketest_categories)
  169. yield _ping_pong_scenario(
  170. 'cpp_protobuf_sync_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  171. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  172. server_core_limit=1, async_server_threads=1,
  173. secure=secure)
  174. yield _ping_pong_scenario(
  175. 'cpp_protobuf_async_unary_qps_unconstrained_%s' % secstr, rpc_type='UNARY',
  176. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  177. use_unconstrained_client=True,
  178. secure=secure,
  179. categories=smoketest_categories)
  180. yield _ping_pong_scenario(
  181. 'cpp_protobuf_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  182. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  183. use_unconstrained_client=True,
  184. secure=secure)
  185. yield _ping_pong_scenario(
  186. 'cpp_generic_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  187. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  188. use_unconstrained_client=True, use_generic_payload=True,
  189. secure=secure,
  190. categories=smoketest_categories)
  191. yield _ping_pong_scenario(
  192. 'cpp_generic_async_streaming_qps_one_server_core_%s' % secstr, rpc_type='STREAMING',
  193. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  194. use_unconstrained_client=True, use_generic_payload=True,
  195. server_core_limit=1, async_server_threads=1,
  196. secure=secure)
  197. def __str__(self):
  198. return 'c++'
  199. class CSharpLanguage:
  200. def __init__(self):
  201. self.safename = str(self)
  202. def worker_cmdline(self):
  203. return ['tools/run_tests/performance/run_worker_csharp.sh']
  204. def worker_port_offset(self):
  205. return 100
  206. def scenarios(self):
  207. yield _ping_pong_scenario(
  208. 'csharp_generic_async_streaming_ping_pong', rpc_type='STREAMING',
  209. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  210. use_generic_payload=True,
  211. categories=[SMOKETEST])
  212. yield _ping_pong_scenario(
  213. 'csharp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  214. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  215. yield _ping_pong_scenario(
  216. 'csharp_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  217. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  218. categories=[SMOKETEST])
  219. yield _ping_pong_scenario(
  220. 'csharp_protobuf_sync_to_async_unary_ping_pong', rpc_type='UNARY',
  221. client_type='SYNC_CLIENT', server_type='ASYNC_SERVER')
  222. yield _ping_pong_scenario(
  223. 'csharp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  224. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  225. use_unconstrained_client=True,
  226. categories=[SMOKETEST])
  227. yield _ping_pong_scenario(
  228. 'csharp_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING',
  229. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  230. use_unconstrained_client=True)
  231. yield _ping_pong_scenario(
  232. 'csharp_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  233. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  234. server_language='c++', server_core_limit=1, async_server_threads=1,
  235. categories=[SMOKETEST])
  236. yield _ping_pong_scenario(
  237. 'csharp_to_cpp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  238. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  239. server_language='c++', server_core_limit=1, async_server_threads=1)
  240. yield _ping_pong_scenario(
  241. 'cpp_to_csharp_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  242. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  243. use_unconstrained_client=True, client_language='c++')
  244. def __str__(self):
  245. return 'csharp'
  246. class NodeLanguage:
  247. def __init__(self):
  248. pass
  249. self.safename = str(self)
  250. def worker_cmdline(self):
  251. return ['tools/run_tests/performance/run_worker_node.sh']
  252. def worker_port_offset(self):
  253. return 200
  254. def scenarios(self):
  255. # TODO(jtattermusch): make this scenario work
  256. #yield _ping_pong_scenario(
  257. # 'node_generic_async_streaming_ping_pong', rpc_type='STREAMING',
  258. # client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  259. # use_generic_payload=True)
  260. # TODO(jtattermusch): make this scenario work
  261. #yield _ping_pong_scenario(
  262. # 'node_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  263. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
  264. yield _ping_pong_scenario(
  265. 'node_protobuf_unary_ping_pong', rpc_type='UNARY',
  266. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  267. categories=[SMOKETEST])
  268. yield _ping_pong_scenario(
  269. 'node_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY',
  270. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  271. use_unconstrained_client=True,
  272. categories=[SMOKETEST])
  273. # TODO(jtattermusch): make this scenario work
  274. #yield _ping_pong_scenario(
  275. # 'node_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING',
  276. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  277. # use_unconstrained_client=True)
  278. # TODO(jtattermusch): make this scenario work
  279. #yield _ping_pong_scenario(
  280. # 'node_to_cpp_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  281. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  282. # server_language='c++', server_core_limit=1, async_server_threads=1)
  283. # TODO(jtattermusch): make this scenario work
  284. #yield _ping_pong_scenario(
  285. # 'node_to_cpp_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  286. # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  287. # server_language='c++', server_core_limit=1, async_server_threads=1)
  288. def __str__(self):
  289. return 'node'
  290. class PythonLanguage:
  291. def __init__(self):
  292. self.safename = 'python'
  293. def worker_cmdline(self):
  294. return ['tools/run_tests/performance/run_worker_python.sh']
  295. def worker_port_offset(self):
  296. return 500
  297. def scenarios(self):
  298. # TODO(issue #6522): Empty streaming requests does not work for python
  299. #yield _ping_pong_scenario(
  300. # 'python_generic_async_streaming_ping_pong', rpc_type='STREAMING',
  301. # client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  302. # use_generic_payload=True,
  303. # categories=[SMOKETEST])
  304. yield _ping_pong_scenario(
  305. 'python_protobuf_async_streaming_ping_pong', rpc_type='STREAMING',
  306. client_type='ASYNC_CLIENT', server_type='SYNC_SERVER')
  307. yield _ping_pong_scenario(
  308. 'python_protobuf_async_unary_ping_pong', rpc_type='UNARY',
  309. client_type='ASYNC_CLIENT', server_type='SYNC_SERVER')
  310. yield _ping_pong_scenario(
  311. 'python_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  312. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  313. categories=[SMOKETEST])
  314. # TODO(jtattermusch):
  315. # The qps_worker server gets thread starved with ~6400 threads, the GIL
  316. # enforces that a single thread runs at a time, with no way to set thread
  317. # priority. Re-evaluate after changing DEEP and WIDE.
  318. #yield _ping_pong_scenario(
  319. # 'python_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY',
  320. # client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  321. # use_unconstrained_client=True)
  322. yield _ping_pong_scenario(
  323. 'python_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING',
  324. client_type='ASYNC_CLIENT', server_type='SYNC_SERVER',
  325. use_unconstrained_client=True)
  326. yield _ping_pong_scenario(
  327. 'python_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  328. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  329. server_language='c++', server_core_limit=1, async_server_threads=1,
  330. categories=[SMOKETEST])
  331. yield _ping_pong_scenario(
  332. 'python_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  333. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  334. server_language='c++', server_core_limit=1, async_server_threads=1)
  335. def __str__(self):
  336. return 'python'
  337. class RubyLanguage:
  338. def __init__(self):
  339. pass
  340. self.safename = str(self)
  341. def worker_cmdline(self):
  342. return ['tools/run_tests/performance/run_worker_ruby.sh']
  343. def worker_port_offset(self):
  344. return 300
  345. def scenarios(self):
  346. yield _ping_pong_scenario(
  347. 'ruby_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  348. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  349. categories=[SMOKETEST])
  350. yield _ping_pong_scenario(
  351. 'ruby_protobuf_unary_ping_pong', rpc_type='UNARY',
  352. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  353. categories=[SMOKETEST])
  354. # TODO: scenario reports QPS of 0.0
  355. #yield _ping_pong_scenario(
  356. # 'ruby_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY',
  357. # client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  358. # use_unconstrained_client=True)
  359. # TODO: scenario reports QPS of 0.0
  360. #yield _ping_pong_scenario(
  361. # 'ruby_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING',
  362. # client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  363. # use_unconstrained_client=True)
  364. yield _ping_pong_scenario(
  365. 'ruby_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
  366. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  367. server_language='c++', server_core_limit=1, async_server_threads=1)
  368. yield _ping_pong_scenario(
  369. 'ruby_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
  370. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  371. server_language='c++', server_core_limit=1, async_server_threads=1)
  372. def __str__(self):
  373. return 'ruby'
  374. class JavaLanguage:
  375. def __init__(self):
  376. pass
  377. self.safename = str(self)
  378. def worker_cmdline(self):
  379. return ['tools/run_tests/performance/run_worker_java.sh']
  380. def worker_port_offset(self):
  381. return 400
  382. def scenarios(self):
  383. for secure in [True, False]:
  384. secstr = 'secure' if secure else 'insecure'
  385. smoketest_categories = [SMOKETEST] if secure else None
  386. yield _ping_pong_scenario(
  387. 'java_generic_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  388. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  389. use_generic_payload=True, async_server_threads=1,
  390. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  391. categories=smoketest_categories)
  392. yield _ping_pong_scenario(
  393. 'java_protobuf_async_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  394. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  395. async_server_threads=1,
  396. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  397. yield _ping_pong_scenario(
  398. 'java_protobuf_async_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  399. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  400. async_server_threads=1,
  401. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  402. categories=smoketest_categories)
  403. yield _ping_pong_scenario(
  404. 'java_protobuf_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  405. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  406. async_server_threads=1,
  407. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  408. yield _ping_pong_scenario(
  409. 'java_protobuf_async_unary_qps_unconstrained_%s' % secstr, rpc_type='UNARY',
  410. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  411. use_unconstrained_client=True,
  412. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS,
  413. categories=smoketest_categories)
  414. yield _ping_pong_scenario(
  415. 'java_protobuf_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  416. client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
  417. use_unconstrained_client=True,
  418. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  419. yield _ping_pong_scenario(
  420. 'java_generic_async_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  421. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  422. use_unconstrained_client=True, use_generic_payload=True,
  423. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  424. yield _ping_pong_scenario(
  425. 'java_generic_async_streaming_qps_one_server_core_%s' % secstr, rpc_type='STREAMING',
  426. client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  427. use_unconstrained_client=True, use_generic_payload=True,
  428. async_server_threads=1,
  429. secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS)
  430. # TODO(jtattermusch): add scenarios java vs C++
  431. def __str__(self):
  432. return 'java'
  433. class GoLanguage:
  434. def __init__(self):
  435. pass
  436. self.safename = str(self)
  437. def worker_cmdline(self):
  438. return ['tools/run_tests/performance/run_worker_go.sh']
  439. def worker_port_offset(self):
  440. return 600
  441. def scenarios(self):
  442. for secure in [True, False]:
  443. secstr = 'secure' if secure else 'insecure'
  444. smoketest_categories = [SMOKETEST] if secure else None
  445. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  446. # but that's mostly because of lack of better name of the enum value.
  447. yield _ping_pong_scenario(
  448. 'go_generic_sync_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  449. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  450. use_generic_payload=True, async_server_threads=1,
  451. secure=secure,
  452. categories=smoketest_categories)
  453. yield _ping_pong_scenario(
  454. 'go_protobuf_sync_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING',
  455. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  456. async_server_threads=1,
  457. secure=secure)
  458. yield _ping_pong_scenario(
  459. 'go_protobuf_sync_unary_ping_pong_%s' % secstr, rpc_type='UNARY',
  460. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  461. async_server_threads=1,
  462. secure=secure,
  463. categories=smoketest_categories)
  464. yield _ping_pong_scenario(
  465. 'go_protobuf_sync_unary_qps_unconstrained_%s' % secstr, rpc_type='UNARY',
  466. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  467. use_unconstrained_client=True,
  468. secure=secure,
  469. categories=smoketest_categories)
  470. yield _ping_pong_scenario(
  471. 'go_protobuf_sync_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  472. client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
  473. use_unconstrained_client=True,
  474. secure=secure)
  475. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  476. # but that's mostly because of lack of better name of the enum value.
  477. yield _ping_pong_scenario(
  478. 'go_generic_sync_streaming_qps_unconstrained_%s' % secstr, rpc_type='STREAMING',
  479. client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
  480. use_unconstrained_client=True, use_generic_payload=True,
  481. secure=secure)
  482. # TODO(jtattermusch): add scenarios go vs C++
  483. def __str__(self):
  484. return 'go'
  485. LANGUAGES = {
  486. 'c++' : CXXLanguage(),
  487. 'csharp' : CSharpLanguage(),
  488. 'node' : NodeLanguage(),
  489. 'ruby' : RubyLanguage(),
  490. 'java' : JavaLanguage(),
  491. 'python' : PythonLanguage(),
  492. 'go' : GoLanguage(),
  493. }