Обсуждение: PostgreSQL JDBC - Number of connections

Поиск
Список
Период
Сортировка

PostgreSQL JDBC - Number of connections

От
Lars Nielsen Lind
Дата:
Hi.

I use:

/use/bin/postmaster -N 1024 -B 2048 -i -D /........databaseserver

How do I raise the number of connections to the databaseserver?

I use PSQL with Apache/Jakarta-Tomcat/mod_webapp/jdk1.4.1.

Best regards

Lars Nielsen Lind


Re: PostgreSQL JDBC - Number of connections

От
Toby
Дата:
in data/postgresql.conf there are settings for "max_connections" and
"shared_buffers" where the shared_buffers value should be double the
max_connections value. These can also be passed to the postmaster command
by specifying -B <shared_buffers> and -N <max_connections>

in fact, here's a link to the appropriate documentation page where the
switches are listed, all at no extra charge.

         http://www.postgresql.org/idocs/index.php?app-postmaster.html

toby

At 09:41 28/09/2002 +0000, Lars Nielsen Lind wrote:
>Hi.
>
>I use:
>
>/use/bin/postmaster -N 1024 -B 2048 -i -D /........databaseserver
>
>How do I raise the number of connections to the databaseserver?
>
>I use PSQL with Apache/Jakarta-Tomcat/mod_webapp/jdk1.4.1.
>
>Best regards
>
>Lars Nielsen Lind
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly



Re: PostgreSQL JDBC - Number of connections

От
Lars Nielsen Lind
Дата:
Yes - but it seems to be possible with only -N 1024 as max_connections?

Best regards,

Lars Nielsen Lind


Toby wrote:

> in data/postgresql.conf there are settings for "max_connections" and
> "shared_buffers" where the shared_buffers value should be double the
> max_connections value. These can also be passed to the postmaster
> command by specifying -B <shared_buffers> and -N <max_connections>
>
> in fact, here's a link to the appropriate documentation page where the
> switches are listed, all at no extra charge.
>
>         http://www.postgresql.org/idocs/index.php?app-postmaster.html
>
> toby
>
> At 09:41 28/09/2002 +0000, Lars Nielsen Lind wrote:
>
>> Hi.
>>
>> I use:
>>
>> /use/bin/postmaster -N 1024 -B 2048 -i -D /........databaseserver
>>
>> How do I raise the number of connections to the databaseserver?
>>
>> I use PSQL with Apache/Jakarta-Tomcat/mod_webapp/jdk1.4.1.
>>
>> Best regards
>>
>> Lars Nielsen Lind
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 3: if posting/reading through Usenet, please send an appropriate
>> subscribe-nomail command to majordomo@postgresql.org so that your
>> message can get through to the mailing list cleanly
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>



Re: PostgreSQL JDBC - Number of connections

От
Tom Lane
Дата:
Lars Nielsen Lind <moonie@worldonline.dk> writes:
> Yes - but it seems to be possible with only -N 1024 as max_connections?

If you are finding that the backend won't take more than that, it's time
for an update.

There used to be a compile-time limit on max_connections, which was 1024
by default, but it's been gone for awhile.

BTW, you will probably find that you need to do some surgery on kernel
settings as well, if you really want to handle more than a thousand
concurrent backends ...

            regards, tom lane

Re: PostgreSQL JDBC - Number of connections

От
Toby
Дата:
>BTW, you will probably find that you need to do some surgery on kernel
>settings as well, if you really want to handle more than a thousand
>concurrent backends ...


quite. forgive me if i'm wrong, but the backend spawns a new thread for
each connection, so if you want 1000+ simultaneous connections then you're
looking at 1000+ threads. unless you have many processors on your machine,
you will lose much performance through your machine busy context switching
between threads, rather than doing useful work.

t


Re: PostgreSQL JDBC - Number of connections

От
Andrew Sullivan
Дата:
On Sun, Sep 29, 2002 at 11:55:17AM +0100, Toby wrote:

> quite. forgive me if i'm wrong, but the backend spawns a new thread for
> each connection,

Not a new thread, a new _process_.  You're right, however, that at
some point you're better off to reduce the number of concurrent
conenctions, and manage them in a pool.  (This is true of any
database system -- even the trheading ones -- not just PostgreSQL.)

A
--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110