Comments (6)
@face, sorry for the late response. To be honest, after building Orca, I realized using a relational database like Postgres would make more sense since almost all the data is related to each other. Unfortunately, I don't have time to do this refactoring at the moment.
I agree that having dozens of million users will cause scaling issues, but honestly, I don't think anyone is using Orca at that scale.
Anyway, if you are open to sending a PR improving the user model scalability, I'd be glad to review and merge it.
Thanks once again for the detailed issue!
from orca.
hi @face , if the app will have dozens of million active users there might be other issues, but I don't understand what do you suggest?
from orca.
@DimiMikadze I'm thinking cache only recent data in the User model (a page worth of data), then for subsequent pages do a query in the Follow document with indexed searches. Of course, apply this same logic to all models that cache references, not just the User model.
from orca.
Honestly, mongodb is not the best for graph relationships. This is a very interesting approach using a combination of persistence engines: https://neo4j.com/blog/neo4j-doc-manager-polyglot-persistence-mongodb/
from orca.
It's worse than I thought. Mongodb documents have a 16MB limit so follows would simply stop functioning before a user had millions of followers.
The neo4j is overkill, mongodb indexes on the join tables should work. I think we don't even need to cache any recent data in the user Model...just always query the join tables, like Follows. That is what mongo recommends for "One-to-Squillions": https://www.mongodb.com/developer/article/mongodb-schema-design-best-practices/#one-to-squillions
from orca.
Hi @DimiMikadze sorry my late response now, I'm on vacation again and playing with this problem.
The solution I came up with was tri database (didn't use orca so I can't open a PR :(. To summarize, this is what I did to have a solution that would scale to millions followers:
1. Use Postgres for auth and a source of truth for any data which must be 100% consistent.
2. Use Cassandra for all social data
3. Use Redis for caching
Postgres is one of the best sources of truth, but doesn't scale or shard well. Cassandra is great at scaling, sharding, and, grouping and finding "related" data. I had never used cassandra before but it's awesome. Although it's not a relational database, it's better at finding related data than a relational database. You can specify part of your combination key for a table to dictate how the data is sorted and written to disk. So when you search for related data, it is a pre-sorted column of data to read from the actual db files. You can't do relational things like joins in queries, so you pre-build structures like a user's feed in a table (which is ultimately what you want for performance and scale).
from orca.
Related Issues (20)
- Automatically close sidebar on a mobile phone when moving to another channel
- Display Post Create a component in the channels page for non-authenticated users
- Display new members in Right Sidebar
- Channel tap issue on mobile phones
- Automatically delete a post after deleting a channel
- Typescript Compile Error: 'typeof ObjectId' is not callable. HOT 1
- Make channels list sortable via drag and drop
- Social authentication
- Text cropping in the PostCard component on different resolutions. HOT 1
- Fix rendering of links in PostCard, Comment, and Message Chat components. HOT 4
- Laas setup HOT 1
- User mentions
- Text editor for post creation HOT 8
- comments, likes, posts, notifications and messages two way reference is not needed HOT 1
- Unhandled Runtime Error HOT 4
- There is an error deploying to HEROKU HOT 5
- Post with multi-images HOT 2
- Config CORS vercel/GCP HOT 2
- Property 'dehydratedState' does not exist on type '{}' deploying frontend to heroku
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orca.