chat system with orientdb

128 views
Skip to first unread message

Aris Alexis

unread,
Mar 26, 2015, 2:30:52 PM3/26/15
to orient-...@googlegroups.com
hi,

i am building a social network with many features and my main db is orient. would you also use orient for the chat system ? I know people are biased here haha :) but my questions is if the site grows a lot, wouldn't cassandra be a more logical solution since messages are not data that is very useful in a graph , meaning that it is not related to a lot of things other than the participants. I am always worried that I will make a database very cluttered if I put all the analytics and messaging in. (I am putting edges for user activity,views etc). I know that orient can handle trillions of records but I am not sure how a vertex with thousands of edges will behave.

thanks

Luca Garulli

unread,
Mar 26, 2015, 2:56:34 PM3/26/15
to orient-database
Hi Aris,
Actually we used OrientDB under out Support System for client where we have chat room, one per client. The best way we found to model this is by creating one class/cluster per chat. Example:

Chat_clent10
Chat_clent11
Chat_clent12
...

Since chat message are naturally ordered by date, and since OrientDB assigns incremental RIDs to records, you don't need an index at all. You can execute this query when the user logs in:

select from Chat_clent11 order by @rid desc limit 20

Note the bold part: when use "order by @rid desc", OrientDB open an iterator that starts from the end to the beginning. We called Inverse iterator. it's super fast and speed is not affected by database size. What about loading records of the previous page?

select from Chat_clent11 where @rid < #13:2342 order by @rid desc limit 20

Supposing your last @rid was #13:2342 (read from the previous query).

Hope it helps.
Lvc@


--

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

Aris Alexis

unread,
Apr 13, 2015, 8:48:18 AM4/13/15
to orient-...@googlegroups.com
Hi, yes it helps but I can only have 32,767 clusters in the database hence this number of users is that correct?

Luca Garulli

unread,
Apr 13, 2015, 9:04:32 AM4/13/15
to orient-...@googlegroups.com
Hi Aris,
If you have one chat per user, the answer is yes. This limitation will be removed with OrientDB 3.0 (summer 2015), so for now you could simply manage X databases. The good news is that each OrientDB server can handle thousands of DB.

Lvc@

--
Best Regards,

Luca Garulli
CEO at Orient Technologies LTD
the Company behind OrientDB

Reply all
Reply to author
Forward
0 new messages