Skip site navigation (1) Skip section navigation (2)

Re: Shared memory and memory context question

From: "Mark Woodward" <pgsql(at)mohawksoft(dot)com>
To: richard(at)playford(dot)net
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Shared memory and memory context question
Date: 2006-02-06 14:43:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
> On Mon February 6 2006 05:17, Mark Woodward wrote:
>> I posted some source to a shared memory sort of thing to the group, as
>> well as to you, I believe.
> 	Indeed, and it looks rather interesting. I'll have a look through it when
> I
> have a chance...
> 	So, after more discussion and experimentation, the possible methods in
> order
> of +elegance/-difficulty/-complexity are:
> =1. OSSP supported shared mem, possibly with a pg memory context or Mark's
> shared memory manager.
> =1. Separate application which the postgres backends talk to over tcp
> (which
> actually turns out to be quite a clean way of doing it).

If you hop on over to, you'll see a server
application called "MCache." MCache is written to handle *exactly* the
sort of information you are looking to manage. Its primary duty is to
manage highly concurrent/active sessions for a large web cluster. I have
also been working on a PostgreSQL extension for it. It needs to be fleshed
out and, again, some heavy duty QA, but "works on my machine."

I alluded to releasing an extension module for PostgreSQL, I'm actually
working on a much larger set of projects intended to tightly integrate
PostgreSQL, web servers (PHP right now), and a set of service applications
including search and recommendations. In another thread I wanted to add an
extension, "xmldbx," to postgresql's contrib dir. Anyway, I digress.

If anyone is interested in lending a hand in QA, examples, and so on, I'd
be glad to take this off line.

> 3. Storing rules in db and reloading them each time (which turns out to be
> a
> utter bastard to do).
> 4. Shared memory with my own memory manager.

If you have time and the inclanation to so, it is a fund sort of thing to

> 	I am *probably* going to go for the separate network application, as I
> believe this is easy and relatively clean, as the required messages should
> be
> fairly straightforward. Each postgres backend opens a connection to the
> single separate "rules-server" which sends back a serious of commands
> (probably SQL), before the connection is closed again.
> 	If this is Clearly Insane - please let me know!

It isn't a bad idea at all. For MCache, I leave the socket connection open
for the next use of the PostgreSQL session. Web environments usually keep
a cache of active database connections to save the overhead of connecting
each time. You just need to be careful when you clean up.

In response to

pgsql-hackers by date

Next:From: Mohan KDate: 2006-02-06 15:10:34
Subject: Re: Postgres 8.1.x and MIT Kerberos 5
Previous:From: Andrew - SupernewsDate: 2006-02-06 14:13:21
Subject: Re: slow information schema with thausand users, seq.scan pg_authid

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group