Skip to content

Instantly share code, notes, and snippets.

@janx
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janx/11163252 to your computer and use it in GitHub Desktop.
Save janx/11163252 to your computer and use it in GitHub Desktop.
Integration benchmark

All below stuff run in PRODUCTION rails environment, make sure production settings in your database.yml points to a test database!!!

###Reset database

RAILS_ENV=production rake db:reset

###Start matching engine

# modify config/amqp.yml first if rabbitmq server is running on node other than 127.0.0.1
RAILS_ENV=production rake daemon:matching:start

###Start 10 (or any number) executors on each worker server

# modify config/amqp.yml first if rabbitmq server is running on node other than 127.0.0.1
TRADE_EXECUTOR=10 RAILS_ENV=production rake daemon:trade_executor:start

###Benchmark

# warm up matching engine and trade executors with 300 orders
NUM=300 RAILS_ENV=production rake benchmark:integration

# real benchmark begins here: 10000 (or any number) orders
NUM=10000 RAILS_ENV=production rake benchmark:integration

After the numbers in the bottom line stop changing, press ctrl-c to finish.

Example output:

NUM=10000 RAILS_ENV=production rake benchmark:integration
Integration Benchmark (num: 10000)
                           user     system      total        real
create members       111.690000   6.520000 118.210000 (287.434067)
lock funds             0.050000   0.010000   0.060000 (  0.172332)
create orders         23.660000   1.420000  25.080000 ( 33.404886)
Time elapsed: 11.730559158s   Orders: total 10000, rate 852.47o/s   Trades: total 5791, rate 493.67t/s

###MySQL optimizations

max_connections=256
query_cache_size=512M
innodb_buffer_pool_size=1024M
innodb_flush_log_at_trx_commit=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment