microsoftarchive / redis

Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes
http://redis.io
Other
20.82k stars 5.37k forks source link

Memory usage of Redis-64 (3.0.503) #512

Open cklutz opened 7 years ago

cklutz commented 7 years ago

Hi,

frankly, I don't even know if it is an issue or even expected behavior, but since I'm a bit at a loss I'd like to report the following observation.

Previously, we used Redis-64 version 2.8.17, no special configuration settings, except "maxmemory", which is set to "4gb". When starting this instance on a server (Windows Server 2008 R2, 128 GB RAM) it has the following memory usage:

    Virtual Memory:           6.375.632 K
    Private Bytes:               16.164 K
    Working Set:                 27.216 K

Especially the Virtual Memory usage seems to align nicely with the "maxmemory" setting choosen.

Now, when we use Redis-64 version 3.0.503 on the same hardware, it has the following memory usage:

   Virtual Memory:     1.073.813.028 K
   Private Bytes:          2.116.476 K
   Working Set:               22.860 K

Again, all observed values were directly after startup, no traffic / operations done so far (albeit the values don't change significantly after some days of uptime - we only do pubsub operations though).

Is that expected behavior or do I miss some configuration setting?

Update: One more detail: I just figured, that the maxmemory-policy is different: The 3.0.503 version is set to noeviction, the 2.8.17 version is set to volatile-lru.

Thanks, Christian

chester89 commented 7 years ago

Well, may be 2.8.17 was evicting keys and 3.0.503 does not? But that's still a large difference

cklutz commented 7 years ago

Yes quite a difference :-), and also there never are/were keys in the instances (see "all observed values were directly after startup,"). Also, in the meantime I tried with changing the maxmemory-policy to the same value for both instances - no difference in the results.

cklutz commented 7 years ago

OK, just as an "update". I just took the plain vanilla "Redis-x64-3.2.100.zip" from the "releases" and started redis-server.exe (no additional options no redis.conf file) yields the same memory usages.

Also, for reference, here are the info memory outputs of the original versions, again, both immediately after startup:

2.8.17:

# Memory
used_memory:4395040
used_memory_human:4.19M
used_memory_rss:4362128
used_memory_peak:4410160
used_memory_peak_human:4.21M
used_memory_lua:33792
mem_fragmentation_ratio:0.99
mem_allocator:dlmalloc-2.8

3.0.503

# Memory
used_memory:692128
used_memory_human:675.91K
used_memory_rss:655184
used_memory_peak:692128
used_memory_peak_human:675.91K
used_memory_lua:36864
mem_fragmentation_ratio:0.95
mem_allocator:jemalloc-3.6.0