2244 Commits

Author SHA1 Message Date
antirez
8cc912db43 LATENCY GRAPH: filling under the curve is more readable. 2014-07-09 19:57:42 +02:00
antirez
e905588062 LATENCY GRAPH implemented. 2014-07-09 19:57:37 +02:00
antirez
b38996aab1 latencyTimeSeries structure max field type fixed. 2014-07-09 19:57:34 +02:00
antirez
062564c261 Free labels in freeSparklineSequence(). 2014-07-09 19:57:28 +02:00
antirez
d20d89e630 LATENCY LATEST: add the max field. 2014-07-09 19:57:22 +02:00
antirez
dc1c91a8bf Latency monitor trheshold value is now configurable.
This commit adds both support for redis.conf and CONFIG SET/GET.
2014-07-09 19:57:17 +02:00
antirez
350792bd72 ASCII sparklines generation API. 2014-07-09 19:57:08 +02:00
antirez
ed95915d33 License added to latency.h. 2014-07-09 19:56:47 +02:00
antirez
34afc91030 Latency monitor turned off by default.
It is not a good idea to bloat the code with gettimeofday() calls if the
instance is working well, and turning monitoring on at runtime is a
joke.
2014-07-09 19:56:43 +02:00
antirez
35a62f7408 Latency monitor: more hooks around the code. 2014-07-09 19:56:43 +02:00
antirez
855c97ce1b Latency monitor: don't add new samples in the same second.
Instead we update the old sample with the new latency if it is greater.
2014-07-09 19:56:35 +02:00
antirez
3cb03b68a4 LATENCY LATEST implemented. 2014-07-09 19:56:30 +02:00
antirez
e400ae60f5 Latency monitor: command duration is in useconds. Convert. 2014-07-09 19:04:02 +02:00
antirez
a57eb3272d LATENCY SAMPLES implemented. 2014-07-09 19:03:59 +02:00
antirez
72c84acc99 Latency monitor: collect slow commands.
We introduce the distinction between slow and fast commands since those
are two different sources of latency. An O(1) or O(log N) command without
side effects (can't trigger deletion of large objects as a side effect of
its execution) if delayed is a symptom of inherent latency of the system.

A non-fast command (commands that may run large O(N) computations) if
delayed may just mean that the user is executing slow operations.

The advices LATENCY should provide in this two different cases are
different, so we log the two classes of commands in a separated way.
2014-07-09 19:03:26 +02:00
antirez
58ecc0bd68 Latency monitor: basic samples collection. 2014-07-09 18:57:57 +02:00
antirez
0baab66d16 Fixed 2.8 build breakage introduced back porting COMMAND. 2014-07-02 22:42:00 +02:00
antirez
670cf9598e Fix Solaris compilation due to ctime_r() call.
Introduced in Redis 2.8.10 because of a change in Sentinel.
This closes issue #1837.
2014-06-30 16:29:14 +02:00
antirez
63feb93a9f COMMAND COUNT subcommand added. 2014-06-27 18:38:08 +02:00
antirez
0a6649a7c0 COMMAND: fix argument parsing.
This fixes detection of wrong subcommand (that resulted in the default
all-commands output instead) and allows COMMAND INFO to be called
without arguments (resulting into an empty array) which is useful in
programmtically generated calls like the following (in Ruby):

    redis.commands("command","info",*mycommands)

Note: mycommands may be empty.
2014-06-27 18:38:08 +02:00
antirez
53377f8c6d COMMANDS command renamed COMMAND. 2014-06-27 18:38:03 +02:00
antirez
f3efd529df COMMANDS command: remove static + aesthetic changes.
Static was removed since it is needed in order to get symbols in stack
traces. Minor changes in the source code were operated to make it more
similar to the existing Redis code base.
2014-06-27 18:37:34 +02:00
Matt Stancliff
fdc5dbd5b1 Cluster: Add COMMANDS command
COMMANDS returns a nested multibulk reply for each
command in the command table.  The reply for each
command contains:
  - command name
  - arity
  - array of command flags
  - start key position
  - end key position
  - key offset step
  - optional: if the keys are not deterministic and
    Redis uses an internal key evaluation function,
    the 6th field appears and is defined as a status
    reply of: REQUIRES ARGUMENT PARSING

Cluster clients need to know where the keys are in each
command to implement proper routing to cluster nodes.

Redis commands can have multiple keys, keys at offset steps, or other
issues where you can't always assume the first element after
the command name is the cluster routing key.

Using the information exposed by COMMANDS, client implementations
can have live, accurate key extraction details for all commands.

Also implements COMMANDS INFO [commands...] to return only a
specific set of commands instead of all 160+ commands live in Redis.
2014-06-27 18:37:29 +02:00
Matt Stancliff
cd4f0dc775 Allow __powerpc__ to define HAVE_ATOMIC too
From mailing list post https://groups.google.com/forum/#!topic/redis-db/D3k7KmJmYgM

In the file “config.h”, the definition HAVE_ATOMIC is used to indicate
if an architecture on which redis is implemented supports atomic
synchronization primitives.  Powerpc  supports atomic synchronization
primitives, however, it is not listed as one of the architectures
supported in config.h. This patch  adds the __powerpc__ to the list of
architectures supporting these primitives. The improvement of redis
due to the atomic synchronization on powerpc is significant,
around 30% to 40%, over the default implementation using pthreads.

This proposal adds __powerpc__ to the list of architectures designated
to support atomic builtins.
2014-06-27 18:36:59 +02:00
Matt Stancliff
58fea46976 Allow atomic memory count update with C11 builtins
From mailing list post https://groups.google.com/forum/#!topic/redis-db/QLjiQe4D7LA

In zmalloc.c the following primitives are currently used
to synchronize access to single global variable:
__sync_add_and_fetch
__sync_sub_and_fetch

In some architectures such as powerpc these primitives are overhead
intensive. More efficient C11 __atomic builtins are available with
newer GCC versions, see
http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/_005f_005fatomic-Builtins.html#_005f_005fatomic-Builtins

By substituting the following  __atomic… builtins:
__atomic_add_fetch
__atomic_sub_fetch

the performance improvement on certain architectures such as powerpc can be significant,
around 10% to 15%, over the implementation using __sync builtins while there is only slight uptick on
Intel architectures because it was already enforcing Intel Strongly ordered memory semantics.

The selection of __atomic built-ins can be predicated on the definition of ATOMIC_RELAXED
which Is available on in gcc 4.8.2 and later versions.
2014-06-27 18:36:59 +02:00
Matt Stancliff
ff3ca17bac Use predefined macro for used_memory() update 2014-06-27 18:36:59 +02:00
antirez
60ff8095d6 No more trailing spaces in Redis source code. 2014-06-26 18:52:16 +02:00
antirez
e9cd75dcd1 CLIENT KILL: don't kill the master as a normal client.
Technically the problem is due to the client type API that does not
return a special value for the master, however fixing it locally in the
CLIENT KILL command is better currently because otherwise we would
introduce a new output buffer limit class as a side effect.
2014-06-26 18:43:42 +02:00
antirez
ac6b656fd6 Old form of CLIENT KILL should still allow suicide. 2014-06-24 12:49:18 +02:00
antirez
32ebb3e651 Redis 2.8.12. 2014-06-23 16:56:18 +02:00
antirez
d3c2918434 Sentinel implementation of ROLE. 2014-06-23 12:07:55 +02:00
antirez
95f492ee57 Silence different signs comparison warning in sds.c. 2014-06-23 11:53:50 +02:00
Matt Stancliff
8066334986 Sentinel: bind source address
Some deployments need traffic sent from a specific address.  This
change uses the same policy as Cluster where the first listed bindaddr
becomes the source address for outgoing Sentinel communication.

Fixes #1667
2014-06-23 11:53:40 +02:00
Matt Stancliff
e59eef246b Add REDIS_BIND_ADDR access macro
We need to access (bindaddr[0] || NULL) in a few places, so centralize
access with a nice macro.
2014-06-23 11:53:25 +02:00
Matt Stancliff
ed705f4789 Cancel SHUTDOWN if initial AOF is being written
Fixes #1826 (and many other reports of the same problem)
2014-06-23 10:09:25 +02:00
antirez
2b805ce119 Allow to call ROLE in LOADING state. 2014-06-21 15:29:12 +02:00
antirez
8c460a2872 ROLE command: array len fixed for slave output. 2014-06-21 15:29:11 +02:00
antirez
7d0992dad6 Sentinel: send SLAVEOF with MULTI, CLIENT KILL, CONFIG REWRITE.
This implements the new Sentinel-Client protocol for the Sentinel part:
now instances are reconfigured using a transaction that ensures that the
config is rewritten in the target instance, and that clients lose the
connection with the instance, in order to be forced to: ask Sentinel,
reconnect to the instance, and verify the instance role with the new
ROLE command.
2014-06-21 15:27:57 +02:00
antirez
674194ad42 CLIENT KILL API modified.
Added a new SKIPME option that is true by default, that prevents the
client sending the command to be killed, unless SKIPME NO is sent.
2014-06-21 15:27:57 +02:00
antirez
61d9a73d87 CLIENT KILL: fix closing link of the current client. 2014-06-21 15:27:57 +02:00
antirez
09dc6dadc1 New features for CLIENT KILL. 2014-06-21 15:27:57 +02:00
antirez
cad13223f0 Assign an unique non-repeating ID to each new client.
This will be used by CLIENT KILL and is also a good way to ensure a
given client is still the same across CLIENT LIST calls.

The output of CLIENT LIST was modified to include the new ID, but this
change is considered to be backward compatible as the API does not imply
you can do positional parsing, since each filed as a different name.
2014-06-21 15:27:53 +02:00
antirez
b6a26b52bf Client types generalized.
Because of output buffer limits Redis internals had this idea of type of
clients: normal, pubsub, slave. It is possible to set different output
buffer limits for the three kinds of clients.

However all the macros and API were named after output buffer limit
classes, while the idea of a client type is a generic one that can be
reused.

This commit does two things:

1) Rename the API and defines with more general names.
2) Change the class of clients executing the MONITOR command from "slave"
   to "normal".

"2" is a good idea because you want to have very special settings for
slaves, that are not a good idea for MONITOR clients that are instead
normal clients even if they are conceptually slave-alike (since it is a
push protocol).

The backward-compatibility breakage resulting from "2" is considered to
be minimal to care, since MONITOR is a debugging command, and because
anyway this change is not going to break the format or the behavior, but
just when a connection is closed on big output buffer issues.
2014-06-21 15:27:12 +02:00
antirez
8060de98f8 ROLE output improved for slaves.
Info about the replication state with the master added.
2014-06-21 15:27:12 +02:00
antirez
41a15205b6 ROLE command added.
The new ROLE command is designed in order to provide a client with
informations about the replication in a fast and easy to use way
compared to the INFO command where the same information is also
available.
2014-06-21 15:27:12 +02:00
antirez
d8d415e717 CLIENT LIST speedup via peerid caching + smart allocation.
This commit adds peer ID caching in the client structure plus an API
change and the use of sdsMakeRoomFor() in order to improve the
reallocation pattern to generate the CLIENT LIST output.

Both the changes account for a very significant speedup.
2014-06-21 15:27:08 +02:00
antirez
52189cb9c3 Use sdscatfmt() in getClientInfoString() to make it faster. 2014-06-21 15:27:02 +02:00
antirez
4acc3daa92 Added new sdscatfmt() %u and %U format specifiers.
This commit also fixes a bug in the implementation of sdscatfmt()
resulting from stale references to the SDS string header after
sdsMakeRoomFor() calls.
2014-06-21 15:26:58 +02:00
antirez
3a915ace44 sdscatfmt() added to SDS library.
sdscatprintf() relies on printf() family libc functions and is sometimes
too slow in critical code paths. sdscatfmt() is an alternative which is:

1) Far less capable.
2) Format specifier uncompatible.
3) Faster.

It is suitable to be used in those speed critical code paths such as
CLIENT LIST output generation.
2014-06-21 15:26:54 +02:00
antirez
93ee0f2666 Sentinel: send hello messages ASAP after config change.
Eventual configuration convergence is guaranteed by our periodic hello
messages to all the instances, however when there are important notices
to share, better make a phone call. With this commit we force an hello
message to other Sentinal and Redis instances within the next 100
milliseconds of a config update, which is practically better than
waiting a few seconds.
2014-06-19 15:25:57 +02:00