Experimental analysis of experimental data experimental results
1 Experimental data
Redis takes a tool called Redis-benchmark to simulate N clients and send m requests at the same time. The experiment was carried out as the following comparison test:
(1) in the quiet mode and the explicit use of the command to run the comparison;
(2) Contrast in single key and random key mode;
(3) Compare the default 50 clients, 100 clients and 10 clients;
(4) In order to execute the command and a one-time execution of multiple commands to compare.
Experimental hardware conditions: Under the virtual machine, 2 processors, 5GB memory, 20G hard drive.
The
Tests the following commands:
(1) ping_inline
(2) Ping_bulk
(3) Set: Associating string value values to key;
(4) Get: Returns the string value associated with the key, if the value of the key store is not A string type that returns an error;
(5) INCR: Adds a numeric value stored in a key. Error cannot be converted to a number;
(6) Lpush: Inserts one or more value values into the table header of the list key;
(7) Rpush: Inserts one or more value values into the footer of the list key;
(8) Lpop: Removes and returns the header element of the list key;
(9) Rpop: Removes and returns the end element of the list key;
Sadd: Adds one or more member elements to the collection set, and the membership element that already exists in the collection is ignored;
(one) Spop: Removes and returns a random element in the collection;
(a) Lpush: Inserts one or more value into the table header of the list key;
lrange_100: Returns the elements in the specified interval in the list key, the first 100 elements;
(lrange_300): Returns the elements within the specified interval in the list key, the first 300 elements,
lrange_500: Returns the elements within the specified interval in the list key, the first 500 elements;
Lrange_ 600: Returns the elements within the specified interval in the list key, the first 600 elements;
Mset: Sets one or more key-value pairs at the same time, value is a string. 2 Experimental Results
(1)./REDIS-BENCHMARK-Q-N 100000
runs in quiet mode and uses only a single key.
(2)./redis-benchmark-n 100000-q Script Load "redis.call (' Set ', ' foo ', ' Bar ')"
runs using direct commands.
(3)./redis-benchmark-r 100000-n 100000-q
runs in quiet mode and sets 100,000 random key.
(4) By default, each client sends the next request after one request completes, and benchmark simulates 50 clients by default, which means that the server reads the commands for each client almost sequentially.
./redis-benchmark-c 100-r 100000-n 100000-q
simulates 100 clients
./redis-benchmark-c 10-r 100000-n 100000 -Q
Impersonate 10 clients
(5) Redis supports/topics/pipelining, making it possible to execute more than one command at a one-time. Redis pipelining can improve the server's TPS. Test for
./redis-benchmark-r 100000-n 100000-p 16–q
pipelining 16 commands.
3 Experimental Analysis
The
focuses on comparing the performance of the set/get/incr/lpush/lpop/sadd/spop/lrange_100 commands.
Scenario number means
1: Single key,50 client, 2: Random key,50 client, 3: Random key,100 Client, 4: Random key,10 Client, 5: Random key,50 client, concurrent execution.
Note: The number of requests per second for all data in the table.
from the table above you can see:
(1) for the same client, the number of requests per second for random keys, set and Lpop are reduced, and get, INCR, Lpush, Sadd, Spop, and Lrange are incremented;
(2) When a key value is randomly generated, the SET and sadd operations decrease with the number of clients, and the number of requests per second decreases, taking into account Cache hits, other commands have no regularity;
(3) Other conditions are consistent, and in concurrent execution, various commands are significantly increased.
It can be concluded from above that in a real environment, large data and concurrency can be achieved by increasing the cache size and concurrent execution to increase throughput.