dlb demo
1.0.0
OpenRestyを導入するためのダイナミックロードバランシングデモ。
最初に#18 a2os週に使用されます。
$ git clone https://github.com/Triple-Z/dlb-demo
$ cd dlb-demo/
$ docker-compose up次に、http:// localhost:8888継続的にアクセスして、応答コンテンツ番号が常に変更されていることがわかります。
または
for i in {1..10} ; do curl http://localhost:8888 ; done代わりにfor i in {1..10} ; do curl http://localhost:8888 ; done。
バックエンドサーバーの構成:
servers = {
{
host = " 172.28.0.101 " ,
port = 80 ,
weight = 5 , -- backend 1
},
{
host = " 172.28.0.102 " ,
port = 80 ,
weight = 3 , -- backend 2
},
{
host = " 172.28.0.103 " ,
port = 80 ,
weight = 2 , -- backend 3
},
}結果:
# Round-robin (rr)
$ for i in {1..10} ; do curl http://localhost:8888 ; done
response from backend 1
response from backend 2
response from backend 3
response from backend 1
response from backend 2
response from backend 3
response from backend 1
response from backend 2
response from backend 3
response from backend 1
# Weighted round-robin (wrr)
$ for i in {1..10} ; do curl http://localhost:8888 ; done
response from backend 1
response from backend 1
response from backend 1
response from backend 1
response from backend 1
response from backend 2
response from backend 2
response from backend 2
response from backend 3
response from backend 3
# Smooth weighted round-robin (swrr)
$ for i in {1..10} ; do curl http://localhost:8888 ; done
response from backend 1
response from backend 2
response from backend 3
response from backend 1
response from backend 1
response from backend 2
response from backend 1
response from backend 3
response from backend 2
response from backend 1Copyright©2020 Triple-Z
このプロジェクトは、MITライセンスによって開かれています。