我正在考虑 Redis 支持的 Web 应用程序,但我不确定 Redis 的硬件要求,或者确切地说 Redis 是如何“工作”的?
我是 Redis 的新手,因为……我真的不确定它是如何工作的。但我正在考虑将其用于具有相对简单的数据结构的网络应用程序,该应用程序可以受益于 Redis 的速度。问题是这个应用程序最终可能会获得数百万行。由于 Redis 是“内存中”和“磁盘支持”,这是否意味着我需要足够的内存来存储这数百万行值?或者它只将最近或经常访问的值加载到内存中?
我正在考虑什么样的硬件要求?有人有 Redis 和硬件使用的真实示例吗?
I'm new to Redis, as in... I'm really not sure how it works. But I'm considering it for a web app with a relatively uncomplicated data structure that could benefit from Redis' speed. The thing is this app could end up getting millions and millions of rows. Since Redis is "in-memory" and "disk backed" does that mean I'm going to need enough memory to sport these millions of rows of values? Or does it only load values into memory that are recently or commonly accessed?
What sort of hardware requirements am I looking at? Does anyone have any real-world examples of Redis and hardware usage?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Redis 以出色的方式处理内存。首先有几点需要指出。 Redis如果在32位系统下编译会使用较少的内存,但最大内存使用量为4GB。至于您的硬件要求,这完全取决于您存储的数据类型。如果您存储一百万个键,但其中只有 8 个字符的字符串,则内存使用量将比 16 个字符的字符串低很多。底线;如果您在内存中存储 100 万个密钥,大致内存使用量可能约为 1GB。我说可能是因为有很多因素。你有虚拟内存吗?所有的钥匙都经常被访问吗?钥匙有多大。 这里有一篇很棒的文章,介绍了提高 Redis 内存使用率的方法
如果您使用磁盘后端,那么只有最常访问的键才会存储在内存中。您可能有 1GB 的数据,但内存中只能存储 100Mb。 请参阅此处了解更多信息
对于硬件,需要大量 RAM。
Redis handles memory in a great way. There are a few things to point out first. Redis will use less memory if compiled under a 32-bit system, but the maximum memory usage is 4GB. As for your hardware requirements, it all depends on why kind of data you are storing. If you are storing a million keys, but they only have a 8 character string inside it, the memory usage will be a lot lower than a 16 character string. The bottom line; If you are storing 1 million keys in memory, the ballpark memory usage might be around 1GB. I say might because there are a number of factors. Do you have virtual memory? Are all the keys access often? How big are the keys. There is a great post here that describes ways to improve redis memory usage
If you use the disk backend, then only the most frequently accessed keys will be stored in memory. You might have 1GB of data, but only 100Mb could be stored in memory. See here for more info
For hardware, lots of Ram.