36 Commits

Author SHA1 Message Date
charsyam
9946ef70ea getting rid of duplicated code 2018-02-14 00:12:13 +09:00
Oran Agra
492d0570f9 fix to latency monitor reporting wrong max latency
in some cases LATENCY HISTORY reported latency that was
higher than the max latency reported by LATENCY LATEST / DOCTOR
2018-02-13 15:58:40 +02:00
antirez
7a20dc7919 Use SipHash hash function to mitigate HashDos attempts.
This change attempts to switch to an hash function which mitigates
the effects of the HashDoS attack (denial of service attack trying
to force data structures to worst case behavior) while at the same time
providing Redis with an hash function that does not expect the input
data to be word aligned, a condition no longer true now that sds.c
strings have a varialbe length header.

Note that it is possible sometimes that even using an hash function
for which collisions cannot be generated without knowing the seed,
special implementation details or the exposure of the seed in an
indirect way (for example the ability to add elements to a Set and
check the return in which Redis returns them with SMEMBERS) may
make the attacker's life simpler in the process of trying to guess
the correct seed, however the next step would be to switch to a
log(N) data structure when too many items in a single bucket are
detected: this seems like an overkill in the case of Redis.

SPEED REGRESION TESTS:

In order to verify that switching from MurmurHash to SipHash had
no impact on speed, a set of benchmarks involving fast insertion
of 5 million of keys were performed.

The result shows Redis with SipHash in high pipelining conditions
to be about 4% slower compared to using the previous hash function.
However this could partially be related to the fact that the current
implementation does not attempt to hash whole words at a time but
reads single bytes, in order to have an output which is endian-netural
and at the same time working on systems where unaligned memory accesses
are a problem.

Further X86 specific optimizations should be tested, the function
may easily get at the same level of MurMurHash2 if a few optimizations
are performed.
2017-02-20 17:29:17 +01:00
antirez
7e86bce6b0 zmalloc: zmalloc_get_smap_bytes_by_field() modified to work for any PID.
The goal is to get copy-on-write amount of the child from the parent.
2016-09-19 10:28:42 +02:00
antirez
c15cac0d77 RDMF: More consistent define names. 2015-07-27 14:37:58 +02:00
antirez
fa26d3dd63 RDMF: use client instead of redisClient, like Disque. 2015-07-26 15:20:52 +02:00
antirez
6a424b5e36 RDMF (Redis/Disque merge friendlyness) refactoring WIP 1. 2015-07-26 15:17:18 +02:00
antirez
aa3a3024d0 Fix iterator for issue #2438.
Itereator misuse due to analyzeLatencyForEvent() accessing the
dictionary during the iteration, without the iterator being
reclared as safe.
2015-03-04 11:48:19 -08:00
antirez
c752dc5adb Separate latency monitoring of eviction loop and eviction DELs. 2015-02-11 10:52:27 +01:00
Salvatore Sanfilippo
f2af27f04c Merge pull request #2197 from sunheehnus/sparkline
sparkline.c: mov label-ini into the AddSample Function
2014-12-09 11:27:40 +01:00
Sun He
c965d0425d sparkline.c: mov label-ini into the AddSample Function 2014-12-08 11:15:06 +08:00
antirez
dcab2c2f32 Fix non-linux builds error introduced with THP checks. 2014-11-14 17:13:35 +01:00
antirez
06401be3fb THP detection for LATENCY DOCTOR. 2014-11-12 11:17:12 +01:00
antirez
0775665453 THP detection / reporting functions added. 2014-11-12 10:43:32 +01:00
antirez
2e94ffb1d1 Remove warnings and improve integer sign correctness. 2014-08-13 11:44:38 +02:00
antirez
68d6eb6a3f Fix typo in LATENCY DOCTOR output. 2014-07-11 10:57:28 +02:00
antirez
49903897ef LATENCY HISTORY returns empty array if no data is available.
Previously we returned an error.
2014-07-10 16:20:40 +02:00
antirez
a1f3072ab5 Fixed a few missing newline in createLatencyReport(). 2014-07-09 16:45:40 +02:00
antirez
cdc44eaf1a createLatencyReport(): compile before commit avoids commits. 2014-07-08 17:17:08 +02:00
antirez
8dfa279c19 createLatencyReport(), fix mount option name. 2014-07-08 17:12:21 +02:00
antirez
5102269c5a createLatencyReport(): initialize all advices to zero. 2014-07-08 17:11:56 +02:00
antirez
a519c133a6 LATENCY DOCTOR first implementation complete. 2014-07-08 17:05:56 +02:00
antirez
d1e9441165 Fix analyzeLatencyForEvent() MAD computation. 2014-07-08 12:56:45 +02:00
antirez
b65c20e3ea LATENCY DOCTOR: initial draft and events summary output. 2014-07-08 11:31:46 +02:00
antirez
608c0051d6 Latency: low level time series analysis implemented. 2014-07-07 15:00:01 +02:00
antirez
84018db59c LATENCY SAMPLES renamed LATENCY HISTORY. 2014-07-07 12:35:24 +02:00
antirez
9269ddff7c LATENCY RESET implemented. 2014-07-07 12:34:54 +02:00
antirez
db90e562e7 Cast void* to char* to avoid waring in latencyCommand(). 2014-07-02 16:56:08 +02:00
antirez
0954e4ede9 Properly initialize min/max in latency.c. 2014-07-02 16:55:34 +02:00
antirez
d13384e7d3 LATENCY GRAPH: filling under the curve is more readable. 2014-07-02 16:37:53 +02:00
antirez
0039e2e996 LATENCY GRAPH implemented. 2014-07-02 16:31:22 +02:00
antirez
2127c8e8fa LATENCY LATEST: add the max field. 2014-07-02 12:40:38 +02:00
antirez
f765e5a698 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-01 17:12:09 +02:00
antirez
224b5add47 LATENCY LATEST implemented. 2014-07-01 16:17:33 +02:00
antirez
4ef47b48b0 LATENCY SAMPLES implemented. 2014-07-01 16:07:13 +02:00
antirez
eabdfb3e30 Latency monitor: basic samples collection. 2014-07-01 11:30:15 +02:00