¿Cómo realizar Redis Benchmark?

Sepa cómo funciona su Redis, cuándo puede fallar, el rendimiento, la tasa de transferencia de datos y más con las siguientes herramientas brillantes.

La popularidad y el uso de Redis (Remote Dictionary Service) han aumentado en los últimos años.

No solo para aplicaciones empresariales, sino también para pequeñas y medianas empresas. Incluso, puede usar Redis en WordPress para el almacenamiento en caché y el rendimiento es mucho mejor. Si está interesado en aprender Redis desde cero, consulte esto curso por Internet.

Como desarrollador o administrador de sistemas de una aplicación empresarial, debe tener en cuenta la realización de pruebas comparativas para conocer el rendimiento y la capacidad de su aplicación. Redis benchmark es ligeramente diferente al servidor web. La buena noticia es que hay muchas herramientas gratuitas disponibles para que pueda elegir la que mejor le funcione.

¿Listo para explorar?

Redis-benchmark

Aproveche la utilidad de evaluación comparativa incorporada de Redis llamada redis-benchmark. Está incluido en la instalación de Redis y se puede ejecutar simplemente escribiendo redis-benchmark en UNIX. También está disponible en Windows y el ejecutable es redis-benchmark.exe.

Veamos los siguientes ejemplos.

Enviando un millón de solicitudes contra 192.168.0.100

[email protected]:~# redis-benchmark -h 192.168.0.100 -p 6379 -n 1000000
====== PING_INLINE ======
  1000000 requests completed in 30.62 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1

61.85% <= 1 milliseconds
99.55% <= 2 milliseconds
99.93% <= 3 milliseconds
99.96% <= 4 milliseconds
99.98% <= 5 milliseconds
99.99% <= 6 milliseconds
99.99% <= 7 milliseconds
100.00% <= 8 milliseconds
100.00% <= 9 milliseconds
100.00% <= 9 milliseconds
32653.06 requests per second

1 millón de solicitudes se completaron en 30,62 segundos. Preste atención también a la última línea, se atienden ~32653 solicitudes por segundo.

Si observa detenidamente, el tamaño de la carga útil es de 3 bytes. Esa es la configuración predeterminada y para personalizar puede usar el parámetro -d. La siguiente prueba es para 100 000 solicitudes con una carga útil de 1 mb.

[email protected]:~# redis-benchmark -h 127.0.0.1 -p 6379 -n 100000 -d 1000000
====== PING_INLINE ======
  100000 requests completed in 2.80 seconds
  50 parallel clients
  1000000 bytes payload
  keep alive: 1

73.19% <= 1 milliseconds
99.95% <= 2 milliseconds
100.00% <= 2 milliseconds
35676.06 requests per second

¿Te diste cuenta de los clientes paralelos? Es 50 por defecto y para ajustar, puede usar el parámetro -c. El siguiente ejemplo es para 200 clientes.

[email protected]:~# redis-benchmark -h 127.0.0.1 -p 6379 -n 100000 -d 1000000 -c 200
====== PING_INLINE ======
  100000 requests completed in 3.77 seconds
  200 parallel clients
  1000000 bytes payload
  keep alive: 1

0.00% <= 1 milliseconds
2.99% <= 2 milliseconds
18.95% <= 3 milliseconds
45.81% <= 4 milliseconds
69.65% <= 5 milliseconds
86.58% <= 6 milliseconds
95.79% <= 7 milliseconds
98.88% <= 8 milliseconds
99.78% <= 9 milliseconds
99.96% <= 10 milliseconds
100.00% <= 10 milliseconds
26532.24 requests per second

Como puede ver, con 200 clientes tomó más tiempo y el procesamiento también se hizo más lento. Pero eso es de esperar y esto ayuda a encontrar el rendimiento real de la aplicación.

¿No está satisfecho con la herramienta Redis-benchmark? no se preocupe, hay más de la siguiente manera.

Redis-cli

¿Solo está interesado en la información de latencia?

Claro, puede usar redis-cli enviado con el servidor Redis. Puede ejecutar con el parámetro –latency.

[email protected]:~# redis-cli --latency
min: 0, max: 1, avg: 0.16 (1056 samples

De forma predeterminada, la muestra de latencia es cada segundo, pero puede cambiar con el interruptor -i si es necesario.

Punto de referencia Memtier

Punto de referencia Memtier de Redis Labs es compatible con Redis y Memcache, ambos. Es una herramienta de evaluación comparativa avanzada con varias opciones de prueba, como las siguientes.

  • Probar Redis protegido con contraseña
  • Ejecute el cliente en un modo de clúster
  • Número de suministro de clientes, solicitudes, subprocesos, tamaño de datos,
  • Ajuste la relación SET y GET

y mucho más…

Aquí hay un informe de prueba rápido.

[email protected]:~# memtier_benchmark 
[RUN #1] Preparing benchmark client...
[RUN #1] Launching threads now...
[RUN #1 100%, 133 secs]  3 threads:     1993223 ops,   15083 (avg:   14877) ops/sec, 639.97KB/sec (avg: 631.04KB/sec), 13.30 (avg: 13.44) msec latenc[RUN #1 100%, 134 secs]  0 threads:     2000000 ops,   15083 (avg:   14911) ops/sec, 639.97KB/sec (avg: 632.52KB/sec), 13.30 (avg: 13.41) msec latency

4         Threads
50        Connections per thread
10000     Requests per client


ALL STATS
=========================================================================
Type         Ops/sec     Hits/sec   Misses/sec      Latency       KB/sec 
-------------------------------------------------------------------------
Sets         1354.30          ---          ---     13.40200       104.30 
Gets        13528.13         0.00     13528.13     13.41000       526.98 
Waits           0.00          ---          ---      0.00000          --- 
Totals      14882.43         0.00     13528.13     13.40900       631.28 


Request Latency Distribution
Type     <= msec         Percent
------------------------------------------------------------------------
SET       0.055         0.00
SET       0.063         0.00
SET       0.110         0.00
SET       0.140         0.00
SET       0.160         0.00
SET       0.170         0.00
SET       0.180         0.00
SET       0.210         0.01
SET       0.230         0.01
SET       0.280         0.01
SET       0.300         0.01
SET       0.360         0.01
SET       0.440         0.01
SET       0.460         0.01
SET       0.480         0.01
SET       0.510         0.01
SET       0.570         0.01
SET       0.590         0.01
SET       0.610         0.01
SET       0.630         0.01
SET       0.640         0.02
SET       0.670         0.02
SET       0.680         0.02
SET       0.710         0.02
SET       0.730         0.02
SET       0.740         0.02
SET       0.750         0.02
SET       0.760         0.02
SET       0.770         0.02
SET       0.780         0.02
SET       0.790         0.02
SET       0.820         0.02
SET       0.840         0.02
SET       0.850         0.03
SET       0.870         0.03
SET       0.880         0.03
SET       0.900         0.03
SET       0.930         0.03
SET       0.940         0.03
SET       0.950         0.03
SET       0.960         0.03
SET       0.970         0.03
SET       1.000         0.03
SET       1.100         0.04
SET       1.200         0.05
SET       1.300         0.06
SET       1.400         0.07
SET       1.500         0.08
SET       1.600         0.08
SET       1.700         0.09
SET       1.800         0.10
SET       1.900         0.10
SET       2.000         0.11
SET       2.100         0.12
SET       2.200         0.12
SET       2.300         0.13
SET       2.400         0.14
SET       2.500         0.16
SET       2.600         0.18
SET       2.700         0.21
SET       2.800         0.24
SET       2.900         0.25
SET       3.000         0.26
SET       3.100         0.27
SET       3.200         0.28
SET       3.300         0.28
SET       3.400         0.29
SET       3.500         0.30
SET       3.600         0.32
SET       3.700         0.35
SET       3.800         0.37
SET       3.900         0.39
SET       4.000         0.42
SET       4.100         0.45
SET       4.200         0.48
SET       4.300         0.52
SET       4.400         0.55
SET       4.500         0.59
SET       4.600         0.63
SET       4.700         0.68
SET       4.800         0.73
SET       4.900         0.77
SET       5.000         0.82
SET       5.100         0.88
SET       5.200         0.93
SET       5.300         0.99
SET       5.400         1.06
SET       5.500         1.12
SET       5.600         1.18
SET       5.700         1.25
SET       5.800         1.33
SET       5.900         1.40
SET       6.000         1.47
SET       6.100         1.56
SET       6.200         1.64
SET       6.300         1.73
SET       6.400         1.81
SET       6.500         1.92
SET       6.600         2.00
SET       6.700         2.10
SET       6.800         2.21
SET       6.900         2.32
SET       7.000         2.44
SET       7.100         2.57
SET       7.200         2.69
SET       7.300         2.80
SET       7.400         2.95
SET       7.500         3.09
SET       7.600         3.24
SET       7.700         3.37
SET       7.800         3.52
SET       7.900         3.68
SET       8.000         3.84
SET       8.100         4.02
SET       8.200         4.17
SET       8.300         4.34
SET       8.400         4.49
SET       8.500         4.65
SET       8.600         4.84
SET       8.700         5.03
SET       8.800         5.20
SET       8.900         5.38
SET       9.000         5.59
SET       9.100         5.78
SET       9.200         6.01
SET       9.300         6.22
SET       9.400         6.45
SET       9.500         6.72
SET       9.600         7.05
SET       9.700         7.35
SET       9.800         7.66
SET       9.900         7.99
SET      10.000        10.29
SET      11.000        17.47
SET      12.000        39.07
SET      13.000        62.05
SET      14.000        76.14
SET      15.000        83.95
SET      16.000        88.77
SET      17.000        91.73
SET      18.000        93.54
SET      19.000        94.82
SET      20.000        95.90
SET      21.000        96.80
SET      22.000        97.62
SET      23.000        98.26
SET      24.000        98.74
SET      25.000        99.07
SET      26.000        99.31
SET      27.000        99.49
SET      28.000        99.65
SET      29.000        99.71
SET      30.000        99.76
SET      31.000        99.82
SET      32.000        99.86
SET      33.000        99.89
SET      34.000        99.91
SET      35.000        99.93
SET      36.000        99.96
SET      37.000        99.97
SET      38.000        99.98
SET      39.000        99.99
SET      40.000        99.99
SET      41.000        99.99
SET      42.000       100.00
SET      43.000       100.00
SET      45.000       100.00
SET      46.000       100.00
---
GET       0.053         0.00
GET       0.054         0.00
GET       0.055         0.00
GET       0.067         0.00
GET       0.068         0.00
GET       0.076         0.00
GET       0.082         0.00
GET       0.086         0.00
GET       0.100         0.00
GET       0.110         0.00
GET       0.120         0.00
GET       0.130         0.00
GET       0.140         0.00
GET       0.150         0.00
GET       0.160         0.00
GET       0.170         0.00
GET       0.190         0.00
GET       0.200         0.00
GET       0.210         0.00
GET       0.220         0.00
GET       0.230         0.00
GET       0.240         0.00
GET       0.250         0.00
GET       0.270         0.00
GET       0.280         0.00
GET       0.290         0.00
GET       0.300         0.00
GET       0.320         0.00
GET       0.330         0.00
GET       0.340         0.00
GET       0.350         0.01
GET       0.360         0.01
GET       0.380         0.01
GET       0.400         0.01
GET       0.430         0.01
GET       0.440         0.01
GET       0.460         0.01
GET       0.470         0.01
GET       0.480         0.01
GET       0.500         0.01
GET       0.510         0.01
GET       0.520         0.01
GET       0.530         0.01
GET       0.540         0.01
GET       0.550         0.01
GET       0.560         0.01
GET       0.580         0.01
GET       0.590         0.01
GET       0.600         0.01
GET       0.610         0.01
GET       0.620         0.01
GET       0.630         0.01
GET       0.640         0.01
GET       0.650         0.01
GET       0.660         0.01
GET       0.670         0.01
GET       0.680         0.01
GET       0.690         0.01
GET       0.700         0.01
GET       0.710         0.01
GET       0.720         0.01
GET       0.730         0.01
GET       0.740         0.01
GET       0.750         0.01
GET       0.760         0.01
GET       0.770         0.01
GET       0.780         0.01
GET       0.790         0.01
GET       0.800         0.01
GET       0.810         0.01
GET       0.820         0.01
GET       0.830         0.01
GET       0.840         0.01
GET       0.850         0.02
GET       0.860         0.02
GET       0.870         0.02
GET       0.880         0.02
GET       0.890         0.02
GET       0.900         0.02
GET       0.910         0.02
GET       0.920         0.02
GET       0.930         0.02
GET       0.940         0.02
GET       0.950         0.02
GET       0.960         0.02
GET       0.970         0.02
GET       0.980         0.02
GET       0.990         0.02
GET       1.000         0.02
GET       1.100         0.02
GET       1.200         0.03
GET       1.300         0.04
GET       1.400         0.04
GET       1.500         0.05
GET       1.600         0.05
GET       1.700         0.05
GET       1.800         0.06
GET       1.900         0.06
GET       2.000         0.07
GET       2.100         0.07
GET       2.200         0.08
GET       2.300         0.09
GET       2.400         0.09
GET       2.500         0.11
GET       2.600         0.13
GET       2.700         0.16
GET       2.800         0.18
GET       2.900         0.20
GET       3.000         0.20
GET       3.100         0.21
GET       3.200         0.21
GET       3.300         0.22
GET       3.400         0.24
GET       3.500         0.25
GET       3.600         0.26
GET       3.700         0.28
GET       3.800         0.31
GET       3.900         0.33
GET       4.000         0.36
GET       4.100         0.39
GET       4.200         0.43
GET       4.300         0.46
GET       4.400         0.49
GET       4.500         0.53
GET       4.600         0.57
GET       4.700         0.61
GET       4.800         0.65
GET       4.900         0.69
GET       5.000         0.73
GET       5.100         0.78
GET       5.200         0.83
GET       5.300         0.89
GET       5.400         0.95
GET       5.500         1.01
GET       5.600         1.08
GET       5.700         1.14
GET       5.800         1.21
GET       5.900         1.30
GET       6.000         1.37
GET       6.100         1.45
GET       6.200         1.54
GET       6.300         1.62
GET       6.400         1.71
GET       6.500         1.80
GET       6.600         1.90
GET       6.700         1.99
GET       6.800         2.10
GET       6.900         2.21
GET       7.000         2.33
GET       7.100         2.45
GET       7.200         2.56
GET       7.300         2.67
GET       7.400         2.80
GET       7.500         2.94
GET       7.600         3.08
GET       7.700         3.22
GET       7.800         3.36
GET       7.900         3.51
GET       8.000         3.66
GET       8.100         3.83
GET       8.200         3.99
GET       8.300         4.17
GET       8.400         4.32
GET       8.500         4.49
GET       8.600         4.67
GET       8.700         4.84
GET       8.800         5.00
GET       8.900         5.18
GET       9.000         5.37
GET       9.100         5.58
GET       9.200         5.78
GET       9.300         6.00
GET       9.400         6.25
GET       9.500         6.53
GET       9.600         6.82
GET       9.700         7.11
GET       9.800         7.41
GET       9.900         7.77
GET      10.000        10.13
GET      11.000        17.36
GET      12.000        39.32
GET      13.000        62.21
GET      14.000        76.31
GET      15.000        83.98
GET      16.000        88.82
GET      17.000        91.71
GET      18.000        93.50
GET      19.000        94.77
GET      20.000        95.84
GET      21.000        96.76
GET      22.000        97.58
GET      23.000        98.22
GET      24.000        98.73
GET      25.000        99.07
GET      26.000        99.32
GET      27.000        99.51
GET      28.000        99.66
GET      29.000        99.73
GET      30.000        99.78
GET      31.000        99.83
GET      32.000        99.87
GET      33.000        99.90
GET      34.000        99.92
GET      35.000        99.94
GET      36.000        99.96
GET      37.000        99.97
GET      38.000        99.98
GET      39.000        99.99
GET      40.000        99.99
GET      41.000        99.99
GET      42.000       100.00
GET      43.000       100.00
GET      44.000       100.00
GET      45.000       100.00
GET      46.000       100.00
GET      47.000       100.00
---
[email protected]:~#

Dudo que pueda instalar esto en Windows, pero seguro que en distribuciones UNIX como RHEL/CentOS, Ubuntu/Debian, MacOS, etc. Es gratis probar la experiencia.

Disponible como CLI y GUI, ambos. RDBHerramientas es una herramienta multiplataforma y tiene como objetivo ayudar a mejorar el rendimiento de la aplicación. Hablando de la evaluación comparativa específica, tiene una función de análisis de memoria que permite investigar el uso de memoria, análisis clave, identificar fugas de memoria y recomendar reducir el uso de memoria.

Puede ver el rendimiento en tiempo real y realizar todo tipo de tareas administrativas a través de la GUI.

Conclusión

Espero que las herramientas anteriores lo ayuden a realizar la evaluación comparativa de Redis para que conozca el rendimiento de la aplicación.