Redis 官網昨日宕機,錯誤提示為無法連接Redis
Redis官網 redis.io 昨日罕見地宕機了一段時間。宕機原本不是什麼新鮮事,但戲劇性的是網站的報錯信息居然是連接不上Redis。Redis作者Antirez很快修復了問題,並解釋了宕機的原因。
Redis::CannotConnectError at / Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
▲ 看到這,忍不住刷一句:禁止套娃!
原來是因為他最近在運行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/1238132868137787392
TLDR, 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.
我們也由此得知一個出乎大家意料的情況,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.
Antirez解釋道,選擇這麼便宜的配置是因為這台主機使用了Redis作為持久存儲,並且只跑了一個Ruby應用(點此查看源碼),所以已經足夠應對。