Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store data related to members of groups in a forum, using Cassandra?

Hii there,

My question is related to Groups in a forum, very much similar to the LinkedIn Groups.

How would you store the list of all users in a group in a discussion forum?...and when the size of groups are quite large like in tens of thousands members in a group ?

Also how can you find the mutual connections of the user in that group ?

like image 365
Rajat Gupta Avatar asked Dec 29 '25 01:12

Rajat Gupta


1 Answers

I suggest doing this as one row per group, with a column for each member of the group. This will work well for any number of users in the group.

Regarding finding "mutual connections", the simplest way to handle this is to scan through the second user's connections and compare the two.

Here's an alternate strategy: assume that we want to find all of the mutual connections for user 'A' in group 'G'. If the columns in the A's connection row use the connections' usernames (or user ids) as the the column names, you can do (in pycassa syntax):

group_members = GROUPS.get('G').keys()
group_members.remove('A')
user_connections = USERS.get('A').keys()
mutual_connections = USERS.multiget(group_members, columns=connections)

Basically, this will go to a row for each user in the group and pull out only the columns that correspond to the original user's connections. This will move the work from the client to Cassandra, but it's hard to tell how much extra work this would be for Cassandra without a performance test.

like image 151
Tyler Hobbs Avatar answered Dec 30 '25 20:12

Tyler Hobbs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!