-
Notifications
You must be signed in to change notification settings - Fork 16
Configuration 1.x.x
Alexandre Curreli edited this page Jul 28, 2014
·
1 revision
Scredis makes use of the Typesafe Config Library. The list of parameters you can tweak can be seen in reference.conf below.
scredis {
client {
# Redis server address
host = localhost
# Redis server port
port = 6379
# Redis server password (optional)
## password = guessit
# Database to be selected when connection is established
database = 0
# Command execution timeout. When set to <= 0 or null, there is no timeout.
# Note that when the timeout can be given as part of a Redis command argument, the latter
# prevails (e.g. BLPOP, BRPOP, BLPOPRPUSH).
# This parameter can be overwritten on a per-command basis using CommandOptions.
timeout = 2 seconds
# Number of tries to perform in case unexpected errors occur. Note that errors returned by the
# Redis server (i.e. RedisCommandExceptions) will not be retried (since they will always fail).
# This parameter can also be overwritten on a per-command basis using CommandOptions.
tries = 1
# Duration of time to sleep between tries. This is not used when there is a single try.
# When set to <= 0 or null, commands will be retried immediately (without sleeping).
# This parameter can also be overwritten on a per-command basis using CommandOptions.
sleep = 500 milliseconds
}
pool {
# Determines whether or not the pool returns idle clients in last-in-first-out order.
lifo = true
# Controls the maximum number of clients that can be allocated by the pool (checked out to
# clients, or idle awaiting checkout) at a given time. When non-positive, there is no limit
# to the number of clients that can be managed by the pool at one time. When max-active is
# reached, the pool is said to be exhausted.
max-active = 8
# Controls the maximum number of clients that can sit idle in the pool at any time.
# When negative, there is no limit to the number of clients that may be idle at one time.
max-idle = -1
# Specifies the behavior of the borrowClient() method when the pool is exhausted.
# "fail" - borrowClient() throws a NoSuchElementException.
# "grow" - borrowClient() creates a new client and returns it (essentially making max-active
# meaningless)
# "block" - borrowClient() blocks (invokes Object.wait()) until a new or idle client is
# available. If a finite max-wait duration is supplied, then borrowClient() blocks for at most
# that duration, after which a NoSuchElementException is thrown.
# If max-wait is infinite or non-positive, the borrowClient() method blocks indefinitely.
when-exhausted-action = block
# Determines the maximum amount of time for which borrowClient() is allowed to block.
# This parameter is only used if when-exhausted-action is set to block.
max-wait = Inf
# When true, a client will be validated by issuing a ping command to the redis-server and
# awaiting a pong reply.
# When false, clients are validated based on their socket status only.
test-with-ping = true
# When set, the pool will attempt to validate each client before it is returned from the
# borrowClient() method. Clients failing to validate will be dropped from the pool, and a
# different client will be borrowed.
test-on-borrow = false
# When set, the pool will attempt to validate each client before it is returned to the pool in
# the returnClient() method. Clients failing to validate will be dropped from the pool.
test-on-return = false
eviction {
# Indicates how long the eviction thread should sleep before "runs" of examining
# idle clients. When undefined, no eviction thread will be launched.
## eviction-run-interval = 30 seconds
# Specifies the minimum amount of time that a client may sit idle in the pool before it is
# eligible for eviction due to idle time. When undefined, no client will be dropped from
# the pool due to idle time alone. This setting has no effect unless eviction-run-interval
# is defined.
evictable-after = 5 minutes
# Specifies the minimum amount of time a client may sit idle in the pool before it is
# eligible for eviction by the idle client evictor (if any), with the extra condition that
# at least min-idle client instances remain in the pool. When undefined, no clients will be
# evicted from the pool due to idle time alone. This setting has no effect unless
# eviction-run-interval is defined and it is superceded by evictable-after, i.e. if
# evictable-after is set then soft-evictable-after is ignored.
## soft-evictable-after = 5 minutes
# Determines the minimum number of idle clients that must remain in the pool when using
# the soft-evictable-after parameter.
min-idle = 4
# Determines the number of clients examined in each run of the idle client evictor.
# This setting has no effect unless eviction-run-interval is defined.
tests-per-eviction-run = 3
# Indicates whether or not idle clients should be validated by the idle client evictor
# (if any). Clients failing to validate will be dropped from the pool. This setting has no
# effect unless eviction-run-interval is defined.
test-while-idle = false
}
}
async {
# Determines whether automatic pipelining should be enabled. When set to true, an additional
# thread is created to schedule the execution of pipelines according to auto-pipeline-interval.
# Note that automatic pipelining only works with asynchronous commands.
auto-pipeline = true
# The number of commands to be queued before executing them in a pipeline.
# When set to <= 0 or null, auto-pipeline-interval will be the only factor triggering the
# execution of commands. This parameter has no effect unless auto-pipeline is enabled.
auto-pipeline-threshold = 100
# The time interval used to schedule the execution of commands. This parameter is required
# and cannot be smaller than 1 millisecond. This parameter has no effect unless auto-pipeline
# is enabled.
auto-pipeline-interval = 10 milliseconds
# Sets the name of the timer thread responsible for scheduling the execution of pipelines.
# The "$p" (pool number) variable can be used in the pattern and will be replaced at runtime.
# This parameter has no effect unless auto-pipeline is enabled.
timer-thread-naming-pattern = "scredis-$p-pipeliner"
# The default executors are CachedThreadPools with a maximum number of concurrent tasks.
executors {
# The internal thread pool is the one scredis uses to run asynchronous commands.
# The following parameters have no effect if a custom execution context is provided with
# the Redis.withExecutionContext() factory method.
internal {
# Defines the maximum number of asynchronous tasks (single command or pipeline) that can run
# simultaneously before the executor starts blocking. This prevents OutOfMemory exceptions
# to occur under super high load scenarios where commands are queued faster than processed.
# This parameter basically determines the maximum number of threads that can be created.
max-concurrent = 8
# Sets the name of the threads in the thread pool.
# The "$p" (pool number) and "$t" (thread number) variable can be used in the pattern and
# will be replaced at runtime.
threads-naming-pattern = "scredis-$p-worker-$t"
# Determines whether all internal threads should be created as daemon threads.
#
# Daemon threads cannot prevent an application from terminating. When all non-daemon
# threads (such as the main thread) terminate, all daemon threads are automatically
# terminated and the application itself terminates. As a consequence, if Redis.quit()
# is not invoked before the application terminates, all queued or processing commands will
# be dropped.
#
# In contrast, non-daemon threads will prevent the application from terminating unless there
# is an explicit invocation of the Redis.quit() method (which will terminate all internal
# threads) or if the application is shutdown using System.exit().
daemon-threads = true
# Sets the priority of all threads in the thread pool.
# "min" - lowest priority
# "normal" - normal priority
# "max" - highest priority
threads-priority = normal
}
# The callback thread pool is used when registering callbacks on asynchronous commands.
# It is an implicit public member of the Redis instance, i.e. Redis.ec and can be imported
# as follows "import redis.ec". Note that the callback executor is lazily defined, meaning
# that it will only be initialized (and shutdown) if it is explicitly imported.
callback {
# Defines the maximum number of asynchronous tasks (single command or pipeline) that can run
# simultaneously before the executor starts blocking. This prevents OutOfMemory exceptions
# to occur under super high load scenarios where commands are queued faster than processed.
# This parameter basically determines the maximum number of threads that can be created.
max-concurrent = 16
# Sets the name of the threads in the thread pool.
# The "$p" (pool number) and "$t" (thread number) variable can be used in the pattern and
# will be replaced at runtime.
threads-naming-pattern = "scredis-$p-callback-$t"
# Determines whether all internal threads should be created as daemon threads.
#
# Daemon threads cannot prevent an application from terminating. When all non-daemon
# threads (such as the main thread) terminate, all daemon threads are automatically
# terminated and the application itself terminates. As a consequence, if Redis.quit()
# is not invoked before the application terminates, all queued or processing commands will
# be dropped.
#
# In contrast, non-daemon threads will prevent the application from terminating unless there
# is an explicit invocation of the Redis.quit() method (which will terminate all internal
# threads) or if the application is shutdown using System.exit().
daemon-threads = true
# Sets the priority of all threads in the thread pool.
# "min" - lowest priority
# "normal" - normal priority
# "max" - highest priority
threads-priority = normal
}
}
}
}