Running only a subset of the tests
|
<div class="text"> How fast is Redis?Redis includes the The following options are supported:
You need to have a running Redis instance before launching the benchmark. A typical example would be:
Using this tool is quite easy,and you can also write your own benchmark,but as with any benchmarking activity,there are some pitfalls to avoid. Running only a subset of the testsYou don't need to run all the default tests every time you execute redis-benchmark. The simplest thing to select only a subset of tests is to use the
In the above example we asked to just run test the SET and LPUSH commands,in quite mode (see the It is also possible to specify the command to benchmark directly like in the following example:
Selecting the size of the key spaceBy default the benchmark runs against a single key. In Redis the difference between such a synthetic benchmark and a real one is not huge since it is an in memory system,however it is possible to stress cache misses and in general to simulate a more real-world work load by using a large key space. This is obtained by using the
Using pipeliningBy default every client (the benchmark simulates 50 clients if not otherwise specified with Redis supports ,so it is possible to send multiple commands at once,a feature often exploited by real world applications. Redis pipelining is able to dramatically improve the number of operations per second a server is able do deliver. This is an example of running the benchmark in a Macbook air 11" using a pipeling of 16 commands:
Using pipelining resulted into a sensible amount of more commands processed. Pitfalls and misconceptionsThe first point is obvious: the golden rule of a useful benchmark is to only compare apples and apples. Different versions of Redis can be compared on the same workload for instance. Or the same version of Redis,but with different options. If you plan to compare Redis to something else,then it is important to evaluate the functional and technical differences,and take them in account.
A common misconception is that redis-benchmark is designed to make Redis performances look stellar,the throughput achieved by redis-benchmark being somewhat artificial,and not achievable by a real application. This is actually plain wrong. The redis-benchmark program is a quick and useful way to get some figures and evaluate the performance of a Redis instance on a given hardware. However,by default,it does not represent the maximum throughput a Redis instance can sustain. Actually,by using pipelining and a fast client (hiredis),it is fairly easy to write a program generating more throughput than redis-benchmark. The default behavior of redis-benchmark is to achieve throughput by exploiting concurrency only (i.e. it creates several connections to the server). It does not use pipelining or any parallelism at all (one pending query per connection at most,and no multi-threading). To run a benchmark using pipelining mode (and achieve higher throughputs),you need to explicitly use the -P option. Please note that it is still a realistic behavior since a lot of Redis based applications actively use pipelining to improve performance. Finally,the benchmark should apply the same operations,and work in the same way with the multiple data stores you want to compare. It is absolutely pointless to compare the result of redis-benchmark to the result of another benchmark program and extrapolate. For instance,Redis and memcached in single-threaded mode can be compared on GET/SET operations. Both are in-memory data stores,working mostly in the same way at the protocol level. Provided their respective benchmark application is aggregating queries in the same way (pipelining) and use a similar number of connections,the comparison is actually meaningful. This perfect example is illustrated by the dialog between Redis (antirez) and memcached (dormando) developers. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
