cdecl/asbHttp benchmarking and load test tool for windows, posix

- wg/wrk (Modern HTTP benchmarking tool)과 기능이 비슷한, Windows 버전으로 만들게 된 커맨드 라인 툴.

- boost::asio 와 asio 에서 지원하는 ssl(openssl)을 이용하여 구현.

- VC++ 2013 환경에서 개발하고, 라이브러리 패키지 NuGet으로 관리.

- Posix 환경은 g++ (4.8 이상, -std=c++11), boost 라이브러리 및 libssl-dev (openssl) 패키지 설치  


# 테스트 결과 

- 테스트 환경 ; Laptop Intel i5(4세대), 4 Core, 8G RAM, Windows 8.1 64bit  

- 성능 좋은 결과가 나오기 위해서는 대체적으로 Core 1/2 개수의 Thread에, Core 10배수 정도의 Connection이 무난해 보임 (로컬 환경에서 테스트 할때)

성능 좋은 결과가 나오기 위해서는 대체적으로 Core 개수의 Thread에, Core 20배수 정도의 Connection이 무난해 보임

asb -d 10 -t 2 -c 40 http://localhost/index.html

> Start and Running 10s (2015-03-18.17:36:10)

  http://localhost/index.html

    40 connections and 2 Threads

> Duration         : 10000ms

    Latency        : 0.02ms

    Requests       : 426149

    Response       : 426109

    Transfer       : 147.11MB

> Per seconds

    Requests/sec   : 42610.90

    Transfer/sec   : 14.71MB

> Response Status

    HTTP/1.1 200   : 426109


# Windows 에서 최대 Connection 만들기 

- OS의 소켓 최대 포트 번호를 늘림 (초기값 : 1500, 변경: 50000)

   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters 의 MaxUserPort 값 변경  

https://support.microsoft.com/ko-kr/kb/196271?wa=wsignin1.0

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

편집 메뉴에서 새로 만들기를 클릭하고 다음 레지스트리 항목을 추가합니다.

값 이름: MaxUserPort

값 형식: DWORD

값 데이터: 65534

유효 범위: 5000-65534(십진수)

기본값: 0x1388(십진수 5000)

설명: 이 매개 변수는 프로그램이 시스템에서 사용 가능한 사용자 포트를 요청할 때 사용되는 최대 포트 번호를 제어합니다. 일반적으로 수명이 짧은 임시(ephemeral) 포트에는 1024에서 5000 사이의 값이 할당됩니다. 보안 공지 MS08-037 릴리스 후 Windows Server 2003의 동작이 Windows Server 2008 및 Windows Vista의 동작과 보다 근접하게 일치하도록 변경되었습니다. Microsoft 보안 공지 MS08-037에 대한 자세한 내용은 다음 문서 번호를 클릭하여 Microsoft 기술 자료 문서를 참조하십시오.

- IIS의 응용프로그램의 큐 길이를 늘림 (초기값 : 1000, 변경: 3000), Worker Thread 개수 늘림 (초기값: 1, 변경: 2)

- IIS의 경우, 경로를 http://localhost/ 이렇게 줘서 Default 파일을 찾는 과정이 생각보다 느림 (20% 성능)

- 현재 조건(랩탑)에서는 최대 26,000 연결 정도 까지 가능하고 27,000 연결 이상 테스트 하면 문제가 발생함 (리소스가 부족한 것으로 추측)

- http://sockettools.com/kb/maximum-socket-connections/

asb -d 20 -t 3 -c 26000 http://localhost/index.html
> Start and Running 20s (2015-03-18.18:14:41)
  http://localhost/index.html
    26000 connections and 3 Threads
> Duration         : 20038ms
    Latency        : 0.09ms
    Requests       : 239424
    Response       : 213426
    Transfer       : 76.26MB
> Per seconds
    Requests/sec   : 10671.30
    Transfer/sec   : 3.81MB
> Response Status
    HTTP/1.1 200   : 213426




# Ubuntu 에서 최대 Connection 만들기 
- 테스트 환경 : Ubuntu 14.04 on hyper-v , (4 core, 1G RAM)
- 현재 상태 확인 : ulimit -a       
- OS의 소켓(파일) 개수를 늘려 줌 (/etc/security/limits.conf 파일 수정)
# 추가 
*               soft    nofile            65535
*               hard    nofile            65535
*               soft    nproc            65535
*               hard    nproc            65535
 
- nginx 설정 수정 
# nginx.conf 
worker_processes auto;
worker_rlimit_nofile 100000;
 
events {
    # worker_connections 1024;
    # 1024 x 16 
    worker_connections 16384;
    use epoll;
    multi_accept on;
}

# sites-available/default
# 모니터링용 페이지 노출 
location /nginx_status {
# Turn on stats
stub_status on;
access_log   off;
# only allow access from 192.168.1.5 #
# all
allow all;
}

- 클라이언트의 운영방식 인지, 서버의 운영방식 때문인지는 모르겠지만 4000 이상은 안올라 가는 것 같음 ( wrk 도 비슷한 결과 )
- 가상머신 임에도 불구하고, 30,000 연결 까지는 가능한 듯 (nginx 작업 프로세스 수 변경). 물론 처리량은 형편없이 떨어지지만.. 
- 이론상 서버 연결 가능한 수 :  worker_connections x worker_processes = 16384 x 4 = 65536
asb$ asb -d 20 -t 3 -c 30000 http://localhost/index.html
> Start and Running 20s (2015-03-18.14:50:05)
  http://localhost/index.html
    30000 connections and 3 Threads
> Duration         : 68805ms
    Latency        : 2.49ms
    Requests       : 56867
    Response       : 27585
    Transfer       : 28.10MB
> Per seconds
    Requests/sec   : 1379.25
    Transfer/sec   : 1.40MB
> Response Status
    HTTP/1.1 200   : 27585



# http://localhost/nginx_status 
Active connections: 30002 
server accepts handled requests
 30010 30010 36553 
Reading: 0 Writing: 1 Waiting: 30001 


+ Recent posts