mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Created templates and util functions for benchmark testing.
This commit is contained in:
parent
5c26bb439a
commit
1d4eddf635
26
benchmarking-tests/benchmark_utils.py
Normal file
26
benchmarking-tests/benchmark_utils.py
Normal file
@ -0,0 +1,26 @@
|
||||
import sys
|
||||
import multiprocessing as mp
|
||||
import uuid
|
||||
from bigchaindb import Bigchain
|
||||
from bigchaindb.util import ProcessGroup
|
||||
|
||||
|
||||
def create_write_transaction(tx_left):
|
||||
b = Bigchain()
|
||||
while tx_left > 0:
|
||||
# use uuid to prevent duplicate transactions (transactions with the same hash)
|
||||
tx = b.create_transaction(b.me, b.me, None, 'CREATE', payload={'msg': str(uuid.uuid4())})
|
||||
tx_signed = b.sign_transaction(tx, b.me_private)
|
||||
b.write_transaction(tx_signed)
|
||||
tx_left -= 1
|
||||
|
||||
|
||||
def add_to_backlog(num_transactions=10000):
|
||||
tx_left = num_transactions // mp.cpu_count()
|
||||
workers = ProcessGroup(target=create_write_transaction, args=(tx_left,))
|
||||
workers.start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
add_to_backlog(int(sys.argv[1]))
|
||||
|
39
benchmarking-tests/fabfile.py
vendored
Normal file
39
benchmarking-tests/fabfile.py
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
from __future__ import with_statement, unicode_literals
|
||||
|
||||
from fabric.api import sudo, env, hosts
|
||||
from fabric.api import task, parallel
|
||||
from fabric.contrib.files import sed
|
||||
from fabric.operations import run, put
|
||||
from fabric.context_managers import settings
|
||||
|
||||
from hostlist import public_dns_names
|
||||
|
||||
# Ignore known_hosts
|
||||
# http://docs.fabfile.org/en/1.10/usage/env.html#disable-known-hosts
|
||||
env.disable_known_hosts = True
|
||||
|
||||
# What remote servers should Fabric connect to? With what usernames?
|
||||
env.user = 'ubuntu'
|
||||
env.hosts = public_dns_names
|
||||
|
||||
# SSH key files to try when connecting:
|
||||
# http://docs.fabfile.org/en/1.10/usage/env.html#key-filename
|
||||
env.key_filename = 'pem/bigchaindb.pem'
|
||||
|
||||
|
||||
@task
|
||||
@parallel
|
||||
def prepare_test():
|
||||
put('benchmark_utils.py')
|
||||
|
||||
|
||||
@task
|
||||
@parallel
|
||||
def prepare_backlog(num_transactions=10000):
|
||||
run('python3 benchmark_utils.py {}'.format(num_transactions))
|
||||
|
||||
|
||||
@task
|
||||
@parallel
|
||||
def start_bigchaindb():
|
||||
run('screen -d -m bigchaindb start &', pty=False)
|
8
benchmarking-tests/hostlist.py
Normal file
8
benchmarking-tests/hostlist.py
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""A list of the public DNS names of all the nodes in this
|
||||
BigchainDB cluster/federation.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
public_dns_names = ['ec2-52-58-162-146.eu-central-1.compute.amazonaws.com', 'ec2-52-58-15-239.eu-central-1.compute.amazonaws.com', 'ec2-52-58-160-205.eu-central-1.compute.amazonaws.com']
|
11
benchmarking-tests/test1/README.md
Normal file
11
benchmarking-tests/test1/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Transactions per second
|
||||
|
||||
Measure how many blocks per second are created on the _bigchain_ with a pre filled backlog.
|
||||
|
||||
1. Deploy an aws cluster http://bigchaindb.readthedocs.io/en/latest/deploy-on-aws.html
|
||||
2. Copy `deploy-cluster-aws/hostlist.py` to `benchmarking-tests`
|
||||
|
||||
```bash
|
||||
fab prepare_test
|
||||
fab prepare_backlog:<num txs per node> # wait for process to finish
|
||||
fab start_bigchaindb
|
Loading…
x
Reference in New Issue
Block a user