Simulate a join


I am developing a realtime app with PHP + Node.js + MySQL + Aerospike (…).

I have all users data in MySql and I save chat messages in Aerospike. But, I store this messages only with the user_id.

Now, I need to load this messages with node.js (from aerospike) but I need users data from mySQL. What do you guys advice me:

  • cache in aerospike all users name, user_name, image, user_id. This way I need to simulate some kind of join in aerospike : user <-> message ON user_id. How to do it?
  • Get messages and then get users data from MySQL (I can do it with a single query using user_id indexs - select user_id, title, user_name, image from users where user_id IN (1,2,3,4,5)). (Or maybe I can do this second query on the aerospike users cache?);
  • store all user data on the “message” bin and update it all each time users change their name or image (Probably the best option);
  • Any other options;

Thank you for your support.


I ll stop using Aerospike and get back to Cassandra. I think this community need to get mature first. Aerospike node models have a lot o high risk vulnerabilities.

I ll be back later.


Aerospike does have a join feature in the client, but I don’t see that its present for NodeJS… I think your post may be a bit confusing, because I don’t feel like I understand exactly what the app looks like. Can you maybe elaborate a bit on what this app should look like, and explain the limitations (Show xx number of messages, retain for xx days, etc…) and expectations (display history, searchability, etc), so that we can understand the relationships? We’re happy to help, but the first few times I’ve read this I am a bit confused on how to advise since I feel as though info is missing. Also curious what you mean by ‘node models have lot of high risk vulnerabilities’ can you elaborate there, too? Thanks!