Re: refusing connections based on load ...

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: refusing connections based on load ...
Date: 2001-04-24 17:55:38
Message-ID: Pine.BSF.4.33.0104241454170.4451-100000@mobile.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)hub(dot)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(at)gmx(dot)net http://funkturm.homeip.net/~peter
>
>

Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy(at)hub(dot)org secondary: scrappy(at){freebsd|postgresql}.org

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2001-04-24 18:28:13 Re: refusing connections based on load ...
Previous Message Thomas Lockhart 2001-04-24 16:31:20 Re: OUTER JOIN vs UNION ... faster?