Обсуждение: PostgreSQL too heavy startup

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

PostgreSQL too heavy startup

От
"Igor Sysoev"
Дата:
Hi,

I'm using P-100, 32M, 128M swap, FreeBSD 2.2.5-STABLE, Apache-1.2.6,
perl 5.004_4, PostgreSQL-v6.3.2.
One of CGI scripts makes select from database. When I try to quickly
reload this script about 20 times in browser the FreeBSD starts to heavy
swapping. I'd appled patch to remove exec() from startup code. It seems
that nothing changed.
Is there way to make more lighter startup ?

with best regards,
Igor Sysoev


Re: [GENERAL] PostgreSQL too heavy startup

От
Ivan Cornell
Дата:
Hello Igor,

I would suggest you look into using persistent connections, rather than
setting up a new connection for each request. This has greatly reduced the
load for me. Unfortunately, I don't think this can be done with cgi (but
possibly with fast-cgi?). I use PHP3 as an apache module with persistent
connections to postgresql which I can heavily recommend, or else I think it
is possible with mod_perl/DBD. I realize this doesn't really answer your
question, but may provide an alternative solution.

> Hi,
>
> I'm using P-100, 32M, 128M swap, FreeBSD 2.2.5-STABLE, Apache-1.2.6,
> perl 5.004_4, PostgreSQL-v6.3.2.
> One of CGI scripts makes select from database. When I try to quickly
> reload this script about 20 times in browser the FreeBSD starts to heavy
> swapping. I'd appled patch to remove exec() from startup code. It seems
> that nothing changed.
> Is there way to make more lighter startup ?
>
> with best regards,
> Igor Sysoev

--
Ivan Cornell, FrameStore Ltd
ivan.cornell@framestore.co.uk



Re: [GENERAL] PostgreSQL too heavy startup

От
Amos Hayes
Дата:
On Fri, 5 Jun 1998, Igor Sysoev wrote:

> I'm using P-100, 32M, 128M swap, FreeBSD 2.2.5-STABLE, Apache-1.2.6,
> perl 5.004_4, PostgreSQL-v6.3.2.
> One of CGI scripts makes select from database. When I try to quickly
> reload this script about 20 times in browser the FreeBSD starts to heavy
> swapping. I'd appled patch to remove exec() from startup code. It seems
> that nothing changed.
> Is there way to make more lighter startup ?

I have used a combination of the following to achieve quick CGI response
from the DB with little modification to existing CGI code:

FastCGI (http://www.fastcgi.com/) and mod_fcgi for Apache
(http://www.apache.org/)

Perl (http://www.perl.com), compiled with the sfio extensions
(http://www.perl.com/CPAN-local//src/misc/sfio97.src.unix.tar.gz)

DBI (http://www.perl.com/CPAN-local//modules/by-module/DBI/) and
appropriate DBD (http://www.perl.com/CPAN-local//modules/by-module/DBD/)

CGI.pm
(http://www.perl.com/CPAN-local//modules/by-module/CGI/)


The only drawback that I've noticed is that each script you run consumes a
fair bit of memory. Assuming you've got lots of RAM, it's *much* faster
than trying to fire up databased scripts on a per request basis. There are
other ways of doing things which may make better use of resources (like
mod_perl & DBI) but the FastCGI method can help you get around some sticky
issues when you have a bunch of existing scripts.

--
Amos Hayes                      Systems Architect
ahayes@ingenia.com            Ingenia Group - Software Kinetics Ltd.
http://smurf.ingenia.com/~ahayes        http://www.ingenia.com

"Remember: No one can make you feel inferior without your consent."
   - ELEANOR ROOSEVELT