There was some discussion about the performance of deleting journal entries which led to issue #30
https://github.com/sbtourist/Journal.IO/issues/30
I just wanted to share my feedback of this improvement.
My scenario is to use journal IO as a buffer between threads in an application server for handling audit log entries asynchronous to web activity.
Web-threads produce packed audit codes/references and then save to the journal and then signal the new journal location to a worker thread pool.
The worker pool uses a slave DB to transform references to human text for pretty audit log entries and then saves to the audit archive. The worker then deletes the audit entry from the journal.
Using
journal.io allows the web thread to finish quickly, knowing that the basic audit stamp is safe on disk for something to expand and archive later on.
I made a small test harness to evaluate the performance when I noticed that deleting journal entries was a fairly slow activity.
There was a significant lag between production of journal entries and the subsequent read+delete of each entry when a number of threads performed each activity.
_before_
> rev: b73ccf8
> N records: 50000
> writers: 1
> readers: 1
> records size 104 bytes
> physical sync: true
Time to complete production: 3076s
Time to complete consumption: 3652s
Consumption/Production Lag: 576s
_after_
> rev: ead66d0
> N records: 50000
> writers: 1
> readers: 1
> records size 104 bytes
> physical sync: true
Time to complete production: 2970s
Time to complete consumption: 2970s
Consumption/Production Lag: 0s
So, the main benefit for my example here - which mirrors my requirements - is that the code for this commit has decreased the overhead for deleting so much that there is now no lag.
Many thanks for this effort Sergio. We are very grateful.