File: benchmarks.rst

package info (click to toggle)
redis-py-cluster 1.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 592 kB
  • ctags: 781
  • sloc: python: 4,608; ruby: 1,045; makefile: 542
file content (67 lines) | stat: -rw-r--r-- 3,121 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Benchmarks
==========

There is a few benchmarks that is designed to test specific parts of the code that will show how big of a performance difference there is between using this lib and the normal Redis client.



Setup benchmarks
----------------

Before running any benchmark you should install this lib in editable mode inside a virtualenv so it can import `StrictRedisCluster` lib.

Install with

.. code-block:: bash
    
    pip install -e .

You also need a few redis servers to test against. It is required to have 1 cluster with atleast one node on port `7001` and it also required to have a non-clustered server on port `7007`.



Implemented Bencmarks
---------------------

- `simple.py`, This benchmark can be used to messure a simple `set` and `get` operation chain. It also support running pipelines bu adding the flag `--pipeline`



Run predefined benchmarks
-------------------------

There is a set of predefined benchmarks that can be runned to messure performance drop from using this library.

To run the benchmarks run

.. code-block:: bash

    make benchmark

Example output and comparison of different runmodes

.. code-block::

     -- Running Simple benchmark with StrictRedis lib and non cluster server --
    python benchmarks/simple.py --port 7007 --timeit --nocluster
    10.0k SET/GET operations took: 0.9711470603942871 seconds... 10297.10165208139 operations per second
    20.0k SET/GET operations took: 1.9136295318603516 seconds... 10451.343725113202 operations per second
    40.0k SET/GET operations took: 3.8409764766693115 seconds... 10414.018477584079 operations per second

     -- Running Simple benchmark with StrictRedisCluster lib and cluster server --
    python benchmarks/simple.py --port 7001 --timeit
    10.0k SET/GET operations took: 0.760077714920044 seconds... 13156.549394494412 operations per second
    20.0k SET/GET operations took: 1.5251967906951904 seconds... 13113.061948474155 operations per second
    40.0k SET/GET operations took: 3.05112361907959 seconds... 13109.924406165655 operations per second

     -- Running Simple benchmark with pipelines & StrictRedis lib and non cluster server --
    python benchmarks/simple.py --port 7007 --timeit --pipeline --nocluster
    10.0k SET/GET operations inside pipelines took: 0.8831894397735596 seconds... 11322.599149921782 operations per second
    20.0k SET/GET operations inside pipelines took: 1.6283915042877197 seconds... 12282.058674058404 operations per second
    40.0k SET/GET operations inside pipelines took: 3.2882907390594482 seconds... 12164.374495498905 operations per second

     -- Running Simple benchmark with StrictRedisCluster lib and cluster server
    python benchmarks/simple.py --port 7001 --timeit --pipeline
    10.0k SET/GET operations inside pipelines took: 0.709221601486206 seconds... 14099.965340937933 operations per second
    20.0k SET/GET operations inside pipelines took: 1.3776116371154785 seconds... 14517.879684783395 operations per second
    40.0k SET/GET operations inside pipelines took: 2.794893980026245 seconds... 14311.813001087214 operations per second