>

redis使用内部存款和储蓄器调节及优化

- 编辑:大富豪棋牌游戏下载 -

redis使用内部存款和储蓄器调节及优化

redis使用内部存款和储蓄器调治及优化

redis使用内部存储器调节及优化

1、查看当前内部存款和储蓄器使用情状

[[email protected] ~]# redis-cli info# Serverredis_version:2.8.19redis_git_sha1:00000000redis_git_dirty:0redis_build_id:c0359e7aa3798aa2redis_mode:standaloneos:Linux 3.10.0-123.el7.x86_64 x86_64arch_bits:64multiplexing_api:epollgcc_version:4.8.3process_id:24191run_id:36ad15148d3478f13076b6feb065536c7dca4adctcp_port:6379uptime_in_seconds:173800uptime_in_days:2hz:10lru_clock:14099001config_file:/etc/redis.conf# Clientsconnected_clients:84client_longest_output_list:0client_biggest_input_buf:0blocked_clients:0# Memoryused_memory:14187404192used_memory_human:13.21Gused_memory_rss:14567976960used_memory_peak:14189556584used_memory_peak_human:13.22Gused_memory_lua:35840mem_fragmentation_ratio:1.03mem_allocator:jemalloc-3.6.0# Persistenceloading:0rdb_changes_since_last_save:130135rdb_bgsave_in_progress:1rdb_last_save_time:1490493874rdb_last_bgsave_status:okrdb_last_bgsave_time_sec:100rdb_current_bgsave_time_sec:74aof_enabled:0aof_rewrite_in_progress:0aof_rewrite_scheduled:0aof_last_rewrite_time_sec:-1aof_current_rewrite_time_sec:-1aof_last_bgrewrite_status:okaof_last_write_status:ok# Statstotal_connections_received:280094total_commands_processed:228769139instantaneous_ops_per_sec:1111total_net_input_bytes:14293923616total_net_output_bytes:42883168734instantaneous_input_kbps:72.58instantaneous_output_kbps:77.55rejected_connections:0sync_full:1sync_partial_ok:0sync_partial_err:1expired_keys:38545evicted_keys:0keyspace_hits:33635872keyspace_misses:302049pubsub_channels:0pubsub_patterns:4latest_fork_usec:195303# Replicationrole:masterconnected_slaves:1slave0:ip=x.0.x.x,port=6379,state=online,offset=11332087470,lag=0master_repl_offset:11332106737  ##  已修改隐藏实际iprepl_backlog_active:1repl_backlog_size:1048576repl_backlog_first_byte_offset:11331058162repl_backlog_histlen:1048576# CPUused_cpu_sys:6134.57used_cpu_user:2565.36used_cpu_sys_children:8045.19used_cpu_user_children:97035.76# Keyspacedb0:keys=337475,expires=180183,avg_ttl=1286629728

2、分析

实则内存消耗已经13G

used_memory_human:13.21G

查看zabbix内redis使用内部存款和储蓄器的近年来三个月记录

一个月前3.5G,线性增长到到13G

平均过期时间

db0:keys=337475,expires=180183,avg_ttl=1286629728

实际上内部存款和储蓄器设置

[[email protected] ~]# redis-cli config get maxmemory1) "maxmemory"2) "0"

3、优化措施

3.1、设置内部存款和储蓄器限制,幸免到达内部存款和储蓄器最大规模宕机

设置内部存款和储蓄器最大使用量为10G,先调节运维时

127.0.0.1:6379> config set maxmemory 10737418240OK(10.76s)127.0.0.1:6379> info......# Memoryused_memory:10730048552used_memory_human:9.99G

设置redis.conf,后一次重启生效

maxmemory 10737418240

3.2、调解过期时光,清理超时时间keys占用内部存储器

默认过期时间移交开发调整,avg_ttl单位为ms,换成后平均为15天,相当长的时间;未设置默认过期时间的keys,移交开发调整;

3.3、调度系统参数,保障bgsave经常运维

[[email protected] ~]# cat /etc/sysctl.confvm.overcommit_memory = 1

运行命令后生效

sysctl -p 

3.4、深入分析keys,寻觅利用内部存款和储蓄器最大的keys列表交开辟分析

安装redis-rdb-tools

过程略

生成redis快照

rdb -c memory dump.rdb > memory.csv   #dump.rdb为redis生成的dump文件

检索内部存储器用量最大的十七个对象

sort -t, -k4nr memory.csv |heand -n 20

redis使用内部存款和储蓄器调度及优化 1、查看当前内存使用状态 [[email protected] ~]# redis-cli info# Serverredis_version:2.8.19redis_git_sha1:0000...

本文由大富豪棋牌游戏二维码发布,转载请注明来源:redis使用内部存款和储蓄器调节及优化