Re: dynamically allocating chunks from shared memory - Mailing list pgsql-hackers

From Markus Wanner
Subject Re: dynamically allocating chunks from shared memory
Date
Msg-id 4C45F0F2.7090109@bluegap.ch
Whole thread Raw
In response to Re: dynamically allocating chunks from shared memory  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: dynamically allocating chunks from shared memory
List pgsql-hackers
Hi,

On 07/20/2010 08:23 PM, Robert Haas wrote:
> Well, you can't really fix that problem with this infrastructure,

No, but it would allow you to better use the existing amount of shared 
memory. Possibly avoiding the problem is certain scenarios.

> The failure might
> manifest itself in a totally different subsystem though, since the
> allocation that failed wouldn't necessarily be a heavyweight lock
> allocation, but some other allocation that failed as a result of space
> used by the heavyweight locks.

Yeah, that's a valid concern. Maybe it could be addressed by keeping 
track of usage of dynshmem per module, and somehow inform the user about 
the usage pattern in case of OOM.

> It would be more interesting

Sure, but then you'd definitely need a dynamic allocator, no?

> With respect to imessages specifically, what is the motivation for
> using shared memory rather than something like an SLRU?  The new
> LISTEN implementation uses an SLRU and handles variable-size messages,
> so it seems like it might be well-suited to this task.

Well, imessages predates the new LISTEN implementation by some moons. 
They are intended to replace (unix-ish) pipes between processes. I fail 
to see the immediate link between (S)LRU and inter-process message 
passing. It might be more useful for multiple LISTENers, but I bet it 
has slightly different semantics than imessages.

But to be honest, I don't know too much about the new LISTEN 
implementation. Do you think a loss-less 
(single)-process-to-(single)-process message passing system could be 
built on top of it?

> Incidentally, the link for the imessages patch on the CommitFest page
> points to http://archives.postgresql.org/message-id/ab0cd52a64e788f4ecb4515d1e6e4691@localhost
> - which is the dynamic shmem patch.  So I'm not sure where to find the
> latest imessages patch.

The archive doesn't display attachments very well. But the imessages 
patch is part of that mail. Maybe you still find it in your local mailbox?

In the archive view, it starts at the line that says:
*** src/backend/storage/ipc/imsg.c    dc149eef487eafb43409a78b8a33c70e7d3c2bfa

(and, well, the dynshmem stuff ends just before that line. Those were 
two .diff files attached, IIRC).

Regards

Markus Wanner


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Re: Adding XMLEXISTS to the grammar
Next
From: Alvaro Herrera
Date:
Subject: Re: dynamically allocating chunks from shared memory