lavinmq icon indicating copy to clipboard operation
lavinmq copied to clipboard

Reference count segments and delete when zero references

Open carlhoerberg opened this issue 4 years ago • 7 comments

Way faster than collecting references and hole punch segments. But of course not as space efficent. Can be somewhat mitigated with smaller segment sizes, and in the future compact segments (somehow).

carlhoerberg avatar Nov 02 '21 19:11 carlhoerberg

Looks reasonable, and I've been running this with some synthetic traffic for a day without issues. I'm thinking about exceptions, if there's a risk of missing a inc/dec in case of an unexpected error, but haven't fully thought this through if it's possible.

jage avatar Nov 04 '21 13:11 jage

yeah, somethings is up because the durable exchange specs fails..

carlhoerberg avatar Nov 04 '21 13:11 carlhoerberg

Fixed the durable exchange problem. It's much faster consuming a 100M msgs queue now. Previously bytesize was recaluclated each time, now we have a counter that keeps adds/substracts when messages are added to the ready deque

carlhoerberg avatar Nov 10 '21 23:11 carlhoerberg

The only problem is that it's "relatively" easy to exhaust disk space now, as now compaction of individual segments is being made. Publish and consume from one queue very fast, only publish to another queue very slowly. No segments will be deleted as at least one message from the slow queue is in each segment.

carlhoerberg avatar Nov 11 '21 11:11 carlhoerberg

todo: when consuming with manual ack and then with auto ack sometimes Unexpected exception in deliver_loop: Missing key 7 (KeyError) can happen, or Invalid memory access (signal 11) at address 0x7fb15cd45fed

bin/avalanchemqperf throughput -z 5 -a
bin/avalanchemqperf throughput -z 5

carlhoerberg avatar Nov 15 '21 23:11 carlhoerberg

Fixed now in https://github.com/cloudamqp/avalanchemq/pull/304/commits/53491c42ba5b814404b4a7dd94a70123af972cbd

carlhoerberg avatar Nov 24 '21 12:11 carlhoerberg

Big question is if only deleting segments when no messages resides in them is enough or if too much disk space will be wasted...

carlhoerberg avatar Nov 19 '22 23:11 carlhoerberg

Superseded by #456

carlhoerberg avatar Mar 10 '23 07:03 carlhoerberg