Redis 官网 redis.io 昨日罕见地宕机了一段时间。宕机原本不是什么新鲜事,但戏剧性的是网站的报错信息居然是连接不上 Redis。
Redis::CannotConnectError at / Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
![Redis 官网宕机:错误提示无法连接 Redis](https://wpfile.debian.cn/uploads/2020/03/956687.png)
▲ 看到这,忍不住刷一句:禁止套娃!
Redis 作者 Antirez 很快修复了问题,并解释了宕机的原因。原来是因为他最近在运行 redis.io 的实例上安装了 Try Redis(用于在线体验 Redis 数据库),可能是未能对 session key 进行良好的垃圾回收,从而导致内存累积,最终因为内存溢出(OOM )引发宕机。对此,Antirez 表示这种情况只是由于实例的内存不足而导致的。所以他的解决方案也十分直接,升级为 $20/月,4G 内存的实例。另外还为 allkeys-lru 策略配置了 1GB 内存的限制。
However lately I installed http://try.redis.io there. And apparently it does not garbage collect the session keys well enough or something like that. So memory accumulated and the instance quit for OOM, but this probably only happened because the instance is very low on mem.
via https://twitter.com/antirez/status/1238132868137787392TLDR, today I’m going to resize it to a 4GB instance for 20$/month. Looks like a good upgrade 😀 Maybe the site will be faster too, even if it was quite fast actually, already. Lessons: if you use Redis as your store, you can do a lot with very little.
via https://twitter.com/antirez/status/1238132885762211841
我们也由此得知一个出乎大家意料的情况,Redis 官网居然运行在一台仅 $5/月,内存 1G 的 DigitalOcean 虚拟主机(Droplet)上,这也是 DigitalOcean 提供的最低(标准)配置。
Today http://Redis.io went down for some time, sorry about this problem, http://Redis.io is running in a $5 / month droplet at@digitalocean. I was a bit too cheap on that 🙂 But since it uses Redis as its main store + a Ruby app, this was enough.
via https://twitter.com/antirez/status/1238132866682359813
Antirez 解释道,选择这么便宜的配置是因为这台主机使用了 Redis 作为持久存储,并且只跑了一个 Ruby 应用(点此查看源码),所以已经足够应对。