pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bill Moran <wmoran@collaborativefusion.com>
To: Daniel Griscom <griscom@suitable.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Throttling PostgreSQL's CPU usage
Date: Tue, 8 May 2007 16:55:49 -0400
Message-ID: <20070508165549.66c7a49b.wmoran@collaborativefusion.com> (raw)
In-Reply-To: <p0624080bc266892a91b2@[192.168.1.8]>
References: <p0624080bc266892a91b2@[192.168.1.8]>

In response to Daniel Griscom <griscom@suitable.com>:

> I'm building a kiosk with a 3D front end accessing PostGIS/PostgreSQL 
> via Apache/PHP. The 3D display is supposed to show smooth motion from 
> location to location, with PostGIS giving dynamically updated 
> information on the locations. Everything runs on the same machine, 
> and it all works, but when I start a query the 3D display stutters 
> horribly. It looks like PostgreSQL grabs hold of the CPU and doesn't 
> let go until it's completed the query.
> 
> I don't need the PostgreSQL query to return quickly, but I must 
> retain smooth animation while the query is being processed. In other 
> words, I need PostgreSQL to spread out its CPU usage so that it 
> doesn't monopolize the CPU for any significant time (more than 50ms 
> or so).
> 
> Possible solutions:
> 
> 1: Set the PostgreSQL task priority lower than the 3D renderer task, 
> and to make sure that the 3D renderer sleep()s enough to let 
> PostgreSQL get its work done. The obvious objection to this obvious 
> solution is "Priority inversion!", but I see that as an additional 
> challenge to be surmounted rather than an absolute prohibition. So, 
> any thoughts on setting the PostgreSQL task priority (including by 
> the much-maligned tool shown at 
> <http://weblog.bignerdranch.com/?p=11;)?

If it's all PostgreSQL processes that you want take a backseat to your
rendering process, why not just nice the initial PostgreSQL daemon?  All
children will inherit the nice value, and there's no chance of priority
inversion because all the PostgreSQL backends are running at the same
priority.

Just a thought.

-- 
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023



view thread (18+ messages)  latest in thread

Message-ID: <20070508165549.66c7a49b.wmoran@collaborativefusion.com>
Permalink:  ../20070508165549.66c7a49b.wmoran@collaborativefusion.com/
Also on:    postgresql.org/message-id/20070508165549.66c7a49b.wmoran@collaborativefusion.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: wmoran@collaborativefusion.com, griscom@suitable.com
  Subject: Re: Throttling PostgreSQL's CPU usage
  In-Reply-To: <20070508165549.66c7a49b.wmoran@collaborativefusion.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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