darwinia-network / devops

0 stars 0 forks source link

Rate limit support for RPC request #3

Closed fewensa closed 1 year ago

fewensa commented 1 year ago

Temporarily banned requests from the same source for a period of time to provide stable RPC services or block attacks.

fewensa commented 1 year ago

Verified by testnets pangolin and pangoro.

 ./go-stress-testing-linux -code 405 -c 25 -n 100 -u https://pangolin-rpc.darwinia.network

 开始启动  并发数:25 请求数:100 请求参数:
request:
 form:http
 url:https://pangolin-rpc.darwinia.network
 method:GET
 headers:map[Content-Type:application/x-www-form-urlencoded; charset=utf-8]
 data:
 verify:statusCode
 timeout:30s
 debug:false
 http2.0:false
 keepalive:false
 maxCon:1

─────┬───────┬───────┬───────┬────────┬────────┬────────┬────────┬────────┬────────┬────────
 耗时│ 并发数│ 成功数│ 失败数│   qps  │最长耗时│最短耗时│平均耗时│下载字节│字节每秒│ 状态码
─────┼───────┼───────┼───────┼────────┼────────┼────────┼────────┼────────┼────────┼────────
   1s│     23│     11│     37│   14.79│  907.42│  271.56│ 1690.65│   1,300│   1,298│405:11;429:37
   2s│     25│     19│     87│   11.38│ 1223.81│  261.61│ 2197.23│   2,638│   1,318│405:19;429:87
   3s│     25│     27│    146│   10.01│ 1223.81│  261.61│ 2498.00│   4,129│   1,376│405:27;429:146
   4s│     25│     36│    200│    9.64│ 1223.81│  261.24│ 2594.44│   5,596│   1,398│405:36;429:200
   5s│     25│     43│    252│    9.24│ 1223.81│  260.89│ 2704.35│   6,907│   1,381│405:43;429:252
   6s│     25│     51│    312│    8.93│ 1223.81│  258.35│ 2800.17│   8,415│   1,402│405:51;429:312
   7s│     25│     59│    365│    8.84│ 1223.81│  258.24│ 2829.47│   9,804│   1,400│405:59;429:365
   8s│     25│     67│    425│    8.70│ 1223.81│  258.24│ 2874.17│  11,312│   1,413│405:67;429:425
   9s│     25│     76│    478│    8.74│ 1223.81│  258.24│ 2861.19│  12,762│   1,417│405:76;429:478
  10s│     25│     83│    536│    8.57│ 1223.81│  258.24│ 2915.68│  14,175│   1,417│405:83;429:536
  11s│     25│     92│    592│    8.58│ 1223.81│  258.24│ 2913.80│  15,676│   1,424│405:92;429:592
  12s│     25│     99│    649│    8.47│ 1223.81│  258.24│ 2950.07│  17,072│   1,422│405:99;429:649
  13s│     25│    107│    706│    8.44│ 1223.81│  257.87│ 2962.18│  18,529│   1,425│405:107;429:706
  14s│     25│    116│    763│    8.46│ 1223.81│  257.87│ 2955.26│  20,047│   1,431│405:116;429:763
  15s│     25│    124│    820│    8.43│ 1223.81│  257.87│ 2966.28│  21,504│   1,433│405:124;429:820
  16s│     25│    132│    877│    8.40│ 1223.81│  257.87│ 2977.45│  22,961│   1,434│405:132;429:877
  17s│     25│    139│    932│    8.33│ 1223.81│  257.87│ 3002.60│  24,323│   1,430│405:139;429:932
  18s│     25│    147│    989│    8.31│ 1223.81│  257.87│ 3008.22│  25,780│   1,432│405:147;429:989
  19s│     25│    155│   1045│    8.29│ 1223.81│  255.56│ 3014.71│  27,220│   1,432│405:155;429:1045
  20s│     25│    163│   1103│    8.28│ 1223.81│  253.39│ 3019.33│  28,694│   1,434│405:163;429:1103
  21s│     25│    171│   1161│    8.26│ 1223.81│  253.39│ 3027.27│  30,168│   1,436│405:171;429:1161
  22s│     25│    179│   1217│    8.25│ 1223.81│  253.39│ 3029.30│  31,608│   1,436│405:179;429:1217
  23s│     25│    187│   1274│    8.24│ 1223.81│  253.39│ 3032.20│  33,065│   1,437│405:187;429:1274
  24s│     25│    195│   1333│    8.23│ 1223.81│  249.88│ 3037.47│  34,556│   1,439│405:195;429:1333
  25s│     25│    204│   1390│    8.25│ 1223.81│  249.88│ 3030.20│  36,074│   1,442│405:204;429:1390
  26s│     25│    211│   1442│    8.23│ 1223.81│  249.88│ 3038.83│  37,385│   1,437│405:211;429:1442
fewensa commented 1 year ago

It will be add to mainnets later.