Re: refusing connections based on load ... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: refusing connections based on load ...
Date
Msg-id 25376.988082485@sss.pgh.pa.us
Whole thread Raw
In response to Re: refusing connections based on load ...  (The Hermit Hacker <scrappy@hub.org>)
List pgsql-hackers
> Rather than do system('uptime') and incur the process start-up each time,
> you could do fp = popen('vmstat 60', 'r'), then just read the fp.

popen doesn't incur a process start?  Get real.  But you're right, popen()
is the right call not system(), because you need to read the stdout.

> I believe vmstat is fairly standard.

Not more so than uptime --- and the latter's output format is definitely
less variable across platforms.  The HPUX man page goes so far as to say

WARNINGS    Users of vmstat must not rely on the exact field widths and spacing of    its output, as these will vary
dependingon the system, the release of    HP-UX, and the data to be displayed.
 

and that's just for *one* platform.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Larry Rosenman
Date:
Subject: Re: refusing connections based on load ...
Next
From: Ian Lance Taylor
Date:
Subject: Re: refusing connections based on load ...