Hello there,
as the title suggests, I'm intrigued on implementing an app with social 
network side and I would like to ask the community your thoughts and past 
experiences on it.
Considering a generic scenario with people, follow/friend-relationships, 
contents, tags, likes and comments, I've got a couple of doubts:

1) retrieving personalized news feed.
Because every user is connected with a group of friends, user A will 
display a different stream of events compared to user B, user C etc.
Suppose a linked list of contents 
(userD-->LAST_POST-->content-->NEXT-->content).
While it's easy to navigate through a general user activity, userA newsfeed 
needs to:
- traverse all user's friends,
- go to their last content,
- order by date, 
- pick the first 20 results
- return to userA.

I found this article 
<https://blog.deimos.fr/2016/01/20/how-we-speed-up-news-feed-and-user-wall-display-using-elasticsearch/>
:
According to the author, "Direct access to the database is expensive, 40 
concurrent accesses and your server will become so slow than nobody will 
ever come back." I don't know where this magic number came from but 40 
looks like something you will face in early stages, not an issue for your 
next billion user base.

On the other hand, this older article 
<https://neo4j.com/blog/switching-mongodb-neo4j/> tells the opposite story: 
from other solutions to a pure Neo4j use.
So here the question.... Is Neo4j the right choice for consuming news feed 
or it should be paired with other technologies?


2) how to implement an infinite scrolling?  Suppose 20 friends with 10 
contents each. The first time we could ideally get their first degree 
content-node, but what about the next 20 results? Looking at the first node 
after NEXT relationship doesn't ensure they are the most recent ones. We 
could query for all the content-nodes and filter but it doesn't look 
efficient to me, especially if it's repeated many times by a user, 
multiplied by different users.

3) Likes or comments 
Given a content, users are able to like or comment it.
For likes I thought something (User)-[LIKED]->(Content) and for comments a 
linked list to read them chronologically ordered.
But what about a popular user that posts a new comment? I expect a lot of 
likes/comments in a short time that mean a lot of writes. 
In few months there will be also a lot of liked-relashionships in the 
graph. Are they somehow "heavy"?  And what about the count function to 
display the likes a content has? Is it cheap to perform?

It should be awesome reading a dedicated Neo4j blog post on these general 
questions, investigating what it really works with a graph db and what it 
does't fit because while it looks natural approaching graphs and social 
networks, it seams (to me) there's no resource out there to drive our 
decisions.

Hoping to hear community voice,
kind regards
Alessandro




-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to