bproxy
v0.10.0
BPROXY는 C에서 작성된 가벼운 초고속 최소 구성 프록시 서버입니다.
gzip
압축 및SSL
지원합니다.
WRK를 사용하여 Golang 웹 서버에서 간단한 Whoami 앱을 테스트했습니다. 테스트는 2016 년 말 MacBook Pro에서 다음 명령을 사용하여 16GB 메모리로 수행되었습니다.
nginx
$ wrk -t20 -c1000 -d10s http://whoami.home.local.net
Running 10s test @ http://whoami.home.local.net
20 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 95.03ms 55.24ms 594.79ms 85.69%
Req/Sec 78.38 47.01 230.00 65.43%
7786 requests in 10.06s, 2.85MB read
Socket errors: connect 0, read 872, write 0, timeout 92
Non-2xx or 3xx responses: 52
Requests/sec: 774.08
Transfer/sec: 290.10KB
bproxy
$ wrk -t20 -c1000 -d10s http://whoami.home.local.net
Running 10s test @ http://whoami.home.local.net
20 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 274.84ms 117.52ms 1.05s 71.95%
Req/Sec 97.55 55.21 515.00 71.70%
19292 requests in 10.10s, 6.66MB read
Socket errors: connect 0, read 970, write 0, timeout 0
Requests/sec: 1910.05
Transfer/sec: 675.23KB
결과는 nginx
50% 이상의 대기 시간으로 요청을 처리하는 반면 bproxy
같은 기간에 두 배 이상의 요청을 처리합니다.
이것이 유망한 소리가 들리면 서버에서 자유롭게 사용 하고이 프로젝트를 더욱 개선하도록 도와주십시오!
이 단계에서는 시스템에 Node.js가 설치되어 있다고 가정합니다.
종속성을 설치하십시오.
$ npm install --prod
빌드를 실행하십시오.
$ npm run build
빌드 아티팩트는 out/Release/
디렉토리에 저장됩니다.
스크립트는 /usr/local/bin
에 bproxy
설치합니다.
$ sudo make install
$ ./bproxy
또는
$ ./bproxy -c /path/to/bproxy-config.json
{
"port" : 80 ,
"secure_port" : 443 ,
"gzip_mime_types" : [ " text/css " , " application/javascript " , " application/x-javascript " ],
"log_file" : " bproxy.log " ,
"templates" : {
"status_400_template" : " " ,
"status_404_template" : " templates/404.html " ,
"status_502_template" : " "
},
"proxies" : [
{
"hosts" : [
" bleenco.io " ,
" www.bleenco.io "
],
"certificate_path" : " certs/bleenco.io.crt " ,
"key_path" : " certs/bleenco.io.key " ,
"ip" : " 127.0.0.1 " ,
"port" : 7500 ,
"force_ssl" : true
},
{
"hosts" : [ " *.bleenco.io " ],
"ip" : " 127.0.0.1 " ,
"port" : 4550 ,
"ssl_passthrough" : true
}
]
}
force_ssl
속성을 사용하면 301 HTTP 상태로 응답하여 HTTP에서 HTTP로 리디렉션 할 수 있습니다.
ssl_passthrough
속성을 사용하면 SSL/TLS 서버를 프록시 할 수 있습니다. 즉, 데이터가 해독되거나 구문 분석되지는 않지만 서버로 전달되고 그 반대로 전달됩니다. 이를 통해 HTTP에서 HTTP로 리디렉션 할 수 있습니다.
$ make docker_image
Docker Hub에서 docker pull bleenco/bproxy
로 이미지를 가져 오거나 이전 섹션에서 언급 된대로 소스에서 빌드 할 수 있습니다.
그런 다음 서버에서 :
$ docker run -it --name bproxy --net host -v ~/path/to/bproxy.json:/bproxy/bproxy.json -v /var/log/bproxy.log:/var/log/bproxy.log --restart always bleenco/bproxy
$ npm install
$ npm test
The MIT License
Copyright (c) 2018 Bleenco GmbH http://bleenco.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.