Closed rymaju closed 4 years ago
For a bit more on why I think redis will work better as opposed to another caching solution like memcache see the memory management section of https://medium.com/@Alibaba_Cloud/redis-vs-memcached-in-memory-data-storage-systems-3395279b0941
Also, see https://redis.io/topics/faq for some explanations on why redis might be better than mongo or another db. We are prioritizing very fast read write speed, as we are essentially setting and getting for every poll and code update from every client in many rooms. We also want some kind of persistence so not all data is lost on crash. Timeouts (ttl) are also useful as we want rooms to expire. Redis seems to be the best solution for these challenges.
Currently we are using a standard Javascript object to store our roomData (see server.js). This is RAM intensive and will not scale well. Redis is a caching/db solution that provides many of the speed requirements we need as well as a ttl (timeout) feature that can remove the need for our cron job. Additionally, by having a module for our redis connection we can add features such as setting a max room limit or creating an endpoint returning a unique room id.