반응형
    
    
    
  Sysbench 설치 및 사용 방법
Sysbench를 설치하고 사용하는 방법에 대한 간단한 가이드입니다.
1. Sysbench 설치
sudo apt-get update
sudo apt-get install sysbench
sysbench 주요 옵션 설명
- --threads=<num>:
- 설명: 동시에 실행될 스레드 수를 지정합니다.
 - 예시: --threads=4
 
 - --time=<time>:
- 설명: 테스트를 실행할 시간(초)을 지정합니다.
 - 예시: --time=60
 
 - --report-interval=<interval>:
- 설명: 테스트 결과 보고서를 표시하는 간격을 지정합니다.
 - 예시: --report-interval=10
 
 - --events=<num>:
- 설명: 이벤트 수를 지정하여 특정 작업을 반복 실행합니다.
 - 예시: --events=100000
 
 - --threads=<num>:
- 설명: 동시에 실행될 스레드 수를 지정합니다.
 - 예시: --threads=4
 
 - --mysql-host=<host>:
- 설명: MySQL 호스트 주소를 지정합니다.
 - 예시: --mysql-host=localhost
 
 - --mysql-port=<port>:
- 설명: MySQL 포트 번호를 지정합니다.
 - 예시: --mysql-port=3306
 
 - --mysql-user=<user>:
- 설명: MySQL 사용자 이름을 지정합니다.
 - 예시: --mysql-user=root
 
 - --mysql-password=<password>:
- 설명: MySQL 사용자 비밀번호를 지정합니다.
 - 예시: --mysql-password=your_password
 
 - --mysql-db=<database>:
- 설명: 사용할 MySQL 데이터베이스 이름을 지정합니다.
 - 예시: --mysql-db=sysbench
 
 - --table-size=<size>:
- 설명: 테이블의 크기를 지정합니다.
 - 예시: --table-size=10000
 
 - --tables=<num>:
- 설명: 생성할 테이블 수를 지정합니다.
 - 예시: --tables=10
 
 - --file-total-size=<size>:
- 설명: 파일 I/O 벤치마크에서 사용할 총 파일 크기를 지정합니다.
 - 예시: --file-total-size=1G
 
 - --file-test-mode=<mode>:
- 설명: 파일 I/O 벤치마크에 사용할 테스트 모드를 지정합니다.
 - 예시: --file-test-mode=rndrw
 
 
sysbench --help
더보기
sysbench help
Usage:
  sysbench [options]... [testname] [command]
Commands implemented by most tests: prepare run cleanup help
General options:
  --threads=N                     number of threads to use [1]
  --events=N                      limit for total number of events [0]
  --time=N                        limit for total execution time in seconds [10]
  --forced-shutdown=STRING        number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]
  --thread-stack-size=SIZE        size of stack per thread [64K]
  --rate=N                        average transactions rate. 0 for unlimited rate [0]
  --report-interval=N             periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
  --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
  --debug[=on|off]                print more debugging info [off]
  --validate[=on|off]             perform validation checks where possible [off]
  --help[=on|off]                 print help and exit [off]
  --version[=on|off]              print version and exit [off]
  --config-file=FILENAME          File containing command line options
  --tx-rate=N                     deprecated alias for --rate [0]
  --max-requests=N                deprecated alias for --events [0]
  --max-time=N                    deprecated alias for --time [0]
  --num-threads=N                 deprecated alias for --threads [1]
Pseudo-Random Numbers Generator options:
  --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special]
  --rand-spec-iter=N number of iterations used for numbers generation [12]
  --rand-spec-pct=N  percentage of values to be treated as 'special' (for special distribution) [1]
  --rand-spec-res=N  percentage of 'special' values to use (for special distribution) [75]
  --rand-seed=N      seed for random number generator. When 0, the current time is used as a RNG seed. [0]
  --rand-pareto-h=N  parameter h for pareto distribution [0.2]
Log options:
  --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]
  --percentile=N       percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
  --histogram[=on|off] print latency histogram in report [off]
General database options:
  --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers)
  --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
  --db-debug[=on|off] print database-specific debug information [off]
Compiled-in database drivers:
  mysql - MySQL driver
  pgsql - PostgreSQL driver
mysql options:
  --mysql-host=[LIST,...]          MySQL server host [localhost]
  --mysql-port=[LIST,...]          MySQL server port [3306]
  --mysql-socket=[LIST,...]        MySQL socket
  --mysql-user=STRING              MySQL user [sbtest]
  --mysql-password=STRING          MySQL password []
  --mysql-db=STRING                MySQL database name [sbtest]
  --mysql-ssl[=on|off]             use SSL connections, if available in the client library [off]
  --mysql-ssl-cipher=STRING        use specific cipher for SSL connections []
  --mysql-compression[=on|off]     use compression, if available in the client library [off]
  --mysql-debug[=on|off]           trace all client library calls [off]
  --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]
  --mysql-dry-run[=on|off]         Dry run, pretend that all MySQL client API calls are successful without executing them [off]
pgsql options:
  --pgsql-host=STRING     PostgreSQL server host [localhost]
  --pgsql-port=N          PostgreSQL server port [5432]
  --pgsql-user=STRING     PostgreSQL user [sbtest]
  --pgsql-password=STRING PostgreSQL password []
  --pgsql-db=STRING       PostgreSQL database name [sbtest]
Compiled-in tests:
  fileio - File I/O test
  cpu - CPU performance test
  memory - Memory functions speed test
  threads - Threads subsystem performance test
  mutex - Mutex performance test
See 'sysbench <testname> help' for a list of options for each test.
sysbench cpu
$ sysbench cpu help
sysbench 1.0.9 (using system LuaJIT 2.0.4)
cpu options:
  --cpu-max-prime=N upper limit for primes generator [10000]
sysbench memory
$ sysbench memory help
sysbench 1.0.9 (using system LuaJIT 2.0.4)
memory options:
  --memory-block-size=SIZE    size of memory block for test [1K]
  --memory-total-size=SIZE    total size of data to transfer [100G]
  --memory-scope=STRING       memory access scope {global,local} [global]
  --memory-hugetlb[=on|off]   allocate memory from HugeTLB pool [off]
  --memory-oper=STRING        type of memory operations {read, write, none} [write]
  --memory-access-mode=STRING memory access mode {seq,rnd} [seq]
sysbench fileio
$ sysbench fileio help
sysbench 1.0.9 (using system LuaJIT 2.0.4)
fileio options:
  --file-num=N              number of files to create [128]
  --file-block-size=N       block size to use in all IO operations [16384]
  --file-total-size=SIZE    total size of files to create [2G]
  --file-test-mode=STRING   test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}
  --file-io-mode=STRING     file operations mode {sync,async,mmap} [sync]
  --file-async-backlog=N    number of asynchronous operatons to queue per thread [128]
  --file-extra-flags=STRING additional flags to use on opening files {sync,dsync,direct} []
  --file-fsync-freq=N       do fsync() after this number of requests (0 - don't use fsync()) [100]
  --file-fsync-all[=on|off] do fsync() after each write operation [off]
  --file-fsync-end[=on|off] do fsync() at the end of test [on]
  --file-fsync-mode=STRING  which method to use for synchronization {fsync, fdatasync} [fsync]
  --file-merged-requests=N  merge at most this number of IO requests if possible (0 - don't merge) [0]
  --file-rw-ratio=N         reads/writes ratio for combined test [1.5]
2. Sysbench 성능 테스트 실행
- CPU 벤치마크
 
sysbench cpu --threads=2 run
- 메모리 벤치마크
 
sysbench memory --threads=2 run
- 파일 I/O 벤치마크
 
sysbench fileio --threads=2 --file-total-size=1G prepare
sysbench fileio --threads=2 --file-total-size=1G --file-test-mode=rndrw run
sysbench fileio --threads=2 cleanup
- MySQL 벤치마크
 
sysbench oltp_common.lua --db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=your_password --mysql-db=sysbench --table-size=10000 --tables=10 --threads=10 prepare
sysbench oltp_common.lua --db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=your_password --mysql-db=sysbench --table-size=10000 --tables=10 --threads=10 --time=60 --report-interval=10 run
sysbench oltp_common.lua --db-driver=mysql --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=your_password --mysql-db=sysbench --table-size=10000 --tables=10 --threads=10 cleanup
위의 명령어에서 필요한 옵션과 벤치마크 유형을 선택하여 실행할 수 있습니다. 필요에 따라 옵션을 조정하여 원하는 벤치마크를 수행할 수 있습니다.
이제 Sysbench를 사용하여 다양한 리눅스 시스템의 성능을 테스트하고 결과를 분석할 수 있습니다. 자세한 옵션 및 활용 사례에 대해서는 Sysbench의 공식 문서를 참조하시기 바랍니다.
728x90
    
    
  반응형
    
    
    
  '리눅스' 카테고리의 다른 글
| 킥스타트 기반 PXE 자동 설치 환경 구축하는 방법 (0) | 2018.05.17 | 
|---|---|
| GRUB VGA Modes (0) | 2018.05.09 | 
| CentOS 7에서 GRUB2 부팅 순서 변경 방법 (0) | 2018.01.22 | 
| CentOS 5에 Salt Minion 설치 방법 (0) | 2018.01.09 | 
| [리눅스] KVM Virsh Console Access On CentOS 6 (0) | 2017.12.06 |