Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Redis as frontend database to postgres #3

Open
aquibbaig opened this issue Jan 15, 2020 · 8 comments
Open

Redis as frontend database to postgres #3

aquibbaig opened this issue Jan 15, 2020 · 8 comments
Assignees
Labels
for the future Will be a feature in future iterations

Comments

@aquibbaig
Copy link
Member

aquibbaig commented Jan 15, 2020

We will have Redis for session management as a cache db because of the fact that it is in-memory and very fast, here it may/may not write out things to postgres, depends upon if we want session data to persist within the postgres db. [subject to discussion]

@aquibbaig aquibbaig self-assigned this Jan 15, 2020
@ankitjena
Copy link
Collaborator

It won't be on the frontend.

@aquibbaig
Copy link
Member Author

aquibbaig commented Jan 16, 2020

Rephrasing: "a frontend database" is meant as a web server front end (here).

@ankitjena
Copy link
Collaborator

ankitjena commented Jan 16, 2020

How would you do that? Why would you do that. Redis will run in the backend.

@aquibbaig
Copy link
Member Author

Okay. Allow me to explain.

@aquibbaig
Copy link
Member Author

Benefits of adding "Redis" to our tech stack:

  1. Persistence into a large data store should only facilitate a limited number of joins as your data grows larger. Hence even simple requests such as fetching a user for a session implementation becomes very expensive. Our stack has a lot of data joins and column updation after each iteration of an event is completed by the user. (See docs). For example: A table join can be of Campaign game mode with Users using a foreign-key such as "score" to display Top-scorers in a campaign.

  2. As a suggestion, use Redis for in-memory caching where the requests land in to the database only and only if they aren't found on the cache. "Hash-Tables" may offer us O(1) search complexity.

  3. I think we are on the same page here, regarding Redis will run in the backend(my statement was misleading to you perhaps). Redis is run on the web-server as a frontend tool(and the web server is the backend itself). The database requests hit Redis first and if not found here, they go to the main data store. You can use the IO writer and distributed lock system to synchronously write your data into the larger database such as PostGres.

  4. Regarding implementations, I'm not quite sure and have to see documentations. But here are some articles, if they may help you well and fine:

Please correct me if I am wrong anywhere. That's my perspective about how things can be easier to scale on a longer run. Thanks!

@aquibbaig
Copy link
Member Author

@ankitjena I am open to healthy discussions in this regard. Shoot me up!

@ankitjena
Copy link
Collaborator

@aquibbaig I was clarifying that redis is a in mem DB and not a frontend tool. Not against it. Using frontend with Redis was misleading, yes.

@aquibbaig
Copy link
Member Author

@ankitjena We can work on this later after we have set up a basic layout first. This is scalability which can be extended further. What we can do is use Redis pub/sub with our Postgres db, hence adding a for the future label

@aquibbaig aquibbaig added the for the future Will be a feature in future iterations label Jan 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
for the future Will be a feature in future iterations
Projects
None yet
Development

No branches or pull requests

2 participants