On Wed, Aug 24, 2011 at 4:30 AM, Markus Wanner <markus@bluegap.ch> wrote:
> I'm in respectful disagreement regarding the ring-buffer approach and
> think that dynamic allocation can actually be more efficient if done
> properly, because there doesn't need to be head and tail pointers, which
> might turn into a point of contention.
True; although there are some other complications. With a
sufficiently sophisticated allocator you can avoid mutex contention
when allocating chunks, but then you have to store a pointer to the
chunk somewhere or other, and that then requires some kind of
synchronization.
> As a side note: that I've been there with imessages. Those were first
> organized as a ring-bufffer. The major problem with that approach was
> the imessages were consumed with varying delay. In case an imessage was
> left there for a longer amount of time, it blocked creation of new
> imessages, because the ring-buffer cycled around once and its head
> arrived back at the unconsumed imessage.
>
> IIUC (which might not be the case) the same issue applies for snapshots.
One difference with snapshots is that only the latest snapshot is of
any interest.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company