[RFC,24/24] python: benchmark new backup architecture
diff mbox series

Message ID 20191115141444.24155-25-vsementsov@virtuozzo.com
State New
Headers show
Series
  • backup performance: block_status + async
Related show

Commit Message

Vladimir Sementsov-Ogievskiy Nov. 15, 2019, 2:14 p.m. UTC
Benchmark test for the series. This patch is RFC, it would be strange
to commit it as is.. On the other hand I feel that we should commit
some example to show usage of simplebench and bench_block_job.

May be I should add some simple example to compare backup and mirror..
Any ideas?

Anyway, this patch is here to show, how I produced the table in the
series cover-letter.

Note that all used images are 1000M files filled by ones, including
images exported by two running NBD servers, and NBD servers are running
as:

qemu-nbd --persistent --nocache -p 10810 ones1000M-source
qemu-nbd --persistent --nocache -p 10809 ones1000M-target

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 python/bench-example.py | 93 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100755 python/bench-example.py

Patch
diff mbox series

diff --git a/python/bench-example.py b/python/bench-example.py
new file mode 100755
index 0000000000..fb4c61c968
--- /dev/null
+++ b/python/bench-example.py
@@ -0,0 +1,93 @@ 
+#!/usr/bin/env python3
+
+import simplebench
+from qemu.bench_block_job import bench_block_copy, drv_file, drv_nbd
+
+
+def bench_func(env, case):
+    return bench_block_copy(env['qemu_binary'], env['cmd'],
+                            case['source'], case['target'])
+
+
+test_cases = [
+    {
+        'id': 'ssd -> ssd',
+        'source': drv_file('/ssd/ones1000M-source'),
+        'target': drv_file('/ssd/ones1000M-target')
+    },
+    {
+        'id': 'ssd -> hdd',
+        'source': drv_file('/ssd/ones1000M-source'),
+        'target': drv_file('/test-a/ones1000M-target')
+    },
+    {
+        'id': 'hdd -> hdd',
+        'source': drv_file('/test-a/ones1000M-source'),
+        'target': drv_file('/test-a/ones1000M-target')
+    }
+]
+
+test_envs = [
+    {
+        'id': 'backup-old',
+        'cmd': 'blockdev-backup',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status--before/x86_64-softmmu/qemu-system-x86_64'
+    },
+    {
+        'id': 'backup-old(no CR)',
+        'cmd': 'blockdev-backup',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status--before--no-copy-range/x86_64-softmmu/qemu-system-x86_64'
+    },
+    {
+        'id': 'backup-new',
+        'cmd': 'blockdev-backup',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status/x86_64-softmmu/qemu-system-x86_64'
+    },
+    {
+        'id': 'backup-new(no CR)',
+        'cmd': 'blockdev-backup',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status--no-copy_range/x86_64-softmmu/qemu-system-x86_64'
+    },
+    {
+        'id': 'mirror',
+        'cmd': 'blockdev-mirror',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status/x86_64-softmmu/qemu-system-x86_64'
+    }
+]
+
+result = simplebench.bench(bench_func, test_envs, test_cases, count=3)
+print(simplebench.ascii(result))
+
+test_cases = [
+    {
+        'id': 'nbd -> ssd',
+        'source': drv_nbd('172.16.24.200', '10810'),
+        'target': drv_file('/ssd/ones1000M-target')
+    },
+    {
+        'id': 'ssd -> nbd',
+        'source': drv_file('/ssd/ones1000M-target'),
+        'target': drv_nbd('172.16.24.200', '10809')
+    },
+]
+
+test_envs = [
+    {
+        'id': 'backup-old',
+        'cmd': 'blockdev-backup',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status--before/x86_64-softmmu/qemu-system-x86_64'
+    },
+    {
+        'id': 'backup-new',
+        'cmd': 'blockdev-backup',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status/x86_64-softmmu/qemu-system-x86_64'
+    },
+    {
+        'id': 'mirror',
+        'cmd': 'blockdev-mirror',
+        'qemu_binary': '/work/src/qemu/up-block-copy-block-status/x86_64-softmmu/qemu-system-x86_64'
+    }
+]
+
+result = simplebench.bench(bench_func, test_envs, test_cases, count=2)
+print(simplebench.ascii(result))