2016-06-20 12 views
0

私は毎秒起動するスクリプトを除いて、ほとんど使用されていないドッカー(公式画像)上にredisインスタンス(3.2)を持っています。ここで は私のスクリプトです:Redis memory usage、ZSET and docker

local latestSchedule = redis.call('ZRANGEBYSCORE', KEYS[1], '-inf', 123456789, 'LIMIT', '0', '1') 
if latestSchedule[1] == nil then return nil end 
redis.call('ZREM', KEYS[1], latestSchedule[1]) 
return latestSchedule[1] 

このZSETが空にほとんどの時間であっても、それが再起動し、再び上がるまで、Redisのは、128メガバイトまで、より多くのメモリを食べています。

何か不足していますか? redisのメモリ使用量は通常何もせずに増加していますか? 私のスクリプトは、ZSETからアンキューイングするのに適していませんか? 私は別の場所で見るべきでしょうか?

# Server 
redis_version:3.2.0 
redis_git_sha1:00000000 
redis_git_dirty:0 
redis_build_id:5382f69a4e75566b 
redis_mode:standalone 
os:Linux 3.16.0-4-amd64 x86_64 
arch_bits:64 
multiplexing_api:epoll 
gcc_version:4.9.2 
process_id:1 
run_id:4e22b73f22436677376b4d097746c2a30ba2b9bc 
tcp_port:6379 
uptime_in_seconds:21140 
uptime_in_days:0 
hz:10 
lru_clock:6816977 
executable:/data/redis-server 
config_file: 

# Clients 
connected_clients:5 
client_longest_output_list:0 
client_biggest_input_buf:0 
blocked_clients:0 

# Memory 
used_memory:33392560 
used_memory_human:31.85M 
used_memory_rss:125399040 
used_memory_rss_human:119.59M 
used_memory_peak:33473544 
used_memory_peak_human:31.92M 
total_system_memory:1787236352 
total_system_memory_human:1.66G 
used_memory_lua:67447808 
used_memory_lua_human:64.32M 
maxmemory:134217728 
maxmemory_human:128.00M 
maxmemory_policy:noeviction 
mem_fragmentation_ratio:3.76 
mem_allocator:jemalloc-4.0.3 

# Persistence 
loading:0 
rdb_changes_since_last_save:162 
rdb_bgsave_in_progress:0 
rdb_last_save_time:1466413629 
rdb_last_bgsave_status:ok 
rdb_last_bgsave_time_sec:-1 
rdb_current_bgsave_time_sec:-1 
aof_enabled:1 
aof_rewrite_in_progress:0 
aof_rewrite_scheduled:0 
aof_last_rewrite_time_sec:-1 
aof_current_rewrite_time_sec:-1 
aof_last_bgrewrite_status:ok 
aof_last_write_status:ok 
aof_current_size:1039856 
aof_base_size:0 
aof_pending_rewrite:0 
aof_buffer_length:0 
aof_rewrite_buffer_length:0 
aof_pending_bio_fsync:0 
aof_delayed_fsync:0 

# Stats 
total_connections_received:21174 
total_commands_processed:339098 
instantaneous_ops_per_sec:10 
total_net_input_bytes:34329347 
total_net_output_bytes:11702705 
instantaneous_input_kbps:0.96 
instantaneous_output_kbps:0.14 
rejected_connections:0 
sync_full:0 
sync_partial_ok:0 
sync_partial_err:0 
expired_keys:24 
evicted_keys:0 
keyspace_hits:200 
keyspace_misses:84628 
pubsub_channels:0 
pubsub_patterns:0 
latest_fork_usec:0 
migrate_cached_sockets:0 

# Replication 
role:master 
connected_slaves:0 
master_repl_offset:0 
repl_backlog_active:0 
repl_backlog_size:1048576 
repl_backlog_first_byte_offset:0 
repl_backlog_histlen:0 

# CPU 
used_cpu_sys:27.75 
used_cpu_user:21.72 
used_cpu_sys_children:0.00 
used_cpu_user_children:0.00 

# Cluster 
cluster_enabled:0 

# Keyspace 
db0:keys=47,expires=47,avg_ttl=17584379 

そして、ちょうどそれが再起動します:

# Server 
redis_version:3.2.0 
redis_git_sha1:00000000 
redis_git_dirty:0 
redis_build_id:5382f69a4e75566b 
redis_mode:standalone 
os:Linux 3.16.0-4-amd64 x86_64 
arch_bits:64 
multiplexing_api:epoll 
gcc_version:4.9.2 
process_id:1 
run_id:4e22b73f22436677376b4d097746c2a30ba2b9bc 
tcp_port:6379 
uptime_in_seconds:21140 
uptime_in_days:0 
hz:10 
lru_clock:6816977 
executable:/data/redis-server 
config_file: 

# Clients 
connected_clients:5 
client_longest_output_list:0 
client_biggest_input_buf:0 
blocked_clients:0 

# Memory 
used_memory:33392560 
used_memory_human:31.85M 
used_memory_rss:125399040 
used_memory_rss_human:119.59M 
used_memory_peak:33473544 
used_memory_peak_human:31.92M 
total_system_memory:1787236352 
total_system_memory_human:1.66G 
used_memory_lua:67447808 
used_memory_lua_human:64.32M 
maxmemory:134217728 
maxmemory_human:128.00M 
maxmemory_policy:noeviction 
mem_fragmentation_ratio:3.76 
mem_allocator:jemalloc-4.0.3 

# Persistence 
loading:0 
rdb_changes_since_last_save:162 
rdb_bgsave_in_progress:0 
rdb_last_save_time:1466413629 
rdb_last_bgsave_status:ok 
rdb_last_bgsave_time_sec:-1 
rdb_current_bgsave_time_sec:-1 
aof_enabled:1 
aof_rewrite_in_progress:0 
aof_rewrite_scheduled:0 
aof_last_rewrite_time_sec:-1 
aof_current_rewrite_time_sec:-1 
aof_last_bgrewrite_status:ok 
aof_last_write_status:ok 
aof_current_size:1039856 
aof_base_size:0 
aof_pending_rewrite:0 
aof_buffer_length:0 
aof_rewrite_buffer_length:0 
aof_pending_bio_fsync:0 
aof_delayed_fsync:0 

# Stats 
total_connections_received:21174 
total_commands_processed:339098 
instantaneous_ops_per_sec:10 
total_net_input_bytes:34329347 
total_net_output_bytes:11702705 
instantaneous_input_kbps:0.96 
instantaneous_output_kbps:0.14 
rejected_connections:0 
sync_full:0 
sync_partial_ok:0 
sync_partial_err:0 
expired_keys:24 
evicted_keys:0 
keyspace_hits:200 
keyspace_misses:84628 
pubsub_channels:0 
pubsub_patterns:0 
latest_fork_usec:0 
migrate_cached_sockets:0 

# Replication 
role:master 
connected_slaves:0 
master_repl_offset:0 
repl_backlog_active:0 
repl_backlog_size:1048576 
repl_backlog_first_byte_offset:0 
repl_backlog_histlen:0 

# CPU 
used_cpu_sys:27.75 
used_cpu_user:21.72 
used_cpu_sys_children:0.00 
used_cpu_user_children:0.00 

# Cluster 
cluster_enabled:0 

# Keyspace 
db0:keys=47,expires=47,avg_ttl=17584379 
+0

あなたのredis cli端末からの情報の出力を表示できますか?あなたのZSETが空でメモリが128 MB程度のときにこれを取ることを確認してください –

+0

はINFO – VincentSerpoul

答えて

1

あなたの理解が間違っているカーティケヤンGopall要求ごととして

は、ここでそれは128メガバイトに達する直前に、INFOです。ここで maxmemory_human:128.00Mは、設定ごとにredisが取ることができる最大メモリを意味します(redis.confファイルでこれを変更できます。現在の値は134217728バイト、つまり128 MBです)。あなたは used_memory_humanを参照してくださいする必要があり

:31.85MをRedisのことで現在使用されているメモリのために:あなたのメモリ使用量がこの範囲を超えた場合は、Redisのは、あなたの立ち退きポリシー(noevictionmaxmemory_policy)ごとにメモリエラーの投げを開始します。

# Keyspace 
db0:keys=47,expires=47,avg_ttl=17584379 

あなたのサーバーには46個以上のキーがありますが、これは通常のメモリだと思います。

このリンクのinfoコマンドの各値の詳細については、http://redis.io/commands/INFOを参照してください。

これが役に立ちます。

+0

で更新されましたあなたのご協力ありがとうございますKarthikeyan Gopall。 私は最大のメモリを自分で設定しました。私は限界に達してはならないことを知っています。 私はそれほど多くのスペースを取ることを期待していませんでした。 私は追放ポリシーを調べて、異なるインスタンスをセットアップするかもしれません:)。 – VincentSerpoul