redis和memcached是不是存储多少空间就占多少内存?
ringa_lee
ringa_lee 2017-04-27 09:02:23
0
2
882

这些内存数据库都是把数据放到内存里,作为缓存的话,是不是存储多少内容就占用多少内存呢?

比如我的Linux服务器是2G内存的,那使用他们作为缓存数据库,就不能缓存超过2G的内容呢?

ringa_lee
ringa_lee

ringa_lee

reply all(2)
某草草

It’s not about how much memory you save.

memcached’s caching mechanism
memcached uses the Slab Allocation memory allocation mechanism. You can read this article Memcached’s data storage method
This mechanism has a disadvantage. It divides the allocated memory into chunks (chuck) of a specific length, such as : Storing 70-byte data into 88-byte blocks results in a waste of 18 bytes

Memory allocation process

Redis will be added if needed or later.

给我你的怀抱

Yes. Because they are memory-based databases.

Although it can be transformed to use the disk to cache part of the data, doing so will lose its own meaning.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template