Pertanyaan : - Ketika menginstall redis, ada opsi apakah ingin mengaktifkan igbinary serializer support, lzf compression support dan zstd compression support. Apa kekurangan dan kelebihan mengaktifkan ini ?
Redis di Google Cloud
[4]
redis-benchmark
redis-benchmark -q -h 10.146.0.5 -p 6379 -c 100 -n 1000000 -k 1 -t set,get,mset,incr,lpush,lpop,sadd,spop,lpush,lrange
Hasil benchmark di MacBook Pro 2018 :
SET: 132240.16 requests per second
GET: 131700.25 requests per second
INCR: 134174.16 requests per second
LPUSH: 134898.16 requests per second
LPOP: 130958.62 requests per second
SADD: 129988.30 requests per second
SPOP: 126246.69 requests per second
LPUSH (needed to benchmark LRANGE): 127258.85 requests per second
LRANGE_100 (first 100 elements): 29457.69 requests per second
LRANGE_300 (first 300 elements): 12210.91 requests per second
LRANGE_500 (first 450 elements): 8519.19 requests per second
LRANGE_600 (first 600 elements): 6515.55 requests per second
MSET (10 keys): 91424.39 requests per second
Hasil benchmark di Google Compute :
lpush,lpop,sadd,spop,lpush,lrange
SET: 50707.37 requests per second
GET: 50456.63 requests per second
INCR: 50334.72 requests per second
LPUSH: 48775.73 requests per second
LPOP: 49905.18 requests per second
SADD: 50890.59 requests per second
SPOP: 52069.77 requests per second
LPUSH (needed to benchmark LRANGE): 49766.10 requests per second
LRANGE_100 (first 100 elements): 26313.02 requests per second
LRANGE_300 (first 300 elements): 12700.67 requests per second
LRANGE_500 (first 450 elements): 9121.51 requests per second
LRANGE_600 (first 600 elements): 7058.56 requests per second
MSET (10 keys): 39756.69 requests per second
memtier_benchmark
$memtier_benchmark --server=127.0.0.1 --port=6379 --protocol=redis --threads=2 --test-time=120 --ratio=1:1 --clients=600 --data-size=100 --key-pattern=S:S --pipeline=50 --hdr-file-prefix=macbookpro2018
MacBook Pro 2018
Google Compute VM
GCP Memorystore
Latency Spectrum Redis MacBook Pro 2018 vs Google Compute vs GCP Memorystore
Mac Hardware Profile
$ system_profiler SPHardwareDataType
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro15,1
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 9 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
Boot ROM Version: 1554.60.15.0.0 (iBridge: 18.16.13030.0.0,0)
Serial Number (system): C02XH8WHJG5J
Hardware UUID: 21DEED7D-EEA5-53BC-882C-4B073F2C7854
GCP Hardware Profile
e2-standard-2 (2 vCPUs, 8 GB memory)
$ sudo lshw -short
H/W path Device Class Description
==========================================================
system Google Compute Engine
/0 bus Google Compute Engine
/0/0 memory 96KiB BIOS
/0/1001 processor Intel(R) Xeon(R) CPU @ 2.00GHz
/0/1002 processor CPU
/0/200 memory 8GiB System Memory
/0/200/0 memory 8GiB DIMM RAM Synchronous
/0/100 bridge 440FX - 82441FX PMC [Natoma]
/0/100/1 bridge 82371AB/EB/MB PIIX4 ISA
/0/100/1.3 bridge 82371AB/EB/MB PIIX4 ACPI
/0/100/3 generic Virtio SCSI
/0/100/3/0 scsi0 generic Virtual I/O device
/0/100/3/0/0.1.0 /dev/sda disk 53GB PersistentDisk
/0/100/3/0/0.1.0/1 /dev/sda1 volume 49GiB EXT4 volume
/0/100/3/0/0.1.0/e /dev/sda14 volume 3071KiB BIOS Boot partition
/0/100/3/0/0.1.0/f volume 123MiB Windows FAT volume
/0/100/4 network Virtio network device
/0/100/4/0 ens4 network Ethernet interface
/0/100/5 generic Virtio memory balloon
/0/100/5/0 generic Virtual I/O device
/0/100/6 generic Virtio RNG
/0/100/6/0 generic Virtual I/O device
/0/1 system PnP device PNP0b00
/0/2 input PnP device PNP0303
/0/3 input PnP device PNP0f13
/0/4 communication PnP device PNP0501
/0/5 communication PnP device PNP0501
/0/6 communication PnP device PNP0501
/0/7 communication PnP device PNP0501
Monitoring Redis dengan Grafana Dashboard
[7]
/etc/systemd/system/redis_exporter.service
[Unit]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start redis_exporter
sudo systemctl status redis_exporter
Redis Tuning
disable transparent huge
echo never > /sys/kernel/mm/transparent_hugepage/enabled
Enabling overcommit_memory
$ echo 1 > /proc/sys/vm/overcommit_memory
## Set it persistently
$ echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
Set swappiness at the most least weight
$ echo 1 > /proc/sys/vm/swappiness
## Set it persistently
$ echo 'vm.swappiness = 1' >> /etc/sysctl.conf
Memory Usage
nano /etc/redis/redis.conf
# Setting it to 8GB
maxmemory 6442450944
TCP-KeepAlive
## Editing default config file /etc/redis/redis.conf
# Update the value to 0
tcp-keepalive 0