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 1저작권 © 2020 Triple-Z
이 프로젝트는 MIT 라이센스가 공개적으로 제공합니다.