• Home
  • WP tuts
  • Hosting talk
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • Speed up wordpress
  • Pc world
  • Services
  • About Me

RAaz Kumar .com

wordpress tutorials seo hosting etc

Redis performance metrics & tuning for nginx apache ubuntu & debian

 

 

Redis performance metrics

Connection status: accepted and rejected clients
Throughput: commands per seconds
Key evictions: when max memory reached
Memory fragmentation ratio: 1-1.5 system allocated memory for redis.
Cache hit ratio: 0.8 to 1 (1=100%)
Latency: Average time for the Redis server to respond to a request
Redis: single threaded, persistent to disk, more than strings
memcached multithreaded, not persistent to disk, only strings

#1 memory

info memory
root@instance-1:~# redis-cli
127.0.0.1:6379> info memory
# Memory
used_memory:34693568
used_memory_human:33.09M
used_memory_rss:41807872
used_memory_rss_human:39.87M
used_memory_peak:38860568
used_memory_peak_human:37.06M
used_memory_peak_perc:89.28%
used_memory_overhead:1684088
used_memory_startup:782504
used_memory_dataset:33009480
used_memory_dataset_perc:97.34%
total_system_memory:4126593024
total_system_memory_human:3.84G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:268435456
maxmemory_human:256.00M
maxmemory_policy:allkeys-lru
mem_fragmentation_ratio:1.21
mem_allocator:jemalloc-3.6.0
active_defrag_running:0
lazyfree_pending_objects:0
127.0.0.1:6379>
(used_memory > total available memory   then it uses disk 0.1 μs for memory vs. 10 ms for disk)
setting max memory in redis command line
“volatile-ttl” (expiring keys quickly) or “allkeys-lru”
config set maxmemory

#2 total_commands_processed & latency

127.0.0.1:6379> info stats
# Stats
total_connections_received:19990
total_commands_processed:8900629
total_net_input_bytes:39738291466
total_net_output_bytes:75634761441
rejected_connections:0
expired_keys:855714
expired_stale_perc:0.16
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:4970741
keyspace_misses:2033652
127.0.0.1:6379>
commands in queue
slow commands may blocking

#3Latency  not info command

typical latency for a 1Gb/s network is about 200 μs in redis cluster
go to your redis-cli, change directory to the location of your Redis installation, and type the following: ./redis-cli –latency -h ‘host’ -p ‘port’
./redis-cli –latency -h ‘127.0.0.1’ -p ‘6379’

slow log

Default 10 ms
including network latency 200ms
127.0.0.1:6379> slowlog get
1) 1) (integer) 1
   2) (integer) 1597245698
   3) (integer) 29204
   4) 1) “FLUSHDB”
   5) “127.0.0.1:48666”
   6) “”
2) 1) (integer) 0
   2) (integer) 1596389191
   3) (integer) 14310
   4) 1) “GET”
      2) “w3tc_793616459_raazkumar.com_0_object_0optionsalloptions“
   5) “127.0.0.1:50420”
   6) “”
127.0.0.1:6379>
for setting slow query log to 5ms
try
redis cli:
127.0.0.1:6379> config set slowlog-log-slower-than 5000.

#5 client connections concurrent

127.0.0.1:6379> info clients
# Clients
connected_clients:6
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
default maximum number of client connections is 10,000
(connected_clients)
maxclients limit in redis.conf
or
config set maxclients  value
110-150% of expected peak number connections

#6 Memory Fragmentation Ratio or  redis used_memory vs maxmemory

mem_fragmentation_ratio
memory used as seen by the operating system (used_memory_rss) to memory allocated by Redis (used_memory)
mem_fragmentation_ratio = used_memory_rss /used_memory
 
RSS stands for Resident Set Size OS value
 
Fragmentation Ratio 1 means 100%.
Fragmentation Ratio 1.5 means 150% memory usage
127.0.0.1:6379> info memory
# Memory
used_memory_human:29.32M
used_memory_rss_human:36.29M
used_memory_peak_human:37.06M
used_memory_peak_perc:79.11%
total_system_memory_human:3.84G
used_memory_lua_human:37.00K
maxmemory_human:256.00M
maxmemory_policy:allkeys-lru
mem_fragmentation_ratio:1.24
mem_allocator:jemalloc-3.6.0
maxmemory_human:256.00M
127.0.0.1:6379>
r: If your fragmentation ratio is above 1.5, restarting your Redis server
restart command
shutdown save
if fragment ration is below 1 then its swapping to disk
memory allocator
(glibc’s malloc, jemalloc11, tcmalloc
re comiling required
redis used_memory vs maxmemory
 
Used Memory is greater than max memory
when new command added, redis checks the memory usage, and if it is greater than the max memory limit , it evicts keys according to the policy
redis used memory vs used memory rss
used memory rss operating system has allocated to Redis.

$5 Evictions

Key evictions only occur if the max memory limit is set
127.0.0.1:6379> info stats
# Stats
expired_keys:858694
evicted_keys:0

#6 Throughput operations per second

instantaneous_ops_per_sec Total number of commands processed per second
127.0.0.1:6379> info commandstats
# Commandstats
cmdstat_slowlog:calls=1,usec=48,usec_per_call=48.00
cmdstat_setex:calls=1102770,usec=7149047,usec_per_call=6.48
cmdstat_mget:calls=12985,usec=256438,usec_per_call=19.75
cmdstat_flushdb:calls=3,usec=29215,usec_per_call=9738.33
cmdstat_get:calls=6965970,usec=49868844,usec_per_call=7.16
cmdstat_del:calls=56983,usec=155292,usec_per_call=2.73
cmdstat_zrangebyscore:calls=141,usec=23262,usec_per_call=164.98
cmdstat_select:calls=30887,usec=56887,usec_per_call=1.84
cmdstat_set:calls=680125,usec=1680851,usec_per_call=2.47
cmdstat_echo:calls=30745,usec=78815,usec_per_call=2.56
cmdstat_ping:calls=19934,usec=21616,usec_per_call=1.08
cmdstat_zremrangebyscore:calls=166,usec=5380,usec_per_call=32.41
cmdstat_info:calls=19994,usec=1363202,usec_per_call=68.18
cmdstat_monitor:calls=4,usec=4,usec_per_call=1.00
cmdstat_command:calls=4,usec=2220,usec_per_call=555.00
cmdstat_zadd:calls=19917,usec=615735,usec_per_call=30.92
127.0.0.1:6379>
peak load, the frequency of peak load, average load
Active Connections

ideal Cache Hit Ratio in redis

keep your cache hit ratio at 0.8 or higher
keyspace_hits:4998497
keyspace_misses:2043235
(Total key hits)/ (Total keys hits + Total key misses).
keyspace = Total number of keys in your database

Evicted/Expired Keys

expired_keys:859846
expired_stale_perc:0.00
expired_time_cap_reached_count:0
evicted_keys:0
allkeys-lru removes the least recently used key from the set of all keys
volatile-lru removes the least recently used key among the ones with an expiration set
allkeys-random removes a random key from the set of all keys
volatile = expiration set
allkeys = from all keys without expiration
lfu: least frequently used
lru: least recently used
random: random key
ttl: time to live (shortest)
volatile-ttl,
volatile-lru,volatile-random,allkeys-lru,allkeys-random,volatile-lfu,allkeys-lfu
info replication

Performance tuning

/etc/redis/redis.conf
RDB Persistence disable it if  you don’t use it. (persist data on disk)

Increase max connections  limit by linux kernel

Max-Connection
sysctl -w net.core.somaxconn=65365
root@instance-1:~# sysctl -w net.core.somaxconn=65365
net.core.somaxconn = 65365
consider server specification.
Pipelining
TCP-KeepAlive  

Redis will get OOM (Out of Memory) error causes by overcommit memory value is 0

Overcommit memory is a kernel parameter which checks if the memory is available or not

nano /etc/sysctl.conf

vm.overcommit_memory = 1

timeout  300 sec

maxmemory 70-90% in dedicated

maxmemory-policy volatile-lru if expires quickly otherwise lru.

 

Also read install & configure redis in ubuntu & debian nginx / apache

 

Related topics:

  1. Redis / memcached installation on ubuntu 20.04 with wordpress mysql configuration
  2. Letsencrypt SSL Installation on apache/Nginx ubuntu / debian
  3. install wordpress via command line apache nginx ubuntu debian
  4. Lamp stack install on Ubuntu 20.4 LTS apache, mysql, php 7.4(Debian 9 & Ubuntu 18.04 lts)
  5. apache performance tuning mpm-worker vs prefork vs event modules

tutorials

  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Devops Syllabus topics PDF
  • CCNA Syllabus pdf (CCNA / CCNP vs devops vs mcsa /MCSE)
  • how to create a website free of cost on google
  • what is vpn vs proxy vs tor, http vs https, http2, tcp vs udp, kali linux sql source code injection
  • nginx server tutorials (installation, configuration, performance tuning, security)
    • nginx modules list (enable, disable, upgrade, install dynamic module)
    • SSL faster reduce TLS hand shake improve https performance
    • monitor nginx request with nginx status amplify datadog new relic
    • nginx installation on ubuntu 20.04 LTS
    • Redis performance metrics & tuning for nginx apache ubuntu & debian
    • enable brotli compression nginx brotli vs gzip
    • nginx performance tuning
    • Top 10 tips to improve nginx server security
    • letsencrypt install configure on ubuntu / debian nginx
    • what is TTFB & how to Reduce it (server response time) Google pagespeed
    • enable php fpm status page, monitor & understand the report to tweak performance
    • 2021 php fpm pool manager configuration settings based on server spike
    • Letsencrypt SSL Installation on apache/Nginx ubuntu / debian
    • nginx rewrite rules with examples 301 redirection
    • use nginx as reverse proxy and load balancer for apache wordpress
    • nginx conf explained best config file performance tuning nginx.conf
    • nginx errors (504,502, 413, unable to start, syntax errors)
    • Pagespeed module install, configure, monitor, errors ft nginx &apache
    • Apache vs nginx (connection handling, modules, memory usage)
    • install lemp Linux, Nginx 1.15.12, MySQL 8, PHP fpm 7.3 on Ubuntu 18.04
    • nginx fastcgi cache wordpress how to configure
    • Redis / memcached installation on ubuntu 20.04 with wordpress mysql configuration
    • cloudflare timeout error 522 524 fix by increasing limit
  • Vivek Bindra Videos Transcription (business strategy)
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • ubuntu tutorials installation download issues etc
  • Php tutorials
  • HTML & CSS Tutorials
  • Core Java Tutorial Free online
  • Linux sysadmin tutorials linux system administrator
  • apache server tutorial (install,config, performance tuning, security, error handling)

 

PUBG Mobile Tips & Tricks

free fire how to play (a-z guide) guns, tips & tricks etc

Windows 10 tips & tricks

Pagespeed optimization

Pc building tips & tricks

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

Android studio tutorials

Gaming/ streaming tips

Airtel dth channel list

 

wordpress

 

Top 5  WP Google Analytics Plugins

WP Backup Plugins

Wp Comment Plugins

Top wordpress Security Plugins

WP Seo Plugins

WP Caching Plugins

Best Adsense Plugins for WordPress

Wp social Sharing Plugins

autoshare social media plugins

WP speed Optimization Plugins

Speedup WordPress google Score

More Wp tuts

Server Admin Cloud

 

Installing Nginx LEMP On ubuntu

Installing apache Lamp ubuntu

nginx fastcgi cache enable

php – fpm install  & Configuration

Opcache install & Configure

php -fpm pool manager explained

Mysql Install & Configuration

Redis Object cache install & configure

 

Nginx as Reverse Proxy and Load balancer

Load Balance / auto scaling in google cloud

Linux Commands PDF

Mysql Commands Pdf

Letsencrypt tutorial

mysqldump export & import 

Pagespeed Module install & configure

nginx.conf best file

mysql.conf best file

upgrade ubuntu

© 2021 - All Rights Reserved Disclaimer & Privacy Policy