Action Items
- Explore Redis as in-memory data store to efficiently manage tasks
- Basic: Implement a global click counter for each user that rate limits them after 10 clicks in 10 seconds
- Rate Limit: Use a queue in Redis to store the request counts for each user
- Click Counting: Implement a task queue to handle click count as dispatched tasks
- Advanced: Create a collaborative whiteboard that multiple users can draw on
Retrospective
- Implementing the click counter was fairly easy
- Getting my head around how Redis works and how to implement stuff on it wasn’t hard but took some time
- The project asked us to use lists/queues but this is dumb and using a counter makes way more sense. I first implemented it with counter and it was trivial then I tried implementing it with lists and I could do it but it was very inefficient so I switched back to counters.
- Registering unique users and keeping track of individual user clicks in reddis took a lot of time. principally because I was trying to both register a user AND process their clicks in the same API call. I was trying to think of elaborate ways in which I could register the user variable and then also use it and was constantly running into the problem of redefining the user each time a click was made… it took me way too long to realise that I should seperate these two functions. So now a useeffect hook runs at the start of page load which calls a register-user API which create a unique user and stores them in redis, and then onclick another api call does the actual click counting for that user. much more elegant solution.
- Deploying a backend on railway is pretty easy. But connecting it to reddis is a bit tricky if you don’t know about shared variables. Deploying a frontend on railway SUCKs
- Deploying a frontend on vercel is really easy.
EOD Status Report
Blockers
- Was feeling tired and a little burnt out from lots of late nights - need some solid rest over the weekend
- Spent almost 2 hours trying to deploy the frontend on railway… gave up and switched to vercel - deployed in <5mins :)
Learning
- working with different aspects of redis: basic set/get, counters, lists and queueing, rate limiting
- deploying a redis db on the cloud and connecting backend to it
Wins
- Got the project deployed - backend and redis on railway + vite frontend on vercel
- Getting faster at deployments now
PRs
- Rate Limited Clicker: https://github.com/fractal-bootcamp/malin.redis/pull/1
- Get Backend to Allocate uuid to each client that connects: https://github.com/fractal-bootcamp/malin.redis/pull/2
- Config prep for deployment: https://github.com/fractal-bootcamp/malin.redis/pull/3
- Address Reddis connection issues: https://github.com/fractal-bootcamp/malin.redis/pull/4
- backend deployed: https://github.com/kmankan/malin.redis.backend/deployments/production
- frontend deployed: https://github.com/kmankan/malin.redis.frontend