scenario_config.py 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371
  1. # Copyright 2016 gRPC authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # performance scenario configuration for various languages
  15. import math
  16. WARMUP_SECONDS = 5
  17. JAVA_WARMUP_SECONDS = 15 # Java needs more warmup time for JIT to kick in.
  18. BENCHMARK_SECONDS = 30
  19. SMOKETEST = 'smoketest'
  20. SCALABLE = 'scalable'
  21. INPROC = 'inproc'
  22. SWEEP = 'sweep'
  23. DEFAULT_CATEGORIES = (SCALABLE, SMOKETEST)
  24. SECURE_SECARGS = {
  25. 'use_test_ca': True,
  26. 'server_host_override': 'foo.test.google.fr'
  27. }
  28. HISTOGRAM_PARAMS = {
  29. 'resolution': 0.01,
  30. 'max_possible': 60e9,
  31. }
  32. # target number of RPCs outstanding on across all client channels in
  33. # non-ping-pong tests (since we can only specify per-channel numbers, the
  34. # actual target will be slightly higher)
  35. OUTSTANDING_REQUESTS = {'async': 6400, 'async-limited': 800, 'sync': 1000}
  36. # wide is the number of client channels in multi-channel tests (1 otherwise)
  37. WIDE = 64
  38. def _get_secargs(is_secure):
  39. if is_secure:
  40. return SECURE_SECARGS
  41. else:
  42. return None
  43. def remove_nonproto_fields(scenario):
  44. """Removes special-purpose fields that don't belong in the protobuf.
  45. This function removes additional information about the scenario that is not
  46. included in the ScenarioConfig protobuf message.
  47. """
  48. scenario.pop('CATEGORIES', None)
  49. scenario.pop('CLIENT_LANGUAGE', None)
  50. scenario.pop('SERVER_LANGUAGE', None)
  51. scenario.pop('EXCLUDED_POLL_ENGINES', None)
  52. return scenario
  53. def geometric_progression(start, stop, step):
  54. n = start
  55. while n < stop:
  56. yield int(round(n))
  57. n *= step
  58. def _payload_type(use_generic_payload, req_size, resp_size):
  59. r = {}
  60. sizes = {
  61. 'req_size': req_size,
  62. 'resp_size': resp_size,
  63. }
  64. if use_generic_payload:
  65. r['bytebuf_params'] = sizes
  66. else:
  67. r['simple_params'] = sizes
  68. return r
  69. def _load_params(offered_load):
  70. r = {}
  71. if offered_load is None:
  72. r['closed_loop'] = {}
  73. else:
  74. load = {}
  75. load['offered_load'] = offered_load
  76. r['poisson'] = load
  77. return r
  78. def _add_channel_arg(config, key, value):
  79. if 'channel_args' in config:
  80. channel_args = config['channel_args']
  81. else:
  82. channel_args = []
  83. config['channel_args'] = channel_args
  84. arg = {'name': key}
  85. if isinstance(value, int):
  86. arg['int_value'] = value
  87. else:
  88. arg['str_value'] = value
  89. channel_args.append(arg)
  90. def _ping_pong_scenario(name,
  91. rpc_type,
  92. client_type,
  93. server_type,
  94. secure=True,
  95. use_generic_payload=False,
  96. req_size=0,
  97. resp_size=0,
  98. unconstrained_client=None,
  99. client_language=None,
  100. server_language=None,
  101. async_server_threads=0,
  102. client_processes=0,
  103. server_processes=0,
  104. server_threads_per_cq=0,
  105. client_threads_per_cq=0,
  106. warmup_seconds=WARMUP_SECONDS,
  107. categories=None,
  108. channels=None,
  109. outstanding=None,
  110. num_clients=None,
  111. resource_quota_size=None,
  112. messages_per_stream=None,
  113. excluded_poll_engines=None,
  114. minimal_stack=False,
  115. offered_load=None):
  116. """Creates a basic ping pong scenario."""
  117. scenario = {
  118. 'name': name,
  119. 'num_servers': 1,
  120. 'num_clients': 1,
  121. 'client_config': {
  122. 'client_type': client_type,
  123. 'security_params': _get_secargs(secure),
  124. 'outstanding_rpcs_per_channel': 1,
  125. 'client_channels': 1,
  126. 'async_client_threads': 1,
  127. 'client_processes': client_processes,
  128. 'threads_per_cq': client_threads_per_cq,
  129. 'rpc_type': rpc_type,
  130. 'histogram_params': HISTOGRAM_PARAMS,
  131. 'channel_args': [],
  132. },
  133. 'server_config': {
  134. 'server_type': server_type,
  135. 'security_params': _get_secargs(secure),
  136. 'async_server_threads': async_server_threads,
  137. 'server_processes': server_processes,
  138. 'threads_per_cq': server_threads_per_cq,
  139. 'channel_args': [],
  140. },
  141. 'warmup_seconds': warmup_seconds,
  142. 'benchmark_seconds': BENCHMARK_SECONDS,
  143. 'CATEGORIES': list(DEFAULT_CATEGORIES),
  144. 'EXCLUDED_POLL_ENGINES': [],
  145. }
  146. if resource_quota_size:
  147. scenario['server_config']['resource_quota_size'] = resource_quota_size
  148. if use_generic_payload:
  149. if server_type != 'ASYNC_GENERIC_SERVER':
  150. raise Exception('Use ASYNC_GENERIC_SERVER for generic payload.')
  151. scenario['server_config']['payload_config'] = _payload_type(
  152. use_generic_payload, req_size, resp_size)
  153. scenario['client_config']['payload_config'] = _payload_type(
  154. use_generic_payload, req_size, resp_size)
  155. # Optimization target of 'throughput' does not work well with epoll1 polling
  156. # engine. Use the default value of 'blend'
  157. optimization_target = 'throughput'
  158. if unconstrained_client:
  159. outstanding_calls = outstanding if outstanding is not None else OUTSTANDING_REQUESTS[
  160. unconstrained_client]
  161. # clamp buffer usage to something reasonable (16 gig for now)
  162. MAX_MEMORY_USE = 16 * 1024 * 1024 * 1024
  163. if outstanding_calls * max(req_size, resp_size) > MAX_MEMORY_USE:
  164. outstanding_calls = max(1,
  165. MAX_MEMORY_USE / max(req_size, resp_size))
  166. wide = channels if channels is not None else WIDE
  167. deep = int(math.ceil(1.0 * outstanding_calls / wide))
  168. scenario[
  169. 'num_clients'] = num_clients if num_clients is not None else 0 # use as many clients as available.
  170. scenario['client_config']['outstanding_rpcs_per_channel'] = deep
  171. scenario['client_config']['client_channels'] = wide
  172. scenario['client_config']['async_client_threads'] = 0
  173. if offered_load is not None:
  174. optimization_target = 'latency'
  175. else:
  176. scenario['client_config']['outstanding_rpcs_per_channel'] = 1
  177. scenario['client_config']['client_channels'] = 1
  178. scenario['client_config']['async_client_threads'] = 1
  179. optimization_target = 'latency'
  180. scenario['client_config']['load_params'] = _load_params(offered_load)
  181. optimization_channel_arg = {
  182. 'name': 'grpc.optimization_target',
  183. 'str_value': optimization_target
  184. }
  185. scenario['client_config']['channel_args'].append(optimization_channel_arg)
  186. scenario['server_config']['channel_args'].append(optimization_channel_arg)
  187. if minimal_stack:
  188. _add_channel_arg(scenario['client_config'], 'grpc.minimal_stack', 1)
  189. _add_channel_arg(scenario['server_config'], 'grpc.minimal_stack', 1)
  190. if messages_per_stream:
  191. scenario['client_config']['messages_per_stream'] = messages_per_stream
  192. if client_language:
  193. # the CLIENT_LANGUAGE field is recognized by run_performance_tests.py
  194. scenario['CLIENT_LANGUAGE'] = client_language
  195. if server_language:
  196. # the SERVER_LANGUAGE field is recognized by run_performance_tests.py
  197. scenario['SERVER_LANGUAGE'] = server_language
  198. if categories:
  199. scenario['CATEGORIES'] = categories
  200. if excluded_poll_engines:
  201. # The polling engines for which this scenario is excluded
  202. scenario['EXCLUDED_POLL_ENGINES'] = excluded_poll_engines
  203. return scenario
  204. class Language(object):
  205. @property
  206. def safename(self):
  207. return str(self)
  208. class CXXLanguage(Language):
  209. @property
  210. def safename(self):
  211. return 'cxx'
  212. def worker_cmdline(self):
  213. return ['cmake/build/qps_worker']
  214. def worker_port_offset(self):
  215. return 0
  216. def scenarios(self):
  217. # TODO(ctiller): add 70% load latency test
  218. yield _ping_pong_scenario(
  219. 'cpp_protobuf_async_unary_1channel_100rpcs_1MB',
  220. rpc_type='UNARY',
  221. client_type='ASYNC_CLIENT',
  222. server_type='ASYNC_SERVER',
  223. req_size=1024 * 1024,
  224. resp_size=1024 * 1024,
  225. unconstrained_client='async',
  226. outstanding=100,
  227. channels=1,
  228. num_clients=1,
  229. secure=False,
  230. categories=[SWEEP])
  231. yield _ping_pong_scenario(
  232. 'cpp_protobuf_async_streaming_from_client_1channel_1MB',
  233. rpc_type='STREAMING_FROM_CLIENT',
  234. client_type='ASYNC_CLIENT',
  235. server_type='ASYNC_SERVER',
  236. req_size=1024 * 1024,
  237. resp_size=1024 * 1024,
  238. unconstrained_client='async',
  239. outstanding=1,
  240. channels=1,
  241. num_clients=1,
  242. secure=False,
  243. categories=[SWEEP])
  244. # Scenario was added in https://github.com/grpc/grpc/pull/12987, but its purpose is unclear
  245. # (beyond excercising some params that other scenarios don't)
  246. yield _ping_pong_scenario(
  247. 'cpp_protobuf_async_unary_75Kqps_600channel_60Krpcs_300Breq_50Bresp',
  248. rpc_type='UNARY',
  249. client_type='ASYNC_CLIENT',
  250. server_type='ASYNC_SERVER',
  251. req_size=300,
  252. resp_size=50,
  253. unconstrained_client='async',
  254. outstanding=30000,
  255. channels=300,
  256. offered_load=37500,
  257. secure=False,
  258. async_server_threads=16,
  259. server_threads_per_cq=1,
  260. categories=[SCALABLE])
  261. for secure in [True, False]:
  262. secstr = 'secure' if secure else 'insecure'
  263. smoketest_categories = ([SMOKETEST] if secure else [])
  264. inproc_categories = ([INPROC] if not secure else [])
  265. yield _ping_pong_scenario(
  266. 'cpp_generic_async_streaming_ping_pong_%s' % secstr,
  267. rpc_type='STREAMING',
  268. client_type='ASYNC_CLIENT',
  269. server_type='ASYNC_GENERIC_SERVER',
  270. use_generic_payload=True,
  271. async_server_threads=1,
  272. secure=secure,
  273. categories=smoketest_categories + inproc_categories +
  274. [SCALABLE])
  275. yield _ping_pong_scenario(
  276. 'cpp_generic_async_streaming_qps_unconstrained_%s' % secstr,
  277. rpc_type='STREAMING',
  278. client_type='ASYNC_CLIENT',
  279. server_type='ASYNC_GENERIC_SERVER',
  280. unconstrained_client='async',
  281. use_generic_payload=True,
  282. secure=secure,
  283. client_threads_per_cq=2,
  284. server_threads_per_cq=2,
  285. minimal_stack=not secure,
  286. categories=smoketest_categories + inproc_categories +
  287. [SCALABLE])
  288. for mps in geometric_progression(10, 20, 10):
  289. yield _ping_pong_scenario(
  290. 'cpp_generic_async_streaming_qps_unconstrained_%smps_%s' %
  291. (mps, secstr),
  292. rpc_type='STREAMING',
  293. client_type='ASYNC_CLIENT',
  294. server_type='ASYNC_GENERIC_SERVER',
  295. unconstrained_client='async',
  296. use_generic_payload=True,
  297. secure=secure,
  298. messages_per_stream=mps,
  299. minimal_stack=not secure,
  300. categories=smoketest_categories + inproc_categories +
  301. [SCALABLE])
  302. for mps in geometric_progression(1, 200, math.sqrt(10)):
  303. yield _ping_pong_scenario(
  304. 'cpp_generic_async_streaming_qps_unconstrained_%smps_%s' %
  305. (mps, secstr),
  306. rpc_type='STREAMING',
  307. client_type='ASYNC_CLIENT',
  308. server_type='ASYNC_GENERIC_SERVER',
  309. unconstrained_client='async',
  310. use_generic_payload=True,
  311. secure=secure,
  312. messages_per_stream=mps,
  313. minimal_stack=not secure,
  314. categories=[SWEEP])
  315. yield _ping_pong_scenario(
  316. 'cpp_generic_async_streaming_qps_1channel_1MBmsg_%s' % secstr,
  317. rpc_type='STREAMING',
  318. req_size=1024 * 1024,
  319. resp_size=1024 * 1024,
  320. client_type='ASYNC_CLIENT',
  321. server_type='ASYNC_GENERIC_SERVER',
  322. unconstrained_client='async',
  323. use_generic_payload=True,
  324. secure=secure,
  325. minimal_stack=not secure,
  326. categories=inproc_categories + [SCALABLE],
  327. channels=1,
  328. outstanding=100)
  329. yield _ping_pong_scenario(
  330. 'cpp_generic_async_streaming_qps_unconstrained_64KBmsg_%s' %
  331. secstr,
  332. rpc_type='STREAMING',
  333. req_size=64 * 1024,
  334. resp_size=64 * 1024,
  335. client_type='ASYNC_CLIENT',
  336. server_type='ASYNC_GENERIC_SERVER',
  337. unconstrained_client='async',
  338. use_generic_payload=True,
  339. secure=secure,
  340. minimal_stack=not secure,
  341. categories=inproc_categories + [SCALABLE])
  342. yield _ping_pong_scenario(
  343. 'cpp_generic_async_streaming_qps_unconstrained_1cq_%s' % secstr,
  344. rpc_type='STREAMING',
  345. client_type='ASYNC_CLIENT',
  346. server_type='ASYNC_GENERIC_SERVER',
  347. unconstrained_client='async-limited',
  348. use_generic_payload=True,
  349. secure=secure,
  350. client_threads_per_cq=1000000,
  351. server_threads_per_cq=1000000,
  352. categories=[SWEEP])
  353. yield _ping_pong_scenario(
  354. 'cpp_protobuf_async_streaming_qps_unconstrained_1cq_%s' %
  355. secstr,
  356. rpc_type='STREAMING',
  357. client_type='ASYNC_CLIENT',
  358. server_type='ASYNC_SERVER',
  359. unconstrained_client='async-limited',
  360. secure=secure,
  361. client_threads_per_cq=1000000,
  362. server_threads_per_cq=1000000,
  363. categories=inproc_categories + [SCALABLE])
  364. yield _ping_pong_scenario(
  365. 'cpp_protobuf_async_unary_qps_unconstrained_1cq_%s' % secstr,
  366. rpc_type='UNARY',
  367. client_type='ASYNC_CLIENT',
  368. server_type='ASYNC_SERVER',
  369. unconstrained_client='async-limited',
  370. secure=secure,
  371. client_threads_per_cq=1000000,
  372. server_threads_per_cq=1000000,
  373. categories=inproc_categories + [SCALABLE])
  374. yield _ping_pong_scenario(
  375. 'cpp_generic_async_streaming_qps_one_server_core_%s' % secstr,
  376. rpc_type='STREAMING',
  377. client_type='ASYNC_CLIENT',
  378. server_type='ASYNC_GENERIC_SERVER',
  379. unconstrained_client='async-limited',
  380. use_generic_payload=True,
  381. async_server_threads=1,
  382. minimal_stack=not secure,
  383. secure=secure,
  384. categories=[SWEEP])
  385. yield _ping_pong_scenario(
  386. 'cpp_protobuf_async_client_sync_server_unary_qps_unconstrained_%s'
  387. % (secstr),
  388. rpc_type='UNARY',
  389. client_type='ASYNC_CLIENT',
  390. server_type='SYNC_SERVER',
  391. unconstrained_client='async',
  392. secure=secure,
  393. minimal_stack=not secure,
  394. categories=smoketest_categories + inproc_categories +
  395. [SCALABLE])
  396. yield _ping_pong_scenario(
  397. 'cpp_protobuf_async_client_unary_1channel_64wide_128Breq_8MBresp_%s'
  398. % (secstr),
  399. rpc_type='UNARY',
  400. client_type='ASYNC_CLIENT',
  401. server_type='ASYNC_SERVER',
  402. channels=1,
  403. outstanding=64,
  404. req_size=128,
  405. resp_size=8 * 1024 * 1024,
  406. secure=secure,
  407. minimal_stack=not secure,
  408. categories=inproc_categories + [SCALABLE])
  409. yield _ping_pong_scenario(
  410. 'cpp_protobuf_async_client_sync_server_streaming_qps_unconstrained_%s'
  411. % secstr,
  412. rpc_type='STREAMING',
  413. client_type='ASYNC_CLIENT',
  414. server_type='SYNC_SERVER',
  415. unconstrained_client='async',
  416. secure=secure,
  417. minimal_stack=not secure,
  418. categories=[SWEEP])
  419. yield _ping_pong_scenario(
  420. 'cpp_protobuf_async_unary_ping_pong_%s_1MB' % secstr,
  421. rpc_type='UNARY',
  422. client_type='ASYNC_CLIENT',
  423. server_type='ASYNC_SERVER',
  424. req_size=1024 * 1024,
  425. resp_size=1024 * 1024,
  426. secure=secure,
  427. minimal_stack=not secure,
  428. categories=smoketest_categories + inproc_categories +
  429. [SCALABLE])
  430. for rpc_type in [
  431. 'unary', 'streaming', 'streaming_from_client',
  432. 'streaming_from_server'
  433. ]:
  434. for synchronicity in ['sync', 'async']:
  435. yield _ping_pong_scenario(
  436. 'cpp_protobuf_%s_%s_ping_pong_%s' %
  437. (synchronicity, rpc_type, secstr),
  438. rpc_type=rpc_type.upper(),
  439. client_type='%s_CLIENT' % synchronicity.upper(),
  440. server_type='%s_SERVER' % synchronicity.upper(),
  441. async_server_threads=1,
  442. minimal_stack=not secure,
  443. secure=secure)
  444. for size in geometric_progression(1, 1024 * 1024 * 1024 + 1,
  445. 8):
  446. yield _ping_pong_scenario(
  447. 'cpp_protobuf_%s_%s_qps_unconstrained_%s_%db' %
  448. (synchronicity, rpc_type, secstr, size),
  449. rpc_type=rpc_type.upper(),
  450. req_size=size,
  451. resp_size=size,
  452. client_type='%s_CLIENT' % synchronicity.upper(),
  453. server_type='%s_SERVER' % synchronicity.upper(),
  454. unconstrained_client=synchronicity,
  455. secure=secure,
  456. minimal_stack=not secure,
  457. categories=[SWEEP])
  458. maybe_scalable = [SCALABLE]
  459. if rpc_type == 'streaming_from_server' and synchronicity == 'async' and secure:
  460. # protobuf_async_streaming_from_server_qps_unconstrained_secure is very flaky
  461. # and has extremely high variance so running it isn't really useful.
  462. # see b/198275705
  463. maybe_scalable = [SWEEP]
  464. yield _ping_pong_scenario(
  465. 'cpp_protobuf_%s_%s_qps_unconstrained_%s' %
  466. (synchronicity, rpc_type, secstr),
  467. rpc_type=rpc_type.upper(),
  468. client_type='%s_CLIENT' % synchronicity.upper(),
  469. server_type='%s_SERVER' % synchronicity.upper(),
  470. unconstrained_client=synchronicity,
  471. secure=secure,
  472. minimal_stack=not secure,
  473. server_threads_per_cq=2,
  474. client_threads_per_cq=2,
  475. categories=inproc_categories + maybe_scalable)
  476. # TODO(vjpai): Re-enable this test. It has a lot of timeouts
  477. # and hasn't yet been conclusively identified as a test failure
  478. # or race in the library
  479. # yield _ping_pong_scenario(
  480. # 'cpp_protobuf_%s_%s_qps_unconstrained_%s_500kib_resource_quota' % (synchronicity, rpc_type, secstr),
  481. # rpc_type=rpc_type.upper(),
  482. # client_type='%s_CLIENT' % synchronicity.upper(),
  483. # server_type='%s_SERVER' % synchronicity.upper(),
  484. # unconstrained_client=synchronicity,
  485. # secure=secure,
  486. # categories=smoketest_categories+[SCALABLE],
  487. # resource_quota_size=500*1024)
  488. if rpc_type == 'streaming':
  489. for mps in geometric_progression(10, 20, 10):
  490. yield _ping_pong_scenario(
  491. 'cpp_protobuf_%s_%s_qps_unconstrained_%smps_%s'
  492. % (synchronicity, rpc_type, mps, secstr),
  493. rpc_type=rpc_type.upper(),
  494. client_type='%s_CLIENT' % synchronicity.upper(),
  495. server_type='%s_SERVER' % synchronicity.upper(),
  496. unconstrained_client=synchronicity,
  497. secure=secure,
  498. messages_per_stream=mps,
  499. minimal_stack=not secure,
  500. categories=inproc_categories + [SCALABLE])
  501. for mps in geometric_progression(1, 200, math.sqrt(10)):
  502. yield _ping_pong_scenario(
  503. 'cpp_protobuf_%s_%s_qps_unconstrained_%smps_%s'
  504. % (synchronicity, rpc_type, mps, secstr),
  505. rpc_type=rpc_type.upper(),
  506. client_type='%s_CLIENT' % synchronicity.upper(),
  507. server_type='%s_SERVER' % synchronicity.upper(),
  508. unconstrained_client=synchronicity,
  509. secure=secure,
  510. messages_per_stream=mps,
  511. minimal_stack=not secure,
  512. categories=[SWEEP])
  513. for channels in geometric_progression(
  514. 1, 20000, math.sqrt(10)):
  515. for outstanding in geometric_progression(
  516. 1, 200000, math.sqrt(10)):
  517. if synchronicity == 'sync' and outstanding > 1200:
  518. continue
  519. if outstanding < channels:
  520. continue
  521. yield _ping_pong_scenario(
  522. 'cpp_protobuf_%s_%s_qps_unconstrained_%s_%d_channels_%d_outstanding'
  523. % (synchronicity, rpc_type, secstr, channels,
  524. outstanding),
  525. rpc_type=rpc_type.upper(),
  526. client_type='%s_CLIENT' % synchronicity.upper(),
  527. server_type='%s_SERVER' % synchronicity.upper(),
  528. unconstrained_client=synchronicity,
  529. secure=secure,
  530. minimal_stack=not secure,
  531. categories=[SWEEP],
  532. channels=channels,
  533. outstanding=outstanding)
  534. def __str__(self):
  535. return 'c++'
  536. class CSharpLanguage(Language):
  537. def worker_cmdline(self):
  538. return ['tools/run_tests/performance/run_worker_csharp.sh']
  539. def worker_port_offset(self):
  540. return 100
  541. def scenarios(self):
  542. yield _ping_pong_scenario('csharp_generic_async_streaming_ping_pong',
  543. rpc_type='STREAMING',
  544. client_type='ASYNC_CLIENT',
  545. server_type='ASYNC_GENERIC_SERVER',
  546. use_generic_payload=True,
  547. categories=[SMOKETEST, SCALABLE])
  548. yield _ping_pong_scenario(
  549. 'csharp_generic_async_streaming_ping_pong_insecure_1MB',
  550. rpc_type='STREAMING',
  551. client_type='ASYNC_CLIENT',
  552. server_type='ASYNC_GENERIC_SERVER',
  553. req_size=1024 * 1024,
  554. resp_size=1024 * 1024,
  555. use_generic_payload=True,
  556. secure=False,
  557. categories=[SMOKETEST, SCALABLE])
  558. yield _ping_pong_scenario(
  559. 'csharp_generic_async_streaming_qps_unconstrained_insecure',
  560. rpc_type='STREAMING',
  561. client_type='ASYNC_CLIENT',
  562. server_type='ASYNC_GENERIC_SERVER',
  563. unconstrained_client='async',
  564. use_generic_payload=True,
  565. secure=False,
  566. categories=[SMOKETEST, SCALABLE])
  567. yield _ping_pong_scenario('csharp_protobuf_async_streaming_ping_pong',
  568. rpc_type='STREAMING',
  569. client_type='ASYNC_CLIENT',
  570. server_type='ASYNC_SERVER')
  571. yield _ping_pong_scenario('csharp_protobuf_async_unary_ping_pong',
  572. rpc_type='UNARY',
  573. client_type='ASYNC_CLIENT',
  574. server_type='ASYNC_SERVER',
  575. categories=[SMOKETEST, SCALABLE])
  576. yield _ping_pong_scenario(
  577. 'csharp_protobuf_sync_to_async_unary_ping_pong',
  578. rpc_type='UNARY',
  579. client_type='SYNC_CLIENT',
  580. server_type='ASYNC_SERVER')
  581. yield _ping_pong_scenario(
  582. 'csharp_protobuf_async_unary_qps_unconstrained',
  583. rpc_type='UNARY',
  584. client_type='ASYNC_CLIENT',
  585. server_type='ASYNC_SERVER',
  586. unconstrained_client='async',
  587. categories=[SMOKETEST, SCALABLE])
  588. yield _ping_pong_scenario(
  589. 'csharp_protobuf_async_streaming_qps_unconstrained',
  590. rpc_type='STREAMING',
  591. client_type='ASYNC_CLIENT',
  592. server_type='ASYNC_SERVER',
  593. unconstrained_client='async',
  594. categories=[SCALABLE])
  595. yield _ping_pong_scenario('csharp_to_cpp_protobuf_sync_unary_ping_pong',
  596. rpc_type='UNARY',
  597. client_type='SYNC_CLIENT',
  598. server_type='SYNC_SERVER',
  599. server_language='c++',
  600. async_server_threads=1,
  601. categories=[SMOKETEST, SCALABLE])
  602. yield _ping_pong_scenario(
  603. 'csharp_to_cpp_protobuf_async_streaming_ping_pong',
  604. rpc_type='STREAMING',
  605. client_type='ASYNC_CLIENT',
  606. server_type='ASYNC_SERVER',
  607. server_language='c++',
  608. async_server_threads=1)
  609. yield _ping_pong_scenario(
  610. 'csharp_to_cpp_protobuf_async_unary_qps_unconstrained',
  611. rpc_type='UNARY',
  612. client_type='ASYNC_CLIENT',
  613. server_type='ASYNC_SERVER',
  614. unconstrained_client='async',
  615. server_language='c++',
  616. categories=[SCALABLE])
  617. yield _ping_pong_scenario(
  618. 'csharp_to_cpp_protobuf_sync_to_async_unary_qps_unconstrained',
  619. rpc_type='UNARY',
  620. client_type='SYNC_CLIENT',
  621. server_type='ASYNC_SERVER',
  622. unconstrained_client='sync',
  623. server_language='c++',
  624. categories=[SCALABLE])
  625. yield _ping_pong_scenario(
  626. 'cpp_to_csharp_protobuf_async_unary_qps_unconstrained',
  627. rpc_type='UNARY',
  628. client_type='ASYNC_CLIENT',
  629. server_type='ASYNC_SERVER',
  630. unconstrained_client='async',
  631. client_language='c++',
  632. categories=[SCALABLE])
  633. yield _ping_pong_scenario('csharp_protobuf_async_unary_ping_pong_1MB',
  634. rpc_type='UNARY',
  635. client_type='ASYNC_CLIENT',
  636. server_type='ASYNC_SERVER',
  637. req_size=1024 * 1024,
  638. resp_size=1024 * 1024,
  639. categories=[SMOKETEST, SCALABLE])
  640. def __str__(self):
  641. return 'csharp'
  642. class PythonLanguage(Language):
  643. def worker_cmdline(self):
  644. return ['tools/run_tests/performance/run_worker_python.sh']
  645. def worker_port_offset(self):
  646. return 500
  647. def scenarios(self):
  648. yield _ping_pong_scenario('python_generic_sync_streaming_ping_pong',
  649. rpc_type='STREAMING',
  650. client_type='SYNC_CLIENT',
  651. server_type='ASYNC_GENERIC_SERVER',
  652. use_generic_payload=True,
  653. categories=[SMOKETEST, SCALABLE])
  654. yield _ping_pong_scenario('python_protobuf_sync_streaming_ping_pong',
  655. rpc_type='STREAMING',
  656. client_type='SYNC_CLIENT',
  657. server_type='ASYNC_SERVER')
  658. yield _ping_pong_scenario('python_protobuf_async_unary_ping_pong',
  659. rpc_type='UNARY',
  660. client_type='ASYNC_CLIENT',
  661. server_type='ASYNC_SERVER')
  662. yield _ping_pong_scenario('python_protobuf_sync_unary_ping_pong',
  663. rpc_type='UNARY',
  664. client_type='SYNC_CLIENT',
  665. server_type='ASYNC_SERVER',
  666. categories=[SMOKETEST, SCALABLE])
  667. yield _ping_pong_scenario(
  668. 'python_protobuf_sync_unary_qps_unconstrained',
  669. rpc_type='UNARY',
  670. client_type='SYNC_CLIENT',
  671. server_type='ASYNC_SERVER',
  672. unconstrained_client='sync')
  673. yield _ping_pong_scenario(
  674. 'python_protobuf_sync_streaming_qps_unconstrained',
  675. rpc_type='STREAMING',
  676. client_type='SYNC_CLIENT',
  677. server_type='ASYNC_SERVER',
  678. unconstrained_client='sync')
  679. yield _ping_pong_scenario('python_to_cpp_protobuf_sync_unary_ping_pong',
  680. rpc_type='UNARY',
  681. client_type='SYNC_CLIENT',
  682. server_type='ASYNC_SERVER',
  683. server_language='c++',
  684. async_server_threads=0,
  685. categories=[SMOKETEST, SCALABLE])
  686. yield _ping_pong_scenario(
  687. 'python_to_cpp_protobuf_sync_streaming_ping_pong',
  688. rpc_type='STREAMING',
  689. client_type='SYNC_CLIENT',
  690. server_type='ASYNC_SERVER',
  691. server_language='c++',
  692. async_server_threads=1)
  693. yield _ping_pong_scenario('python_protobuf_sync_unary_ping_pong_1MB',
  694. rpc_type='UNARY',
  695. client_type='SYNC_CLIENT',
  696. server_type='ASYNC_SERVER',
  697. req_size=1024 * 1024,
  698. resp_size=1024 * 1024,
  699. categories=[SMOKETEST, SCALABLE])
  700. def __str__(self):
  701. return 'python'
  702. class PythonAsyncIOLanguage(Language):
  703. def worker_cmdline(self):
  704. return ['tools/run_tests/performance/run_worker_python_asyncio.sh']
  705. def worker_port_offset(self):
  706. return 1200
  707. def scenarios(self):
  708. for outstanding in [64, 128, 256, 512]:
  709. for channels in [1, 4]:
  710. yield _ping_pong_scenario(
  711. 'python_asyncio_protobuf_async_unary_ping_pong_%dx%d_max' %
  712. (
  713. outstanding,
  714. channels,
  715. ),
  716. rpc_type='UNARY',
  717. client_type='ASYNC_CLIENT',
  718. server_type='ASYNC_SERVER',
  719. outstanding=outstanding * channels,
  720. channels=channels,
  721. client_processes=0,
  722. server_processes=0,
  723. unconstrained_client='async',
  724. categories=[SCALABLE])
  725. yield _ping_pong_scenario(
  726. 'python_asyncio_protobuf_async_unary_ping_pong_%d_1thread' %
  727. outstanding,
  728. rpc_type='UNARY',
  729. client_type='ASYNC_CLIENT',
  730. server_type='ASYNC_SERVER',
  731. outstanding=outstanding,
  732. channels=1,
  733. client_processes=1,
  734. server_processes=1,
  735. unconstrained_client='async',
  736. categories=[SCALABLE])
  737. yield _ping_pong_scenario(
  738. 'python_asyncio_generic_async_streaming_ping_pong',
  739. rpc_type='STREAMING',
  740. client_type='ASYNC_CLIENT',
  741. server_type='ASYNC_GENERIC_SERVER',
  742. channels=1,
  743. client_processes=1,
  744. server_processes=1,
  745. use_generic_payload=True,
  746. categories=[SMOKETEST, SCALABLE])
  747. yield _ping_pong_scenario(
  748. 'python_asyncio_protobuf_async_streaming_ping_pong',
  749. rpc_type='STREAMING',
  750. client_type='ASYNC_CLIENT',
  751. server_type='ASYNC_SERVER',
  752. channels=1,
  753. client_processes=1,
  754. server_processes=1,
  755. categories=[SMOKETEST, SCALABLE])
  756. yield _ping_pong_scenario(
  757. 'python_asyncio_protobuf_async_unary_ping_pong',
  758. rpc_type='UNARY',
  759. client_type='ASYNC_CLIENT',
  760. server_type='ASYNC_SERVER',
  761. client_processes=1,
  762. server_processes=1,
  763. categories=[SMOKETEST, SCALABLE])
  764. yield _ping_pong_scenario(
  765. 'python_asyncio_protobuf_async_unary_ping_pong',
  766. rpc_type='UNARY',
  767. client_type='ASYNC_CLIENT',
  768. server_type='ASYNC_SERVER',
  769. channels=1,
  770. client_processes=1,
  771. server_processes=1,
  772. categories=[SMOKETEST, SCALABLE])
  773. yield _ping_pong_scenario(
  774. 'python_asyncio_protobuf_async_unary_qps_unconstrained',
  775. rpc_type='UNARY',
  776. client_type='ASYNC_CLIENT',
  777. server_type='ASYNC_SERVER',
  778. channels=1,
  779. unconstrained_client='async')
  780. yield _ping_pong_scenario(
  781. 'python_asyncio_protobuf_async_streaming_qps_unconstrained',
  782. rpc_type='STREAMING',
  783. client_type='ASYNC_CLIENT',
  784. server_type='ASYNC_SERVER',
  785. channels=1,
  786. unconstrained_client='async')
  787. yield _ping_pong_scenario(
  788. 'python_asyncio_to_cpp_protobuf_async_unary_ping_pong_1thread',
  789. rpc_type='UNARY',
  790. client_type='ASYNC_CLIENT',
  791. server_type='ASYNC_SERVER',
  792. server_language='c++',
  793. channels=1,
  794. client_processes=1,
  795. unconstrained_client='async',
  796. categories=[SMOKETEST, SCALABLE])
  797. yield _ping_pong_scenario(
  798. 'python_asyncio_to_cpp_protobuf_async_unary_ping_pong_max',
  799. rpc_type='UNARY',
  800. client_type='ASYNC_CLIENT',
  801. server_type='ASYNC_SERVER',
  802. unconstrained_client='async',
  803. channels=1,
  804. client_processes=0,
  805. server_language='c++',
  806. categories=[SMOKETEST, SCALABLE])
  807. yield _ping_pong_scenario(
  808. 'python_asyncio_to_cpp_protobuf_sync_streaming_ping_pong_1thread',
  809. rpc_type='STREAMING',
  810. client_type='ASYNC_CLIENT',
  811. server_type='ASYNC_SERVER',
  812. channels=1,
  813. client_processes=1,
  814. server_processes=1,
  815. unconstrained_client='async',
  816. server_language='c++')
  817. yield _ping_pong_scenario(
  818. 'python_asyncio_protobuf_async_unary_ping_pong_1MB',
  819. rpc_type='UNARY',
  820. client_type='ASYNC_CLIENT',
  821. server_type='ASYNC_SERVER',
  822. req_size=1024 * 1024,
  823. resp_size=1024 * 1024,
  824. channels=1,
  825. client_processes=1,
  826. server_processes=1,
  827. categories=[SMOKETEST, SCALABLE])
  828. def __str__(self):
  829. return 'python_asyncio'
  830. class RubyLanguage(Language):
  831. def worker_cmdline(self):
  832. return ['tools/run_tests/performance/run_worker_ruby.sh']
  833. def worker_port_offset(self):
  834. return 300
  835. def scenarios(self):
  836. yield _ping_pong_scenario('ruby_protobuf_sync_streaming_ping_pong',
  837. rpc_type='STREAMING',
  838. client_type='SYNC_CLIENT',
  839. server_type='SYNC_SERVER',
  840. categories=[SMOKETEST, SCALABLE])
  841. yield _ping_pong_scenario('ruby_protobuf_unary_ping_pong',
  842. rpc_type='UNARY',
  843. client_type='SYNC_CLIENT',
  844. server_type='SYNC_SERVER',
  845. categories=[SMOKETEST, SCALABLE])
  846. yield _ping_pong_scenario('ruby_protobuf_sync_unary_qps_unconstrained',
  847. rpc_type='UNARY',
  848. client_type='SYNC_CLIENT',
  849. server_type='SYNC_SERVER',
  850. unconstrained_client='sync')
  851. yield _ping_pong_scenario(
  852. 'ruby_protobuf_sync_streaming_qps_unconstrained',
  853. rpc_type='STREAMING',
  854. client_type='SYNC_CLIENT',
  855. server_type='SYNC_SERVER',
  856. unconstrained_client='sync')
  857. yield _ping_pong_scenario('ruby_to_cpp_protobuf_sync_unary_ping_pong',
  858. rpc_type='UNARY',
  859. client_type='SYNC_CLIENT',
  860. server_type='SYNC_SERVER',
  861. server_language='c++',
  862. async_server_threads=1)
  863. yield _ping_pong_scenario(
  864. 'ruby_to_cpp_protobuf_sync_streaming_ping_pong',
  865. rpc_type='STREAMING',
  866. client_type='SYNC_CLIENT',
  867. server_type='SYNC_SERVER',
  868. server_language='c++',
  869. async_server_threads=1)
  870. yield _ping_pong_scenario('ruby_protobuf_unary_ping_pong_1MB',
  871. rpc_type='UNARY',
  872. client_type='SYNC_CLIENT',
  873. server_type='SYNC_SERVER',
  874. req_size=1024 * 1024,
  875. resp_size=1024 * 1024,
  876. categories=[SMOKETEST, SCALABLE])
  877. def __str__(self):
  878. return 'ruby'
  879. class Php7Language(Language):
  880. def __init__(self, php7_protobuf_c=False):
  881. super().__init__()
  882. self.php7_protobuf_c = php7_protobuf_c
  883. def worker_cmdline(self):
  884. if self.php7_protobuf_c:
  885. return [
  886. 'tools/run_tests/performance/run_worker_php.sh',
  887. '--use_protobuf_c_extension'
  888. ]
  889. return ['tools/run_tests/performance/run_worker_php.sh']
  890. def worker_port_offset(self):
  891. if self.php7_protobuf_c:
  892. return 900
  893. return 800
  894. def scenarios(self):
  895. php7_extension_mode = 'php7_protobuf_php_extension'
  896. if self.php7_protobuf_c:
  897. php7_extension_mode = 'php7_protobuf_c_extension'
  898. yield _ping_pong_scenario('%s_to_cpp_protobuf_sync_unary_ping_pong' %
  899. php7_extension_mode,
  900. rpc_type='UNARY',
  901. client_type='SYNC_CLIENT',
  902. server_type='SYNC_SERVER',
  903. server_language='c++',
  904. async_server_threads=1)
  905. yield _ping_pong_scenario(
  906. '%s_to_cpp_protobuf_sync_streaming_ping_pong' % php7_extension_mode,
  907. rpc_type='STREAMING',
  908. client_type='SYNC_CLIENT',
  909. server_type='SYNC_SERVER',
  910. server_language='c++',
  911. async_server_threads=1)
  912. # TODO(ddyihai): Investigate why when async_server_threads=1/CPU usage 340%, the QPS performs
  913. # better than async_server_threads=0/CPU usage 490%.
  914. yield _ping_pong_scenario(
  915. '%s_to_cpp_protobuf_sync_unary_qps_unconstrained' %
  916. php7_extension_mode,
  917. rpc_type='UNARY',
  918. client_type='SYNC_CLIENT',
  919. server_type='ASYNC_SERVER',
  920. server_language='c++',
  921. outstanding=1,
  922. async_server_threads=1,
  923. unconstrained_client='sync')
  924. yield _ping_pong_scenario(
  925. '%s_to_cpp_protobuf_sync_streaming_qps_unconstrained' %
  926. php7_extension_mode,
  927. rpc_type='STREAMING',
  928. client_type='SYNC_CLIENT',
  929. server_type='ASYNC_SERVER',
  930. server_language='c++',
  931. outstanding=1,
  932. async_server_threads=1,
  933. unconstrained_client='sync')
  934. def __str__(self):
  935. if self.php7_protobuf_c:
  936. return 'php7_protobuf_c'
  937. return 'php7'
  938. class JavaLanguage(Language):
  939. def worker_cmdline(self):
  940. return ['tools/run_tests/performance/run_worker_java.sh']
  941. def worker_port_offset(self):
  942. return 400
  943. def scenarios(self):
  944. for secure in [True, False]:
  945. secstr = 'secure' if secure else 'insecure'
  946. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  947. yield _ping_pong_scenario(
  948. 'java_generic_async_streaming_ping_pong_%s' % secstr,
  949. rpc_type='STREAMING',
  950. client_type='ASYNC_CLIENT',
  951. server_type='ASYNC_GENERIC_SERVER',
  952. use_generic_payload=True,
  953. async_server_threads=1,
  954. secure=secure,
  955. warmup_seconds=JAVA_WARMUP_SECONDS,
  956. categories=smoketest_categories)
  957. yield _ping_pong_scenario(
  958. 'java_protobuf_async_streaming_ping_pong_%s' % secstr,
  959. rpc_type='STREAMING',
  960. client_type='ASYNC_CLIENT',
  961. server_type='ASYNC_SERVER',
  962. async_server_threads=1,
  963. secure=secure,
  964. warmup_seconds=JAVA_WARMUP_SECONDS)
  965. yield _ping_pong_scenario('java_protobuf_async_unary_ping_pong_%s' %
  966. secstr,
  967. rpc_type='UNARY',
  968. client_type='ASYNC_CLIENT',
  969. server_type='ASYNC_SERVER',
  970. async_server_threads=1,
  971. secure=secure,
  972. warmup_seconds=JAVA_WARMUP_SECONDS,
  973. categories=smoketest_categories)
  974. yield _ping_pong_scenario('java_protobuf_unary_ping_pong_%s' %
  975. secstr,
  976. rpc_type='UNARY',
  977. client_type='SYNC_CLIENT',
  978. server_type='SYNC_SERVER',
  979. async_server_threads=1,
  980. secure=secure,
  981. warmup_seconds=JAVA_WARMUP_SECONDS)
  982. yield _ping_pong_scenario(
  983. 'java_protobuf_async_unary_qps_unconstrained_%s' % secstr,
  984. rpc_type='UNARY',
  985. client_type='ASYNC_CLIENT',
  986. server_type='ASYNC_SERVER',
  987. unconstrained_client='async',
  988. secure=secure,
  989. warmup_seconds=JAVA_WARMUP_SECONDS,
  990. categories=smoketest_categories + [SCALABLE])
  991. yield _ping_pong_scenario(
  992. 'java_protobuf_async_streaming_qps_unconstrained_%s' % secstr,
  993. rpc_type='STREAMING',
  994. client_type='ASYNC_CLIENT',
  995. server_type='ASYNC_SERVER',
  996. unconstrained_client='async',
  997. secure=secure,
  998. warmup_seconds=JAVA_WARMUP_SECONDS,
  999. categories=[SCALABLE])
  1000. yield _ping_pong_scenario(
  1001. 'java_generic_async_streaming_qps_unconstrained_%s' % secstr,
  1002. rpc_type='STREAMING',
  1003. client_type='ASYNC_CLIENT',
  1004. server_type='ASYNC_GENERIC_SERVER',
  1005. unconstrained_client='async',
  1006. use_generic_payload=True,
  1007. secure=secure,
  1008. warmup_seconds=JAVA_WARMUP_SECONDS,
  1009. categories=[SCALABLE])
  1010. yield _ping_pong_scenario(
  1011. 'java_generic_async_streaming_qps_one_server_core_%s' % secstr,
  1012. rpc_type='STREAMING',
  1013. client_type='ASYNC_CLIENT',
  1014. server_type='ASYNC_GENERIC_SERVER',
  1015. unconstrained_client='async-limited',
  1016. use_generic_payload=True,
  1017. async_server_threads=1,
  1018. secure=secure,
  1019. warmup_seconds=JAVA_WARMUP_SECONDS)
  1020. # TODO(jtattermusch): add scenarios java vs C++
  1021. def __str__(self):
  1022. return 'java'
  1023. class GoLanguage(Language):
  1024. def worker_cmdline(self):
  1025. return ['tools/run_tests/performance/run_worker_go.sh']
  1026. def worker_port_offset(self):
  1027. return 600
  1028. def scenarios(self):
  1029. for secure in [True, False]:
  1030. secstr = 'secure' if secure else 'insecure'
  1031. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  1032. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  1033. # but that's mostly because of lack of better name of the enum value.
  1034. yield _ping_pong_scenario('go_generic_sync_streaming_ping_pong_%s' %
  1035. secstr,
  1036. rpc_type='STREAMING',
  1037. client_type='SYNC_CLIENT',
  1038. server_type='ASYNC_GENERIC_SERVER',
  1039. use_generic_payload=True,
  1040. async_server_threads=1,
  1041. secure=secure,
  1042. categories=smoketest_categories)
  1043. yield _ping_pong_scenario(
  1044. 'go_protobuf_sync_streaming_ping_pong_%s' % secstr,
  1045. rpc_type='STREAMING',
  1046. client_type='SYNC_CLIENT',
  1047. server_type='SYNC_SERVER',
  1048. async_server_threads=1,
  1049. secure=secure)
  1050. yield _ping_pong_scenario('go_protobuf_sync_unary_ping_pong_%s' %
  1051. secstr,
  1052. rpc_type='UNARY',
  1053. client_type='SYNC_CLIENT',
  1054. server_type='SYNC_SERVER',
  1055. async_server_threads=1,
  1056. secure=secure,
  1057. categories=smoketest_categories)
  1058. # unconstrained_client='async' is intended (client uses goroutines)
  1059. yield _ping_pong_scenario(
  1060. 'go_protobuf_sync_unary_qps_unconstrained_%s' % secstr,
  1061. rpc_type='UNARY',
  1062. client_type='SYNC_CLIENT',
  1063. server_type='SYNC_SERVER',
  1064. unconstrained_client='async',
  1065. secure=secure,
  1066. categories=smoketest_categories + [SCALABLE])
  1067. # unconstrained_client='async' is intended (client uses goroutines)
  1068. yield _ping_pong_scenario(
  1069. 'go_protobuf_sync_streaming_qps_unconstrained_%s' % secstr,
  1070. rpc_type='STREAMING',
  1071. client_type='SYNC_CLIENT',
  1072. server_type='SYNC_SERVER',
  1073. unconstrained_client='async',
  1074. secure=secure,
  1075. categories=[SCALABLE])
  1076. # unconstrained_client='async' is intended (client uses goroutines)
  1077. # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server,
  1078. # but that's mostly because of lack of better name of the enum value.
  1079. yield _ping_pong_scenario(
  1080. 'go_generic_sync_streaming_qps_unconstrained_%s' % secstr,
  1081. rpc_type='STREAMING',
  1082. client_type='SYNC_CLIENT',
  1083. server_type='ASYNC_GENERIC_SERVER',
  1084. unconstrained_client='async',
  1085. use_generic_payload=True,
  1086. secure=secure,
  1087. categories=[SCALABLE])
  1088. # TODO(jtattermusch): add scenarios go vs C++
  1089. def __str__(self):
  1090. return 'go'
  1091. class NodeLanguage(Language):
  1092. def __init__(self, node_purejs=False):
  1093. super().__init__()
  1094. self.node_purejs = node_purejs
  1095. def worker_cmdline(self):
  1096. fixture = 'native_js' if self.node_purejs else 'native_native'
  1097. return [
  1098. 'tools/run_tests/performance/run_worker_node.sh', fixture,
  1099. '--benchmark_impl=grpc'
  1100. ]
  1101. def worker_port_offset(self):
  1102. if self.node_purejs:
  1103. return 1100
  1104. return 1000
  1105. def scenarios(self):
  1106. node_implementation = 'node_purejs' if self.node_purejs else 'node'
  1107. for secure in [True, False]:
  1108. secstr = 'secure' if secure else 'insecure'
  1109. smoketest_categories = ([SMOKETEST] if secure else []) + [SCALABLE]
  1110. yield _ping_pong_scenario(
  1111. '%s_to_node_generic_async_streaming_ping_pong_%s' %
  1112. (node_implementation, secstr),
  1113. rpc_type='STREAMING',
  1114. client_type='ASYNC_CLIENT',
  1115. server_type='ASYNC_GENERIC_SERVER',
  1116. server_language='node',
  1117. use_generic_payload=True,
  1118. async_server_threads=1,
  1119. secure=secure,
  1120. categories=smoketest_categories)
  1121. yield _ping_pong_scenario(
  1122. '%s_to_node_protobuf_async_streaming_ping_pong_%s' %
  1123. (node_implementation, secstr),
  1124. rpc_type='STREAMING',
  1125. client_type='ASYNC_CLIENT',
  1126. server_type='ASYNC_SERVER',
  1127. server_language='node',
  1128. async_server_threads=1,
  1129. secure=secure)
  1130. yield _ping_pong_scenario(
  1131. '%s_to_node_protobuf_async_unary_ping_pong_%s' %
  1132. (node_implementation, secstr),
  1133. rpc_type='UNARY',
  1134. client_type='ASYNC_CLIENT',
  1135. server_type='ASYNC_SERVER',
  1136. server_language='node',
  1137. async_server_threads=1,
  1138. secure=secure,
  1139. categories=smoketest_categories)
  1140. yield _ping_pong_scenario(
  1141. '%s_to_node_protobuf_async_unary_qps_unconstrained_%s' %
  1142. (node_implementation, secstr),
  1143. rpc_type='UNARY',
  1144. client_type='ASYNC_CLIENT',
  1145. server_type='ASYNC_SERVER',
  1146. server_language='node',
  1147. unconstrained_client='async',
  1148. secure=secure,
  1149. categories=smoketest_categories + [SCALABLE])
  1150. yield _ping_pong_scenario(
  1151. '%s_to_node_protobuf_async_streaming_qps_unconstrained_%s' %
  1152. (node_implementation, secstr),
  1153. rpc_type='STREAMING',
  1154. client_type='ASYNC_CLIENT',
  1155. server_type='ASYNC_SERVER',
  1156. server_language='node',
  1157. unconstrained_client='async',
  1158. secure=secure,
  1159. categories=[SCALABLE])
  1160. yield _ping_pong_scenario(
  1161. '%s_to_node_generic_async_streaming_qps_unconstrained_%s' %
  1162. (node_implementation, secstr),
  1163. rpc_type='STREAMING',
  1164. client_type='ASYNC_CLIENT',
  1165. server_type='ASYNC_GENERIC_SERVER',
  1166. server_language='node',
  1167. unconstrained_client='async',
  1168. use_generic_payload=True,
  1169. secure=secure,
  1170. categories=[SCALABLE])
  1171. # TODO(murgatroid99): add scenarios node vs C++
  1172. def __str__(self):
  1173. if self.node_purejs:
  1174. return 'node_purejs'
  1175. return 'node'
  1176. LANGUAGES = {
  1177. 'c++': CXXLanguage(),
  1178. 'csharp': CSharpLanguage(),
  1179. 'ruby': RubyLanguage(),
  1180. 'php7': Php7Language(),
  1181. 'php7_protobuf_c': Php7Language(php7_protobuf_c=True),
  1182. 'java': JavaLanguage(),
  1183. 'python': PythonLanguage(),
  1184. 'python_asyncio': PythonAsyncIOLanguage(),
  1185. 'go': GoLanguage(),
  1186. 'node': NodeLanguage(),
  1187. 'node_purejs': NodeLanguage(node_purejs=True)
  1188. }