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.