Ծ߹ࣨ
OpenStack
Managed LB
Backend
APIs
߹ࣨAPIΛ։ൃͨ͠
nginx
app
unicorn
php-fpm
app role
nginx
app
unicorn
php-fpm
app role
nginx
app
unicorn
php-fpm
app role
nginx
app
unicorn
php-fpm
app role
proxy role
nginx
waiting room
Slide 27
Slide 27 text
ৄղ߹ࣨγεςϜ
Slide 28
Slide 28 text
Ծ߹ࣨ֓ཁ
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
ڐՄϦετ
Site A 200
Site B ...
Site C ...
ΫϥΠΞϯτʹͪ൪߸Λ࠾൪ͯ͠ɺڐՄϦετͷ൪߸ΑΓ
খ͍͞൪߸Λ͍࣋ͬͯΕҰఆ࣌ؒΞΫηε͕Մೳ
Client A
ΫϥΠΞϯτ൪߸:100
ΞΫηεڐՄ
Client B
ΫϥΠΞϯτ൪߸:300
߹ࣨ
ڐՄ൪߸ͷߋ৽
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
proxy role
nginx
waiting room
ڐՄ൪߸Ϧετ
Site A 200
Site B 1000
Site C 440
ҰͭͷڐՄϦετΛෳͷQSPYZSPMF͕ࢀর͢Δ߹ʹɺ
ͲͷΑ͏ʹߋ৽͢Δ͔ʁ
1͝ͱʹ200ΫϥΠΞϯτͣͭ
ڐՄ͢Δͱ͍͏Α͏ͳ
੍ޚΛ͍ͨ͠
200→400→600....
Slide 50
Slide 50 text
զʑʹgoroutine͕͋Δ͡Όͳ͍͔
waiting room
http server
access controller ڐՄ൪߸Ϧετ
Site A 200
Site B 1000
Site C 440
ࢦఆִؒͰϦετΛࢀর͠ɺڐՄϦετΛߋ৽͢Δ
goroutineΛىಈ͢Δ
ߋ৽
Slide 51
Slide 51 text
ڐՄ൪߸Ϧετͷഉଞ੍ޚ
waiting room
http server
access
controller
ڐՄ൪߸Ϧετ
Site A 200
Site B 1000
Site C 440
SETNXΛ׆༻͢Δ͜ͱͰඞͣυϝΠϯ͋ͨΓͷ
ߋ৽ϓϩηεඞͣҰͭʹͳΔ
waiting room
http server
access
controller
SETNX ok
SETNX ng
ΞΫηεڐՄ
ڐՄ൪߸Ϧετ
Site A 200
Site B 1000
Site C 440
ΫϥΠΞϯτͷΞΫηεΛڐՄͨ͠߹ɺ
ΫϥΠΞϯτIDΛΩʔʹRedisʹอଘ͠ɺ
TTLͷظؒΞΫηεڐՄ
Site A
ΫϥΠΞϯτ൪߸:100
ΫϥΠΞϯτID: UUID1
waiting room
ࢀর
Ωʔ TTL
UUID1 600
ॻ͖ࠐΈ
Client
Slide 54
Slide 54 text
ੑೳධՁ
Slide 55
Slide 55 text
Cookie͑ΔϕϯνϚʔΧʔॻ͍ͨ
https://github.com/pyama86/ngx-smart-ratelimit/tree/master/bench
CPU Apple M1 MAX
ϝϞϦ 64G
10ฒྻ 10,000ϦΫΤετ
keepaliveͳ͠
ଌఆڥ
݁Ռ
5000 request / sec
ฏۉ0.2msecͰԠՄೳ