performance_test.yaml 11 KB

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