32-bit Redis
In the official documentation on Redis.io's website on Memory Optimization3, one suggestion is to compile Redis in 32-bit mode instead of using the default 64 bit instance.
Using a 32-bit Redis instances for datasets under 3 GB is smaller than the same dataset in the 64-bit version of Redis. This can be illustrated in the following tests. We'll launch two Redis instances, INSTANCE64
and INSTANCE32
. We'll create a quick Python function, test_redis_32k_65k
, in a Python command line to create 100,000 keys using a UUID as a string value:
>>>def test_redis_32k_64k(): for i in range(100000): key = "uuid:{}".format(i) value = uuid.uuid4() INSTANCE32.set(key, value) INSTANCE64.set(key, value) >>> test_redis_32k_64k()
To see what happens to the memory usage of 32-bit verses 64-bit type of Redis instances, we'll compare the output of two Redis-cli sessions by connecting to each instance.
For the Redis 32-bit instance:
127...