All processes will append docs to insert to a queue which will be consumed by the writer process.
This helps prevent the write-write conflict / locking over the db updates which could result in dedup conflicts.
Would also simplify writing to file if all docs written pass through the queue.
Writer process will need to be extremely efficient though in order to handle thousands of docs/second.