Search code examples
luaaerospike

Read list of records from aerospike


I have an index in aerospike whit a String key and a Numeric type bin is there any way to read from aerospike by a list of keys? if it is possible is there any limitation on list size? and is it more efficient to filter and read from aerospike by the list of keys or iterate on my key list and read one by one?


Solution

  • The batch API allows you to get a list of keys or digests. The maximum number of keys that can be requested at once per each node in the cluster is actually configurable through the max-batch-requests configuration parameter (default 5,000... so for a 10 node cluster, that would allow around 50K max).

    The API allows the use of expressions as well for filtering.

    Whether to use the batch API or iterate from the application one by one depends on a variety of factor, the main one probably being the size of the records. For smaller records (under 1KiB for example), the batch API should be more efficient as it would help reduce the network overhead of having to individually fetch records.