segunda-feira, 6 de maio de 2013

O benchmarking :: MySQL, CPU, arquivo I / O, memória :: Sysbench & Apache referência

Original post: http://anothermysqldba.blogspot.com/2013/05/benchmarking-mysql-cpu-file-io-memory.html


Decidir qual ferramenta você gostaria de usar:
Vou usar Sysbench para este exemplo:
Primeiro de download sysbench
Instale:
Manual SysBench
Rever as suas opções:
# Sysbench - test = ajuda OLTP

Compilado em testes:
FileIO - arquivo de teste I / O
cpu - teste de desempenho de CPU
Memória - Memória teste de funções
Tópicos - Threads teste de desempenho do subsistema
mutex - teste de desempenho Mutex
OLTP - OLTP teste

Comandos: preparar executar a limpeza de versão ajuda

Alguns exemplos abaixo:

FileIO - arquivo de teste I / O
# sysbench --test=fileio help 
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,fastmmap,slowmmap} [sync]
--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] 

  • # Sysbench - test = FileIO prepare
  • # Sysbench - test = FileIO - teste-mode file = rndwr prazo


cpu - teste de desempenho de CPU
# Sysbench - test = ajuda cpu
opções de CPU:
- Cpu-max-prime = N limite superior para o gerador de números primos [10000] 


  • # Sysbench - test = cpu - núme-threads = 25 prazo


Memória - Memória teste de funções
# sysbench --test=memory help 
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 - test = memória <memory options> prazo

Tópicos - Threads teste de desempenho do subsistema
# sysbench --test=threads help   
threads options:
--thread-yields=N number of yields to do per request [1000]
--thread-locks=N number of locks per thread [8] 

  • # # Sysbench - teste = tópicos - núme-threads = 64 - teste = tópicos - thread-yields = 100 - thread-locks = 6 run


mutex - teste de desempenho Mutex
# sysbench --test=mutex help   
mutex options:
--mutex-num=N total size of mutex array [4096]
--mutex-locks=N number of mutex locks to do per thread [50000]
--mutex-loops=N number of empty loops to do inside mutex lock [10000] 
  • # Sysbench - test = mutex - núme-threads = 64 prazo




OLTP - OLTP teste
# sysbench --test=oltp help
oltp options:
--oltp-test-mode=STRING test type to use {simple,complex,nontrx,sp} [complex]
--oltp-reconnect-mode=STRING reconnect mode {session,transaction,query,random} [session]
--oltp-sp-name=STRING name of store procedure to call in SP test mode []
--oltp-read-only=[on|off] generate only 'read' queries (do not modify database) [off]
--oltp-skip-trx=[on|off] skip BEGIN/COMMIT statements [off]
--oltp-range-size=N range size for range queries [100]
--oltp-point-selects=N number of point selects [10]
--oltp-simple-ranges=N number of simple ranges [1]
--oltp-sum-ranges=N number of sum ranges [1]
--oltp-order-ranges=N number of ordered ranges [1]
--oltp-distinct-ranges=N number of distinct ranges [1]
--oltp-index-updates=N number of index update [1]
--oltp-non-index-updates=N number of non-index updates [1]
--oltp-nontrx-mode=STRING mode for non-transactional test {select, update_key, update_nokey, insert, delete} [select]
--oltp-auto-inc=[on|off] whether AUTO_INCREMENT (or equivalent) should be used on id column [on]
--oltp-connect-delay=N time in microseconds to sleep after connection to database [10000]
--oltp-user-delay-min=N minimum time in microseconds to sleep after each request [0]
--oltp-user-delay-max=N maximum time in microseconds to sleep after each request [0]
--oltp-table-name=STRING name of test table [sbtest]
--oltp-table-size=N number of records in test table [10000]
--oltp-dist-type=STRING random numbers distribution {uniform,gaussian,special} [special]
--oltp-dist-iter=N number of iterations used for numbers generation [12]
--oltp-dist-pct=N percentage of values to be treated as 'special' (for special distribution) [1]
--oltp-dist-res=N percentage of 'special' values to use (for special distribution) [75]

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]


Compiled-in database drivers:
mysql - MySQL driver

mysql options:
--mysql-host=[LIST,...] MySQL server host [localhost]
--mysql-port=N MySQL server port [3306]
--mysql-socket=STRING MySQL socket
--mysql-user=STRING MySQL user [sbtest]
--mysql-password=STRING MySQL password []
--mysql-db=STRING MySQL database name [sbtest]
--mysql-table-engine=STRING storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb]
--mysql-engine-trx=STRING whether storage engine used is transactional or not {yes,no,auto} [auto]
--mysql-ssl=[on|off] use SSL connections, if available in the client library [off]
--myisam-max-rows=N max-rows parameter for MyISAM tables [1000000]
--mysql-create-options=STRING additional options passed to CREATE TABLE [] 

sysbench espera encontrar o banco de dados sbtest isso certifique-se e criar o primeiro banco de dados ou definir o que você preferir.
  • sysbench - test = OLTP ajuda | grep sbtest
    - OLTP-table-name = STRING nome da tabela de teste [sbtest]
    - Mysql-user = STRING MySQL user [sbtest]
    - Mysql-db = STRING nome do banco de dados MySQL [sbtest]

# Sysbench - test = OLTP - mysql-host = localhost - mysql-user = root - mysql-password = <senha here> - mysql-table-engine = innodb prepare

# Sysbench - test = OLTP - mysql-host = localhost - mysql-user = root - mysql-password = <senha here> - mysql-table-engine = innodb - núme-threads = 25 prazo

Em seguida, manter um olho em seus resultados, bem como banco de dados, os testes executados.



Apache Referência & | |
WWW :: Mechanize :: Firefox

A chave tirar aqui é usar essas ferramentas para comparar o seu processo de candidatura e não apenas um único fator da arquitetura.

Por exemplo, se você espera ter 20 mil usuários por hora de preencher o formulário web, então você deve fazer benchmarks de sua aplicação para lidar com isso. Você pode usar as ferramentas acima para imitar as mensagens, para apenas um exemplo, passando fichas, e depois testar o código que está em vigor na sua aplicação. Um teste como este, em seguida, irá testar a base de código e com o registro adequado no lugar (que você também pode ligar por um símbolo), você pode testar o quão bem os desenvolvedores, DBA e do sistema é construído.

Exemplo muito simples do conceito:

Se você pode abrir a url com elinks você pode avaliar isso.

elinks http://www.google.com/search?ie=ISO-8859-1\&hl=en\&source=hp\&q=mysql

# ab -n 10 -c 2 http://www.google.com/search?ie=ISO-8859-1\&hl=en\&source=hp\&q=mysql 

Claro que você deve executar este contra seu sistema em um nível muito mais elevado para testar como seu aplicativo responde.