title: Redis performance issues on docker
body: <p>I have ran the redis-benchmark against our old Redis instance running on Vmware, on Oracle Linux 7.</p>
  <pre><code>% ./src/redis-benchmark  -h myhost -p 6380 -a xxxxxx -t set,lpush,lrange -n 100000 -q
  SET: 80000.00 requests per second
  LPUSH: 101522.84 requests per second
  LPUSH (needed to benchmark LRANGE): 88495.58 requests per second
  LRANGE_100 (first 100 elements): 47505.94 requests per second
  LRANGE_300 (first 300 elements): 25361.40 requests per second
  LRANGE_500 (first 450 elements): 18964.54 requests per second
  LRANGE_600 (first 600 elements): 15234.61 requests per second
  
  </code></pre>
  <p>Running a much newer version of Redis (6.2.7) in Docker seems to be 3x slower.</p>
  <pre><code>$ redis-benchmark -t set,lpush,lrange -n 100000 -q
  SET: 33233.63 requests per second, p50=0.567 msec
  LPUSH: 54945.05 requests per second, p50=0.423 msec
  LPUSH (needed to benchmark LRANGE): 32010.24 requests per second, p50=0.879 msec
  LRANGE_100 (first 100 elements): 19383.60 requests per second, p50=1.175 msec
  LRANGE_300 (first 300 elements): 11511.45 requests per second, p50=2.039 msec
  LRANGE_500 (first 500 elements): 10525.21 requests per second, p50=2.215 msec
  LRANGE_600 (first 600 elements): 9231.05 requests per second, p50=2.519 msec
  </code></pre>
  <p>Im running the benchmark from within the container to omit the network latency and Docker NAT overhead.</p>
  <p>Here is my config. I tried 2 different versions. Same issue:</p>
  <pre><code>  redis-frs:
      image:  nexus.proxy.myorg.com:8483/redis:6.2.7
      restart: unless-stopped
      container_name: redis-frs
      deploy:
        resources:
          limits:
            memory: 6072M
      ports:
        - '6385:6379'
      command: redis-server --save 60 1 --loglevel warning
      networks:
        - gateway
      volumes: 
        - redis1_data:/data
      labels:
        - traefik.enable=true
      security_opt:
        - seccomp:unconfined
  
    redis:
      image: nnexus.proxy.myorg.com:8483/bitnami/redis:6.2
      environment:
        - ALLOW_EMPTY_PASSWORD=yes
        - REDIS_IO_THREADS=3
        - REDIS_IO_THREADS_DO_READS=yes
      ports:
        - '6386:6379'
      volumes:
        - 'redis2_data:/bitnami/redis/data'
      security_opt:
        - seccomp:unconfined
  </code></pre>
  <pre><code>Kernel: Linux 3.10.0-1160.71.1.0.1.el7.x86_64 #1 SMP Tue Jun 28 22:16:18 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux
  Docker Version:          20.10.17
  </code></pre>
  <p>I ran it also on a different Box with newer Kernel:</p>
  <pre><code>Linux US2-FLATCAR01 5.15.58-flatcar #1 SMP Wed Aug 3 19:35:04 -00 2022 x86_64 Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz GenuineIntel GNU/Linux
  Docker Version:          20.10.14
  </code></pre>
  <p>It doesn't matter how many cores the host has as running benchmark without -P should test the machines in the same way.</p>
  <blockquote>
  <p>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), if not
  explicitly enabled via the -P parameter.</p>
  </blockquote>
  <p>I'm really puzzled why we have such a performance degradation according to the benchmark and would appreciate any input or advise.</p>