I didn't choose yet the database, but I will have around 2 milions of rows with 2 columns. For each row I have to make computation and afterwards it should be marked as consumed (row should be deleted or another column of state should be updated). I don't know yet what is faster solution, but another threads should have concurrent access to this db and be able to check consumed rows and read another. I am thinking of SQLite as provider. Some pseudo code:
ExecutorService executor = Executors.newFixedThreadPool(7);
executor.execute(() -> {
// access database
// get state of last row (if locked get one before)
// get string if not consumed
// make computation
makeComputation(string)}); // db cannot be locked here, as it takes around 1-2 sec.
// update state or delete row
I don't know how to make transactions here to avoid sequential access to db or any storage. Perfomance is important.