This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./redis-trib.rb call 192.168.1.11:7000 info | grep memory_human | |
used_memory_human:11.42M | |
used_memory_human:9.78M | |
used_memory_human:9.12M | |
used_memory_human:12.43M | |
used_memory_human:11.45M | |
used_memory_human:11.42M | |
used_memory_human:12.44M | |
used_memory_human:10.99M | |
used_memory_human:12.43M |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNESCAPES = { | |
'a' => "\x07", 'b' => "\x08", 't' => "\x09", | |
'n' => "\x0a", 'v' => "\x0b", 'f' => "\x0c", | |
'r' => "\x0d", 'e' => "\x1b", "\\\\" => "\x5c", | |
"\"" => "\x22", "'" => "\x27" | |
} | |
puts UNESCAPES.keys.join | |
#exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Starting sentinel #0 at port 20000 | |
Starting sentinel #1 at port 20001 | |
Starting sentinel #2 at port 20002 | |
Starting sentinel #3 at port 20003 | |
Starting sentinel #4 at port 20004 | |
Starting redis #0 at port 30000 | |
Starting redis #1 at port 30001 | |
Starting redis #2 at port 30002 | |
Starting redis #3 at port 30003 | |
Starting redis #4 at port 30004 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* vmlatency.c | |
* | |
* Measure max latency of a running process that does not result from | |
* syscalls. Basically this software should provide an hint about how much | |
* time the kernel leaves the process without a chance to run. | |
* | |
* Copyright (C) 2014 Salvatore Sanfilippo. | |
* This software is released under the BSD two-clause license. | |
* | |
* compile with: cc vmlatency.c -o vmlatency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ lsof -p 96144 | |
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME | |
tclsh8.5 96144 antirez 10u IPv4 0xee68e5eeb7bbc4d3 0t0 TCP localhost:53651->localhost:21212 (SYN_SENT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wc -l *.[ch] | grep -v total | sort -rn > /tmp/loc.txt | |
3696 cluster.c | |
3560 sentinel.c | |
3166 redis.c | |
2219 t_zset.c | |
1826 replication.c | |
1819 config.c | |
1633 redis-cli.c | |
1557 networking.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Return the UNIX time in microseconds */ | |
long long ustime(void) { | |
struct timeval tv; | |
long long ust; | |
gettimeofday(&tv, NULL); | |
ust = ((long long)tv.tv_sec)*1000000; | |
ust += tv.tv_usec; | |
return ust; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resp - Redis Encoding (and) Serialization Protocol | |
Nap - Non Ascii Protocol | |
Fixpre - (Joke on prefixed length protocol) | |
Bulex - BULk Exchange protocol | |
Asterdoll - (Joke on asterisk and dollar, two important characters) | |
Trinex - TRIvial NEtwork eXchange protocol | |
Qasp - Question-Answer simple protocol | |
Prest - from italian "protocollo estensibile di trasmissione" | |
Meux - as a tribute to Meucci (http://en.wikipedia.org/wiki/Antonio_Meucci) | |
Reasy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are five nodes, using master-slave replication. When we start A is the master. | |
The nodes are capable of synchronous replication, when a client writes, | |
it gets as relpy the number or replicas that received the write. A client | |
can consider a write accepted only when "3" or more is returned, otherwise | |
the result is not determined (false negatives are possbile). | |
Every node has a serial number, called the replication offset. It is always | |
incremented as the replication stream is processed by a replica. Replicas | |
are capable of telling an external entity, called "the controller", what |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <sys/types.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <time.h> | |
void combsort(long long *a, size_t l) { | |
size_t j; | |
size_t gap = l > 1 ? l / 2 : 1; |