performance_test.yaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. name: Performance Test Suite
  2. on:
  3. push:
  4. branches:
  5. - 'perf/**'
  6. schedule:
  7. - cron: '0 1 * * MON-FRI'
  8. workflow_dispatch:
  9. inputs:
  10. ref:
  11. required: false
  12. env:
  13. TF_AWS_REGION: eu-west-1
  14. TF_VAR_s3_bucket_name: tf-emqx-performance-test2
  15. TF_VAR_test_duration: 1800
  16. TF_VAR_prometheus_remote_write_region: eu-west-1
  17. TF_VAR_prometheus_remote_write_url: ${{ secrets.TF_EMQX_PERF_TEST_PROMETHEUS_REMOTE_WRITE_URL }}
  18. SLACK_WEBHOOK_URL: ${{ secrets.TF_EMQX_PERF_TEST_SLACK_URL }}
  19. permissions:
  20. contents: read
  21. jobs:
  22. prepare:
  23. runs-on: ubuntu-latest
  24. if: github.repository_owner == 'emqx'
  25. container: ghcr.io/emqx/emqx-builder/5.2-9:1.15.7-26.1.2-3-ubuntu20.04
  26. outputs:
  27. BENCH_ID: ${{ steps.prepare.outputs.BENCH_ID }}
  28. PACKAGE_FILE: ${{ steps.package_file.outputs.PACKAGE_FILE }}
  29. steps:
  30. - uses: actions/checkout@v3
  31. with:
  32. fetch-depth: 0
  33. ref: ${{ github.event.inputs.ref }}
  34. - name: Work around https://github.com/actions/checkout/issues/766
  35. run: |
  36. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  37. - id: prepare
  38. run: |
  39. echo "EMQX_NAME=emqx" >> $GITHUB_ENV
  40. echo "CODE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
  41. echo "BENCH_ID=$(date --utc +%F)/emqx-$(./pkg-vsn.sh emqx)" >> $GITHUB_OUTPUT
  42. - name: Build deb package
  43. run: |
  44. make ${EMQX_NAME}-pkg
  45. ./scripts/pkg-tests.sh ${EMQX_NAME}-pkg
  46. - name: Get package file name
  47. id: package_file
  48. run: |
  49. echo "PACKAGE_FILE=$(find _packages/emqx -name 'emqx-*.deb' | head -n 1 | xargs basename)" >> $GITHUB_OUTPUT
  50. - uses: actions/upload-artifact@v3
  51. with:
  52. name: emqx-ubuntu20.04
  53. path: _packages/emqx/${{ steps.package_file.outputs.PACKAGE_FILE }}
  54. scenario_1on1:
  55. runs-on: ubuntu-latest
  56. needs:
  57. - prepare
  58. env:
  59. TF_VAR_package_file: ${{ needs.prepare.outputs.PACKAGE_FILE }}
  60. steps:
  61. - name: Configure AWS Credentials
  62. uses: aws-actions/configure-aws-credentials@v2
  63. with:
  64. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PERF_TEST }}
  65. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PERF_TEST }}
  66. aws-region: eu-west-1
  67. - name: Checkout tf-emqx-performance-test
  68. uses: actions/checkout@v3
  69. with:
  70. repository: emqx/tf-emqx-performance-test
  71. path: tf-emqx-performance-test
  72. ref: v0.2.3
  73. - uses: actions/download-artifact@v3
  74. with:
  75. name: emqx-ubuntu20.04
  76. path: tf-emqx-performance-test/
  77. - name: Setup Terraform
  78. uses: hashicorp/setup-terraform@v2
  79. with:
  80. terraform_wrapper: false
  81. - name: run scenario
  82. working-directory: ./tf-emqx-performance-test
  83. timeout-minutes: 60
  84. env:
  85. TF_VAR_bench_id: "${{ needs.prepare.outputs.BENCH_ID }}/1on1"
  86. TF_VAR_use_emqttb: 1
  87. TF_VAR_use_emqtt_bench: 0
  88. TF_VAR_emqttb_instance_count: 1
  89. TF_VAR_emqttb_instance_type: c5.2xlarge
  90. TF_VAR_emqttb_scenario: '@pubsub_fwd -n 50_000 --pub-qos 1 --sub-qos 1'
  91. TF_VAR_emqx_instance_type: c5.2xlarge
  92. TF_VAR_emqx_instance_count: 3
  93. run: |
  94. terraform init
  95. terraform apply -auto-approve
  96. ./wait-emqttb.sh
  97. ./fetch-metrics.sh
  98. terraform destroy -auto-approve
  99. aws s3 sync --exclude '*' --include '*.tar.gz' s3://$TF_VAR_s3_bucket_name/$TF_VAR_bench_id .
  100. - name: Send notification to Slack
  101. uses: slackapi/slack-github-action@v1.24.0
  102. with:
  103. payload-file-path: "./tf-emqx-performance-test/slack-payload.json"
  104. - name: terraform destroy
  105. if: always()
  106. working-directory: ./tf-emqx-performance-test
  107. run: |
  108. terraform destroy -auto-approve
  109. - uses: actions/upload-artifact@v3
  110. if: success()
  111. with:
  112. name: metrics
  113. path: |
  114. "./tf-emqx-performance-test/*.tar.gz"
  115. - uses: actions/upload-artifact@v3
  116. if: failure()
  117. with:
  118. name: terraform
  119. path: |
  120. ./tf-emqx-performance-test/.terraform
  121. ./tf-emqx-performance-test/*.tfstate
  122. scenario_fanout:
  123. runs-on: ubuntu-latest
  124. needs:
  125. - prepare
  126. - scenario_1on1
  127. env:
  128. TF_VAR_package_file: ${{ needs.prepare.outputs.PACKAGE_FILE }}
  129. steps:
  130. - name: Configure AWS Credentials
  131. uses: aws-actions/configure-aws-credentials@v2
  132. with:
  133. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PERF_TEST }}
  134. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PERF_TEST }}
  135. aws-region: eu-west-1
  136. - name: Checkout tf-emqx-performance-test
  137. uses: actions/checkout@v3
  138. with:
  139. repository: emqx/tf-emqx-performance-test
  140. path: tf-emqx-performance-test
  141. ref: v0.2.3
  142. - uses: actions/download-artifact@v3
  143. with:
  144. name: emqx-ubuntu20.04
  145. path: tf-emqx-performance-test/
  146. - name: Setup Terraform
  147. uses: hashicorp/setup-terraform@v2
  148. with:
  149. terraform_wrapper: false
  150. - name: run scenario
  151. working-directory: ./tf-emqx-performance-test
  152. timeout-minutes: 60
  153. env:
  154. TF_VAR_bench_id: "${{ needs.prepare.outputs.BENCH_ID }}/fan-out"
  155. TF_VAR_use_emqttb: 1
  156. TF_VAR_use_emqtt_bench: 0
  157. TF_VAR_emqttb_instance_count: 1
  158. TF_VAR_emqttb_instance_type: c5.2xlarge
  159. TF_VAR_emqttb_scenario: '@pub --topic "t/%n" --conninterval 10ms --pubinterval 20ms --num-clients 5 --size 16 @sub --topic "t/#" --conninterval 10ms --num-clients 1000'
  160. TF_VAR_emqx_instance_type: c5.large
  161. TF_VAR_emqx_instance_count: 3
  162. run: |
  163. terraform init
  164. terraform apply -auto-approve
  165. ./wait-emqttb.sh
  166. ./fetch-metrics.sh
  167. terraform destroy -auto-approve
  168. aws s3 sync --exclude '*' --include '*.tar.gz' s3://$TF_VAR_s3_bucket_name/$TF_VAR_bench_id .
  169. - name: Send notification to Slack
  170. uses: slackapi/slack-github-action@v1.24.0
  171. with:
  172. payload-file-path: "./tf-emqx-performance-test/slack-payload.json"
  173. - name: terraform destroy
  174. if: always()
  175. working-directory: ./tf-emqx-performance-test
  176. run: |
  177. terraform destroy -auto-approve
  178. - uses: actions/upload-artifact@v3
  179. if: success()
  180. with:
  181. name: metrics
  182. path: |
  183. "./tf-emqx-performance-test/*.tar.gz"
  184. - uses: actions/upload-artifact@v3
  185. if: failure()
  186. with:
  187. name: terraform
  188. path: |
  189. ./tf-emqx-performance-test/.terraform
  190. ./tf-emqx-performance-test/*.tfstate
  191. scenario_fanin:
  192. runs-on: ubuntu-latest
  193. needs:
  194. - prepare
  195. - scenario_1on1
  196. - scenario_fanout
  197. env:
  198. TF_VAR_package_file: ${{ needs.prepare.outputs.PACKAGE_FILE }}
  199. steps:
  200. - name: Configure AWS Credentials
  201. uses: aws-actions/configure-aws-credentials@v2
  202. with:
  203. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PERF_TEST }}
  204. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PERF_TEST }}
  205. aws-region: eu-west-1
  206. - name: Checkout tf-emqx-performance-test
  207. uses: actions/checkout@v3
  208. with:
  209. repository: emqx/tf-emqx-performance-test
  210. path: tf-emqx-performance-test
  211. ref: v0.2.3
  212. - uses: actions/download-artifact@v3
  213. with:
  214. name: emqx-ubuntu20.04
  215. path: tf-emqx-performance-test/
  216. - name: Setup Terraform
  217. uses: hashicorp/setup-terraform@v2
  218. with:
  219. terraform_wrapper: false
  220. - name: run scenario
  221. working-directory: ./tf-emqx-performance-test
  222. timeout-minutes: 60
  223. env:
  224. TF_VAR_bench_id: "${{ needs.prepare.outputs.BENCH_ID }}/fan-in"
  225. TF_VAR_use_emqttb: 1
  226. TF_VAR_use_emqtt_bench: 0
  227. TF_VAR_emqttb_instance_count: 2
  228. TF_VAR_emqttb_start_n_multiplier: 25000
  229. TF_VAR_emqttb_instance_type: c5.xlarge
  230. TF_VAR_emqttb_scenario: '@pub --topic t/%n --conninterval 10ms --pubinterval 1s --num-clients 25_000 --start-n $START_N --size 16 @sub --topic \$share/perf/t/# --conninterval 10ms --num-clients 250'
  231. TF_VAR_emqx_instance_type: c5.2xlarge
  232. TF_VAR_emqx_instance_count: 3
  233. run: |
  234. terraform init
  235. terraform apply -auto-approve
  236. ./wait-emqttb.sh
  237. ./fetch-metrics.sh
  238. terraform destroy -auto-approve
  239. aws s3 sync --exclude '*' --include '*.tar.gz' s3://$TF_VAR_s3_bucket_name/$TF_VAR_bench_id .
  240. - name: Send notification to Slack
  241. uses: slackapi/slack-github-action@v1.24.0
  242. with:
  243. payload-file-path: "./tf-emqx-performance-test/slack-payload.json"
  244. - name: terraform destroy
  245. if: always()
  246. working-directory: ./tf-emqx-performance-test
  247. run: |
  248. terraform destroy -auto-approve
  249. - uses: actions/upload-artifact@v3
  250. if: success()
  251. with:
  252. name: metrics
  253. path: |
  254. "./tf-emqx-performance-test/*.tar.gz"
  255. - uses: actions/upload-artifact@v3
  256. if: failure()
  257. with:
  258. name: terraform
  259. path: |
  260. ./tf-emqx-performance-test/.terraform
  261. ./tf-emqx-performance-test/*.tfstate
  262. scenario_1m_conns:
  263. runs-on: ubuntu-latest
  264. needs:
  265. - prepare
  266. - scenario_fanin
  267. - scenario_fanout
  268. - scenario_1on1
  269. env:
  270. TF_VAR_package_file: ${{ needs.prepare.outputs.PACKAGE_FILE }}
  271. steps:
  272. - name: Configure AWS Credentials
  273. uses: aws-actions/configure-aws-credentials@v2
  274. with:
  275. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PERF_TEST }}
  276. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PERF_TEST }}
  277. aws-region: eu-west-1
  278. - name: Checkout tf-emqx-performance-test
  279. uses: actions/checkout@v3
  280. with:
  281. repository: emqx/tf-emqx-performance-test
  282. path: tf-emqx-performance-test
  283. ref: v0.2.3
  284. - uses: actions/download-artifact@v3
  285. with:
  286. name: emqx-ubuntu20.04
  287. path: tf-emqx-performance-test/
  288. - name: Setup Terraform
  289. uses: hashicorp/setup-terraform@v2
  290. with:
  291. terraform_wrapper: false
  292. - name: run scenario
  293. working-directory: ./tf-emqx-performance-test
  294. timeout-minutes: 60
  295. env:
  296. TF_VAR_bench_id: "${{ needs.prepare.outputs.BENCH_ID }}/1m-connections"
  297. TF_VAR_use_emqttb: 1
  298. TF_VAR_use_emqtt_bench: 0
  299. TF_VAR_emqttb_instance_count: 5
  300. TF_VAR_emqttb_instance_type: c5.2xlarge
  301. TF_VAR_emqttb_scenario: '@conn -N 200_000 --conninterval 1ms'
  302. TF_VAR_emqx_instance_type: c5.2xlarge
  303. TF_VAR_emqx_instance_count: 3
  304. run: |
  305. terraform init
  306. terraform apply -auto-approve
  307. ./wait-emqttb.sh
  308. ./fetch-metrics.sh
  309. terraform destroy -auto-approve
  310. aws s3 sync --exclude '*' --include '*.tar.gz' s3://$TF_VAR_s3_bucket_name/$TF_VAR_bench_id .
  311. - name: Send notification to Slack
  312. uses: slackapi/slack-github-action@v1.24.0
  313. with:
  314. payload-file-path: "./tf-emqx-performance-test/slack-payload.json"
  315. - name: terraform destroy
  316. if: always()
  317. working-directory: ./tf-emqx-performance-test
  318. run: |
  319. terraform destroy -auto-approve
  320. - uses: actions/upload-artifact@v3
  321. if: success()
  322. with:
  323. name: metrics
  324. path: |
  325. "./tf-emqx-performance-test/*.tar.gz"
  326. - uses: actions/upload-artifact@v3
  327. if: failure()
  328. with:
  329. name: terraform
  330. path: |
  331. ./tf-emqx-performance-test/.terraform
  332. ./tf-emqx-performance-test/*.tfstate