Re: refusing connections based on load ...
От | The Hermit Hacker |
---|---|
Тема | Re: refusing connections based on load ... |
Дата | |
Msg-id | Pine.BSF.4.33.0104241454170.4451-100000@mobile.hub.org обсуждение исходный текст |
Ответ на | Re: refusing connections based on load ... (Peter Eisentraut <peter_e@gmx.net>) |
Список | pgsql-hackers |
Apparently so under Solaris ... hestia:/> uname -a SunOS hestia 5.7 Generic_106542-12 i86pc i386 i86pc C Library Functions getloadavg(3C) NAME getloadavg - get system load averages SYNOPSIS #include <sys/loadavg.h> int getloadavg(double loadavg[], int nelem); DESCRIPTION How hard would it be to knock up code that, by default, ignores loadavg, but if, say, set in postgresql.conf: loadavg = 4 it will just refuse connections? On Tue, 24 Apr 2001, Peter Eisentraut wrote: > Tom Lane writes: > > > The Hermit Hacker <scrappy@hub.org> writes: > > > sendmail does it now, and, apparently relatively portable across OSs ... > > > > sendmail expects to be root. It's unlikely (and very undesirable) that > > postgres will be installed with adequate privileges to read /dev/kmem, > > which is what it'd take to run the sendmail loadaverage code on most > > platforms... > > This program: > > #include <stdio.h> > > int main() > { > double la[3]; > > if (getloadavg(la, 3) == -1) > perror("getloadavg"); > > printf("%f %f %f\n", la[0], la[1], la[2]); > > return 0; > } > > works unprivileged on Linux 2.2 and FreeBSD 4.3. Rumour[*] also has it > that there is a way to do this on Solaris and HP-UX 9. So I think that > covers enough users to be worthwhile. > > [*] - Autoconf AC_FUNC_GETLOADAVG > > -- > Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter > > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
В списке pgsql-hackers по дате отправления: