CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 13:48:34 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"dd11b2ec6524ec7e30e21b9a137eedf6"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=6bSeYHkX5xaN5eBJfsZRosHG0TMSXwNYoPqPZpooIIxJho4Blmx3ROzRh1Y96ZXG5zY3%2FLdd4QNnFI1DILzXucioOaKPqofXX54rqn%2F1ytZaC2dKpmSeG69kWBb5or2W97F%2BRFH%2BsyYKqzFtVucMWNz5ZfQ1swD46g3t9QK1%2BKut2QXiDzk6nVkAJgafYnBhn8oUaCXbu4g6jtzWKcdFN8uoN7dic8Mdf29iYRaIHQh4EOxW%2BDpirYpntr%2FMYiReSZDkGWgSgT5sfo4FIiOvtQ%3D%3D--fdiBKFr1gaJVmcfJ--ZcxFkPPlhoAO0zau%2FTEZrw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.815142748.1753624114; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 13:48:34 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 13:48:34 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C6FC:3E3773:551453:70DC08:68862E32
Benchmark · alibaba/sentinel-golang Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 445
Benchmark
louyuting edited this page Sep 1, 2020
·
10 revisions
TODO
CPU:Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz (32 Cores)
OS:Red Hat 4.8.2-16
golang version: 1.14.3
测试单协程/并发模式下接入 Sentinel 与不接入 Sentinel 吞吐量的对比。我们通过执行一些 CPU 密集型操作(小数组排序)来模拟不同 QPS 下的情况。测试例子参考:Benchmark
Benchmark_Single_Directly_50 4081059 882 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_50 4075447 886 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_50 4065984 884 ns/op 32 B/op 1 allocs/op
Benchmark_Single_StatEntry_50 2508170 1434 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_50 2508332 1435 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_50 2506646 1437 ns/op 128 B/op 4 allocs/op
Benchmark_Single_Directly_100 1504512 2391 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_100 1506342 2393 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_100 1500378 2393 ns/op 32 B/op 1 allocs/op
Benchmark_Single_StatEntry_100 1224729 2937 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_100 1225106 3257 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_100 1168003 2935 ns/op 128 B/op 4 allocs/op
Benchmark_Single_Directly_200 613916 5899 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_200 609230 5915 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_200 612487 5910 ns/op 32 B/op 1 allocs/op
Benchmark_Single_StatEntry_200 556461 6473 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_200 561085 6477 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_200 550544 6461 ns/op 128 B/op 4 allocs/op
Benchmark_Single_Directly_500 190442 18859 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_500 185095 18902 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_500 191236 18889 ns/op 32 B/op 1 allocs/op
Benchmark_Single_StatEntry_500 185674 19426 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_500 185353 19444 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_500 185371 19487 ns/op 128 B/op 4 allocs/op
Benchmark_Single_Directly_1000 86101 41642 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_1000 86492 41760 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_1000 86415 41769 ns/op 32 B/op 1 allocs/op
Benchmark_Single_StatEntry_1000 83931 42339 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_1000 84270 42321 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_1000 85328 42420 ns/op 128 B/op 4 allocs/op
Benchmark_Single_Directly_2000 39504 90540 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_2000 39612 90218 ns/op 32 B/op 1 allocs/op
Benchmark_Single_Directly_2000 39786 90401 ns/op 32 B/op 1 allocs/op
Benchmark_Single_StatEntry_2000 39234 91519 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_2000 39418 91123 ns/op 128 B/op 4 allocs/op
Benchmark_Single_StatEntry_2000 39360 91208 ns/op 128 B/op 4 allocs/op
Benchmark_Single_Directly_4000 18218 197592 ns/op 33 B/op 1 allocs/op
Benchmark_Single_Directly_4000 18194 197011 ns/op 33 B/op 1 allocs/op
Benchmark_Single_Directly_4000 18213 197554 ns/op 33 B/op 1 allocs/op
Benchmark_Single_StatEntry_4000 18105 198295 ns/op 130 B/op 4 allocs/op
Benchmark_Single_StatEntry_4000 18162 198432 ns/op 130 B/op 4 allocs/op
Benchmark_Single_StatEntry_4000 18162 198686 ns/op 129 B/op 4 allocs/op
这里取三组数据的中位值:
数组长度 | Baseline(QPS) | With Sentinel(QPS) | 性能损耗 |
---|---|---|---|
50 | 1131221 | 696864 | 38.4% |
100 | 417885 | 340483 | 18.5% |
200 | 169204 | 154487 | 8.7% |
500 | 52940 | 51429 | 2.9% |
1000 | 23946 | 23618 | 1.4% |
2000 | 11061 | 10963 | 0.9% |
4000 | 5061 | 5039 | 0.4% |
可以看到在单机 QPS 非常大的时候(16W+),Sentinel 带来的性能损耗会比较大。这种情况业务逻辑本身的耗时非常小,而 Sentinel 一系列的统计、检查操作会消耗一定的时间。常见的场景有缓存读取操作。
而单机 QPS 在 6W 以下的时候,Sentinel 的性能损耗就比较小了,对大多数场景来说都适用。
测试排序数组长度是200时候,并发4/8/16/32/32+协程并发下的性能:
并发数 | With Sentinel(QPS) | 性能 |
---|---|---|
1 | 154487 | 100% |
4 | 586510 | 379% |
8 | 685871 | 443% |
16 | 1324503 | 857% |
32 | 1449275 | 938% |
32并发以上基本没有提升了。
测试场景:6000 个资源循环跑(即单机的极端场景,目前最多支持 6000 个 entry)
- 单协程不断循环运行:内存占用约 30 MB
- 8个协程不断循环运行:内存占用约 36 MB
-
文档
-
Documents (EN)
Clone this wiki locally
You can’t perform that action at this time.