I want to store user's profiles in redis, as I have to frequently read multiple user's profiles.. there are two options I see at present:
Option 1: - store separate hash key per user's profile
- [hash] - u1 profile {id: u1, name:user1, email:user1@domain.com, photo:url}
- [hash] - u2 profile {id: u2, name:user2, email:user2@domain.com, photo:url}
- where for every user's id is hash key and profile field and values JSON-serialized profile objects. (OR instead of json user field-value pairs)
Option 2: - use single hash key to store all users profile
- [hash] - users-profile u1 {id: u1, name:user1, email:user1@domain.com, photo:url}
- [hash] - users-profile u2 {id:u2, name:user2, email:user2@domain.com, photo:url}
- where in users-profile hash key, user's ids field and values JSON-serialized profile objects.
Please tell me which option is best considering following:
- performance
- memory utilization
- read multiple user's profile - for batch processing I should able to read 1-100, 101-200 user's profile at time
- larger dataset - what if there are millions users profile