Skip site navigation (1) Skip section navigation (2)

Re: refusing connections based on load ...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neal Norwitz <neal(at)metaslash(dot)com>
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 03:21:25
Message-ID: 25376.988082485@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: 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 depending on the system, the release of
     HP-UX, and the data to be displayed.

and that's just for *one* platform.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Ian Lance TaylorDate: 2001-04-24 03:24:51
Subject: Re: refusing connections based on load ...
Previous:From: Neal NorwitzDate: 2001-04-24 03:12:20
Subject: Re: refusing connections based on load ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group