Beautiful town Building, a little story is worth remembering.
6379 Merz The corresponding number on the phone keypad, and Merz was taken from the Italian girl Alessia Merz's name.
Merz has long been synonymous with Antirez and his friends as stupidity.
NND It is too much to belittle him!!
Appendix:how to remember the Redis port number
Today on Twitter I saw a tweet related to the ability to remember the Redis port number. There is a trick, the Redis port number, 6379, isMERZAt the phone keyboard.
Is it a coincidence this it sounds not random enough? Actually not;) I selected 6379 because of MERZ, and not the other, the around.
Everything started with Alessia Merz, a Italian showgirl (make sure to check some (not safe for work) photo as well).
I and my friends are used to create our own slang, which is evolving since ... or years. Well one adjective this we use consistently since years are "Merz", but the meaning of the word changed so much in the C Ourse of the time.
Initially it started because we were really delighted by the stupidity of the sentences the showgirl is able to stat E in the Italian TV. So we started the using "MERZ" when something was ... stupid. "Hey, that ' s merz!". And so forth. Some time the meaning shifted in something stupid as pointless, but with very technical value, or with an IM Pressive amount of skills and patience and work involved, but still ... stupid.
The article is the http://oldblog.antirez.com/post/redis-as-LRU-cache.html
Redis as an LRU cacheFriday, October I See Redis definitely + as a flexible tool that as a solution specialized to solve a specific problem:his mixed s Oul of Cache, store, and messaging server shows this very well.
Redis as a cache used to work in the main ways:you could either set a time to live to cached entries. If you tune the TTL well enough, and you know how many new objects is created every second, you can avoid Redis using mor E than a given amount of RAM.
Another-use Redis as a cache is the
maxmemory directive, a feature that allows specifying a maximum AM Ount of memory to use. When new data are added to the server, and the memory limit was already reached, the server would remove some old data delet ing a
volatile key, that's, a key with an EXPIRE (a timeout) set, even if the key was still far from expiring AUT Omatically.
The algorithm used is very simple, three random volatile keys be sampled, the key with the nearest expire time is REM Oved from the dataset. If There is not volatile keys in all the server returns an error, as a write operation is requested, we is already at T He memory limit specified by the user, and no volatile keys can is removed to make a for new data.Redis as an LRU cacheThe above solutions is far from being perfect. This is the main problems:
- With the first approach of setting a relatively short expire in order to balance the creation and destruction of objects T O Avoid using too much memory, there is always the risk of using too little or too much memory. Why deleting objects when there was no need to? And why using more memory than needed when was the creation rate of objects was over the expected value?
- MaxMemory was definitely better, but the purging algorithm of removing the key with the nearest TTL is not optimal with M Any applications where a LRU algorithm can work better. Most of the time you end setting the same TTL to all the keys, Turing the algorithm into actually random eviction. Fortunately random eviction is not a bad (and with some access pattern it's actually better than LRU) but there was de finitely to improve things.
- With both the solutions, setting a expire in every key was needed, and this costs memory in Redis. If we want to use of Redis as an LRU cache, and in general as a cache, every data inside the instance are a good candidate for Eviction, regardless of an expire set.
In Redis master (what would be named Redis 2.2 when would reach stability) there was already an LRU field in every Objec T used for Virtual Memory. Why isn't using it for the
cache mode as well? It was also the right time to fix the other problems mentioned here, so yesterday I started writing some code that's now Already merged in the master branch at GitHub.What ' s newThe new version of MaxMemory is actually composed of three different configuration directives:
maxmemory
bytes
This works as usually, specifying the max number of bytes to use. You can specify the as Kbytes, gigabytes and so forth as usually, like
maxmemory 2g.
maxmemory-policy
policy
This new configuration option was used to specify the algorithm (policy) to use when we need to reclaim memory. There is five different algorithms now:
- Volatile-lru Remove a key among the ones with an expire set, trying to remove keys not recently used.
- Volatile-ttl Remove a key among the ones with an expire set, trying to remove keys and short remaining time to L Ive.
- volatile-random Remove a random key among the ones with an expire set.
- Allkeys-lru like VOLATILE-LRU, but would remove every kind of key, both normal keys or keys with an expire set.
- allkeys-random like Volatile-random, but would remove every kind of keys, both normal keys and keys with an EXPI Re set.
maxmemory-samples
number_of_samples
The last config option was used to tune the algorithms precision. In order to save memory Redis just adds a (bits field to every object for LRU). When we need to remove a key we sample N keys, and remove the one, is idle for longer time. For default three keys be sampled, that's a reasonable approximation of LRU in the long run, and you can get more precis Ion at the cost of some more CPU time changing the number of keys to sample.
currently I ' m still testing this code carefully, but for sure even if it ' s little code, it's a major step forward in M Aking Redis a valuable caching solution.
Important Note: All the new features is compatible with the CONFIG command, so can set and get this para Meters at run time using CONFIG SET and CONFIG GET.
Appendix:how to remember the Redis port number
Today on Twitter I saw a tweet related to the ability to remember the Redis port number. There is a trick, the Redis port number, 6379, was
MERZ at the phone keyboard.
Is it a coincidence this it sounds not random enough? Actually not;) I selected 6379 because of MERZ, and not the other, the around.
everything started with Alessia Merz, a Italian showgirl (make sure to check some (not safe for work) photo as well).
I and my friends are used to create our own slang, which is evolving since ... or years. Well one adjective this we use consistently since years are "Merz", but the meaning of the word changed so much in the C Ourse of the time.
initially it started because we were really delighted by the stupidity of the sentences that the showgirl is able to State in the Italian TV. So we started the using "MERZ" when something was ... stupid. "Hey, that ' s merz!". And so forth. Some time the meaning shifted in something stupid as pointless, but with very technical value, or with an IM Pressive amount of skills and patience and work involved, but still ... stupid.
For instance creating a 3D map of your hometown by sampling the points with a GPS and a broken car going around for th E whole night, or analyzing tons of lottery data searching for biases, perfectly knowing that we'll never spend a single p Enny in a lottery ticket anyway, and so forth. "Merz" basically means ... hack value, but was also referred to people not just things, people the act in a funny it just For hack value, the or to is fun, and so forth.
So if I had to pick a port number for Redis I had no troubles, whatever number MERZ is at the phone, it is the Red is port number.
The origin of Redis port 6379