Why does running the same query on Redis sequentially give faster and faster results?

I do not believe redis caches command results, right? If so, why should I see the following on my redis server for the same request. For reference, this redis runs in a virtual machine. I checked the smaps file, as described in http://redis.io/topics/latency , and I donโ€™t see an OS-level exchange (all 0kb in the Swap for the process), but is it possible to run redis in the memory of the VM pages on the disk and vice versa? Or ... are these results expected due to some redis optimizations for normal run commands?

redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (4.46s) redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (3.77s) redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (0.92s) redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (0.64s) redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (0.67s) redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (0.73s) redis 127.0.0.1:6379[4]> scard ClientId:1637 (integer) 796529 redis 127.0.0.1:6379[4]> scard PublisherId:1 (integer) 311092 redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (1.88s) redis 127.0.0.1:6379[4]> sinterstore testdb ClientId:1637 PublisherId:1 (integer) 240001 (0.69s) 
+4
source share
1 answer

CPU caching! A very interesting, more accessible reading here (among other places)

0
source

Source: https://habr.com/ru/post/1438988/


All Articles