lundi 3 avril 2017

Best design pattern for organizing News Feed on ElasticSearch

We have an mobile app with 5 millions users and now we are trying to design news feed based on ES. The goal is to have an opportunity for creating posts and subscribing for another users. So we need to make a custom news feed for everyone.

After some researching and googling I found some popular ways that could be used in our use case.

  1. Creating index-per-user. I think it's not a good idea for us, cos it needs for inserting a new post for each of the indexes of subscribers. Also, what if we have 100 millions of users?

  2. Create one index for all posts. And then for each user we can create an alias with filter by user ids that he is subscribed to. But then we'll have to hip on many shards while creating news feed for user. So there is 3 way.

  3. Routing by userId. It's a similar to 2 way, but the difference is that we create an alias per user with routing by it's userId. The disadvantage is that for each post in our index there will be as many copies as how many people should take.

There are another patterns, that I've read. But I still have no clear vision - what will the best practice in our use case.

Also, we have an alternative to ES - Cassandra. But the decision is still in process.

Maybe someone could say his expertise in this question and give an advice. Critique is welcome too.

Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire