grey-software / toonin

Technology that allows you to tune in to your friends and family in realtime using peer-to-peer sharing.
https://toonin.grey.software
MIT License
67 stars 6 forks source link

Explore and integrate Redis to keep track of rooms #173

Open alir128 opened 4 years ago

alir128 commented 4 years ago

It might be a good idea to add redis to store rooms on memory on the backend.

https://www.brainvire.com/can-redis-help-improving-node-js-app-performance/

Lakshya2610 commented 4 years ago

I was looking into this a while back. I'll research a bit more about it and try and get it working

alir128 commented 4 years ago

https://aws.amazon.com/blogs/database/how-to-build-a-chat-application-with-amazon-elasticache-for-redis/

Lakshya2610 commented 4 years ago

@ArsalaBangash I integrated socket.io-redis recently in a project. So, I can integrate it into toonin's backend (if you still wanna do it). But we would need a redis database to make use of socket.io-redis. We can either host the database ourselves or use Redis Labs' free online cloud service (It has a free limit of 30 MB if I remember correctly).

You can check out all the options here: https://redis.io/download

If we want to deploy the database ourselves, we can get Docker image from the link above and get it running. I have personally used the free version of the cloud service, and it seems to work well. And it would be the easiest and fastest way to implement this.

alir128 commented 4 years ago

@Lakshya2610 https://elements.heroku.com/addons/heroku-redis we can just use this as an add-on with our current deployment, this gives 25MB storage which should be enough.

Lakshya2610 commented 4 years ago

Yeah, it should be fine. Can you set that up and send me the credentials for the redis host. I need these values and I can get it running image

Lakshya2610 commented 3 years ago

So, sorry for the late update. I have been really busy and this totally slipped from my mind. I tried integrating socket.io-redis on the backend but I realized that there is a problem. We can offload the socket rooms to the redis server to allow for scaling, but the socket rooms aren't the only things that we need to offload. Our backend relies on other data structures and classes to manage rooms and clients, so we would need to offload those to a database or a common server as well (could use MongoDB for this). @ArsalaBangash @alir128 What do you guys think about this? Keep in mind that adding MongoDB on the backend would require major changes on the backend.