pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedProcess priority.
3+ messages / 2 participants
[nested] [flat]
* Process priority.
@ 2005-03-17 23:32 Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
0 siblings, 1 reply; 3+ messages in thread
From: Theo Galanakis @ 2005-03-17 23:32 UTC (permalink / raw)
To: pgsql-sql
Hi,
I wrote a C program that can be called through postgres via stored
procedures. It allows you to change the current postmaster process priority.
Essentially it's intended purpose would be to allow a highly
resource intensive postmaster process to run at a lower priority, allowing
other postmaster processes more cpu time. For example admin/reporting
backend sql's that impact the system. I guess this is the same as renice,
however it can be accessed programatically from the postgres box via any
client.
The three stored procs are as follows:
get_pid()
get_priority()
set_priority(int) <!--- setting a negative number(high priority)
requires root access, typical usage would be to set a lower priority, i.e.
of 20.
I would not use this as a alternative to setting up a replication
slave for reporting on a large production system.
I have attached the source code, it has already been compiled for
redhat Linux ES3. There is a README file to get you started. This was my
first attempt at writing a c function for postgres.
<<priority.rar>>
Theo Galanakis
Database Administrator
Lonely Planet Publications
90 Maribyrnong St, Footscray
Melbourne, Vic 3011
Australia
tel +61 3 8379 8000 ext 8395
fax + 61 3 8379 8111
theo_galanakis@lonelyplanet.com.au
<mailto:rowan.mckinnon@lonelyplanet.com.au>
______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright. If you
have received this email in error, please advise the sender and delete
it. If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone. You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.
Attachments:
priority.rar (application/octet-stream, 6.5K) download
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Process priority.
@ 2005-03-18 00:06 Tom Lane <tgl@sss.pgh.pa.us>
parent: Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2005-03-18 00:06 UTC (permalink / raw)
To: Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>; +Cc: pgsql-sql
Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au> writes:
> I wrote a C program that can be called through postgres via stored
> procedures. It allows you to change the current postmaster process priority.
You are aware that that's widely considered either useless or
counterproductive? Renice-ing one backend seldom gives helpful results,
because (a) what usually matters more than CPU usage is I/O, and renice
doesn't change I/O priorities; (b) priority inversion results in
higher-priority backends blocking behind the low-priority one whenever
it's managed to acquire a lock.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Process priority.
@ 2005-03-18 00:32 Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
0 siblings, 0 replies; 3+ messages in thread
From: Theo Galanakis @ 2005-03-18 00:32 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql
It depends what the intended purpose if for. In our scenario, there are a
number of ad-hoc export tasks running during the day that are quite cpu
intensive.
There is a noticeably slow response time when exports are being run. By
lowering the priority of the export postmaster, the system appeared to run
far smoother for standard users.
I guess you could set-up a replication database which I probably will do in
the end, however I just wanted to have a play and see if I could extend
postgres with c. I don't profess to being a c or os guru. Thankyou for your
feedback.
Theo
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Friday, 18 March 2005 11:06 AM
To: Theo Galanakis
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Process priority.
Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au> writes:
> I wrote a C program that can be called through postgres via stored
> procedures. It allows you to change the current postmaster process
> priority.
You are aware that that's widely considered either useless or
counterproductive? Renice-ing one backend seldom gives helpful results,
because (a) what usually matters more than CPU usage is I/O, and renice
doesn't change I/O priorities; (b) priority inversion results in
higher-priority backends blocking behind the low-priority one whenever it's
managed to acquire a lock.
regards, tom lane
______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright. If you
have received this email in error, please advise the sender and delete
it. If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone. You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-03-18 00:32 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 23:32 Process priority. Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
2005-03-18 00:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-03-18 00:32 Re: Process priority. Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox