cloud-org / edge-proxy

2022第三届云原生编程挑战赛-赛道2:针对边缘计算场景的ACK@Edge高效的边缘自治方案 队伍: 唔想返工
6 stars 1 forks source link

[fix] solve concurrent coroutine request problem #11

Closed ronething-bot closed 2 years ago

ronething-bot commented 2 years ago

fix #10

ronething-bot commented 2 years ago

双检锁:https://segmentfault.com/a/1190000041903401

ronething-bot commented 2 years ago

原子操作(atomic):

ronething commented 2 years ago
ronething commented 2 years ago

edge-proxy

image

benchmark

image

client-go request.go

image

目前测试 200 协程没问题,500 协程有一部分(几十个)会 error,1000 的话就 error 的更多。

image
ronething commented 2 years ago

详见 commit: https://github.com/cloud-org/edge-proxy/commit/ebaec51451e33aa608513173147007433bfda08c

ronething commented 2 years ago

并发 docker image 目前评测资源分:48917.3797(submit time: 2022-08-13 15:56:54),当然也可以再测试几次,先 close,主要是为了验证并发下的请求 count 一致性问题以及类似 redis 缓存击穿问题。

缓存击穿: 一个热点的Key,有大并发集中对其进行访问,突然间这个Key失效了,导致大并发全部打在数据库上。

ronething commented 2 years ago

47870.4015(submit time: 2022-08-13 16:12:59)

ronething commented 2 years ago

49928.8520(submit time: 2022-08-13 18:45:43)

ronething-bot commented 2 years ago
ronething-bot commented 2 years ago
ronething-bot commented 2 years ago

4k or 8k 表示 net/http/server.go newBufferSize 的 size 大小

4k nums: 10, count is 24177, tps: 402/s
4k nums: 20, count is 26753, tps: 445/s
4k nums: 30, count is 27273, tps: 454/s
4k nums: 50, count is 28636, tps: 477/s
4k nums: 10000, count is 38265, tps: 637/s

8k nums: 10, count is 25842, tps: 430/s
8k nums: 20, count is 28038, tps: 467/s
8k nums: 50, count is 28001, tps: 466/s
8k nums: 100, count is 29345, tps: 489/s
8k nums: 1000, count is 31493, tps: 524/s
ronething-bot commented 2 years ago

image