From: | "M(dot) Bastin" <marcbastin(at)mindspring(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Multiple clients over singele TCP/IP connection |
Date: | 2004-07-16 11:57:57 |
Message-ID: | a06110403bd1d6f46b8c9@[213.119.79.138] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
This is a "best practice" question.
Imagine you have 2 computers. One is a web server and the other runs
PostgreSQL. Multiple browsers from all over the net connect to the
web server, but to minimize load, the web server itself opens only 1
TCP/IP connection with PostgreSQL. (This is a general question, it
doesn't have to be a web server. It could be any kind of
"middleman".)
How would all the browsers be best served simultaneously?
The solution I think about is to use the extended query protocol,
open an infinitely lasting transaction, and have a portal per browser.
That would work to read data until an error occurs and the
transaction would roll back and then *all* browsers' sessions would
have to be reset.
(Therefore to write data I'd have to cheat and still open a second
TCP/IP connection over which each insert or update gets committed
instantly.)
Is there a better way to implement concurrent users over 1 single
TCP/IP session?
Thanks,
Marc
At 1:34 PM -0400 7/1/04, Tom Lane wrote:
> > The only thing that bothers me is the Sync command that would put an
>> end to all portals at once isn't it?
>
>Not if you are inside a transaction block (ie, have issued a BEGIN
>command).
>
>A possibly more serious issue is that an error detected in any one of
>the portals aborts the transaction and thus you lose all the portals.
>We may eventually have a solution for that involving subtransactions.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Bax | 2004-07-16 12:25:55 | Re: postgres account default password |
Previous Message | Yves | 2004-07-16 11:26:23 | Re: postgres account default password |