I'm thinking about using Berkeley DB
as part of the backend for a highly concurrent mobile application. For my application, using Queue
's for their record level locking would be ideal. However, as stated in the title, I need to query and update data that would be conceptually modeled like Map<Number,Map<Number,Number>>
.
The outer key would reference a unique Item
, and the inner key would reference one of that Item
's metrics. The inner value would be a counter that I need to atomically increment, possibly very frequently. Hence, why record level locking is a desirable feature here. Ideally, record level would be analogous to Item
level in the data model.
The data would be used in the following two ways:
Add
<Number,Map<Number,Number>>
entry- Relatively infrequent
Batch incrementations of ~15 metrics atomically, in database, given an
Item
id and a list of metric idsThen, get that
Item
's metric map- Very frequent
The inner Map
should be able to grow, but it would not get larger than 200 entries.
And that's it.
Do you think Berkeley DB
would be suitable for this application of it?
Update:
Apparently, the schema of my data isn't clear enough so I'm going to break it down further.
An Item
, has many metrics, which each have one counter, i.e. one-to-(many-to-one) i.e. <Number,Map<Number,Number>>
But I have many Item
's, so what I need is a Map<Number,Map<Number,Number>>