Map in a single bin VS one bin per key of map

Hi

I am new to Aerospike and trying to use it my project. I have my data in a map, like this:

item1 => {key1 => val1, key2 => val2}

item2 => {key1 => val3, key2 => val4}

item3 => {key1 => val5, key2 => val6, key3 =>val7}

Here item1/item2/item3 are my keys. Values stored against them are further key value pairs.

So, I have two options I guess.

One way is to create separate bin for ‘key1’/‘key2’/‘key3’.

Second way is to create just a single bin, say ‘mybin’ and store entire value for item1/item2/item3 in that as a map.

My app will be always fetching the entire value of each item.

Also, I will be mostly using flash persistence.

I want my app to be read optimized. Which of these two approaches is better ? Please suggest.

If you want to only read a few items of the map each time, then it would make sense to keep the entries in separate bins. Please note though, that Aerospike has a limitation of # of unique bin-names for a namespace, of 32k. (See https://www.aerospike.com/docs/guide/FAQ.html)

If the items can be varying, and you’d want to read all the data back all the time, then it may make more sense to have a map.

In either case though, the full record will be read from the SSD each time for a read request.