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: 16437.24.91.171.78.1139237024.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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 http://www.mohawksoft.org, 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
write.

>
> 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

Browse pgsql-hackers by date

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