Skip to content

Commit

Permalink
[config] slow log wasn't available until 2.2.12, let's make it config…
Browse files Browse the repository at this point in the history
…urable
  • Loading branch information
portertech committed Apr 21, 2012
1 parent 9160b6d commit 298ab41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions attributes/default.rb
Expand Up @@ -8,9 +8,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -34,6 +34,9 @@
default['redis']['config']['pidfile'] = "/var/run/redis.pid"
default['redis']['config']['rdbcompression'] = "yes"
default['redis']['config']['timeout'] = "300"
default['redis']['config']['slowlog'] = false
default['redis']['config']['slowlog_log_slower_than'] = "10000"
default['redis']['config']['slowlog_max_len'] = "1024"
default['redis']['config']['vm']['enabled'] = "no"
default['redis']['config']['vm']['max_memory'] = "0"
default['redis']['config']['vm']['max_threads'] = "4"
Expand Down
12 changes: 6 additions & 6 deletions templates/default/redis.conf.erb
Expand Up @@ -166,14 +166,14 @@ dir <%= @dir %>

# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
# is reached? You can select among five behavior:

# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key accordingly to the LRU algorithm
# volatile-random -> remove a random key with an expire set
# allkeys->random -> remove a random key, any key
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# noeviction -> don't expire at all, just return an error on write operations
#
#
# Note: with all the kind of policies, Redis will return an error on write
# operations, when there are not suitable keys for eviction.
#
Expand Down Expand Up @@ -258,7 +258,7 @@ appendfsync <%= @appendfsync %>
# the same as "appendfsync none", that in pratical terms means that it is
# possible to lost up to 30 seconds of log in the worst scenario (with the
# default Linux settings).
#
#
# If you have latency problems turn this to "yes". Otherwise leave it as
# "no" that is the safest pick from the point of view of durability.
no-appendfsync-on-rewrite no
Expand All @@ -271,7 +271,7 @@ no-appendfsync-on-rewrite no
# but just the time needed to actually execute the command (this is the only
# stage of command execution where the thread is blocked and can not serve
# other requests in the meantime).
#
#
# You can configure the slow log with two parameters: one tells Redis
# what is the execution time, in microseconds, to exceed in order for the
# command to get logged, and the other parameter is the length of the
Expand All @@ -281,11 +281,11 @@ no-appendfsync-on-rewrite no
# The following time is expressed in microseconds, so 1000000 is equivalent
# to one second. Note that a negative number disables the slow log, while
# a value of zero forces the logging of every command.
slowlog-log-slower-than 10000
<%= "# " unless @slowlog -%>slowlog-log-slower-than <%= @slowlog_log_slower_than %>

# There is no limit to this length. Just be aware that it will consume memory.
# You can reclaim memory used by the slow log with SLOWLOG RESET.
slowlog-max-len 1024
<%= "# " unless @slowlog -%>slowlog-max-len <%= @slowlog_max_len %>

################################ VIRTUAL MEMORY ###############################

Expand Down

0 comments on commit 298ab41

Please sign in to comment.