scenario_config.py 53 KB

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