Re: refusing connections based on load ...

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: The Hermit Hacker <scrappy(at)hub(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: refusing connections based on load ...
Date: 2001-04-24 15:08:15
Message-ID: Pine.LNX.4.30.0104241657010.736-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-04-24 16:31:20 Re: OUTER JOIN vs UNION ... faster?
Previous Message Bruce Momjian 2001-04-24 14:28:29 Re: start / stop scripts question