pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Mattox <michael.mattox@verideon.com>
To: Richard Huxton <dev@archonet.com>
To: pgsql-performance@postgresql.org
Subject: Re: Performance advice
Date: Tue, 24 Jun 2003 14:16:09 +0200
Message-ID: <CJEBLDCHAADCLAGIGCOOCEJICKAA.michael.mattox@verideon.com> (raw)
In-Reply-To: <200306241233.42361.dev@archonet.com>

> Don't log your monitoring info directly into the database, log
> straight to one
> or more text-files and sync them every few seconds. Rotate the
> files once a
> minute (or whatever seems suitable). Then have a separate process
> that reads
> "old" files and processes them into the database.
>
> The big advantage - you can take the database down for a short
> period and the
> monitoring goes on. Useful for those small maintenance tasks.

This is a good idea but it'd take a bit of redesign to make it work.  here's
my algorithm now:

- Every 10 seconds I get a list of monitors who have nextdate >= current
time
- I put the id numbers of the monitors into a queue
- A thread from a thread pool (32 active threads) retrieves the monitor from
the database from its id, updates the nextdate timestamp, executes the
monitor, and stores the status in the database

So I have two transactions, one to update the monitor's nextdate and another
to update its status.  Now that I wrote that I see a possibility to
steamline the last step.  I can wait until I update the status to update the
nextdate.  That would cut the number of transactions in two.  Only problem
is I have to be sure not to add a monitor to the queue when it's currently
executing.  This shouldn't be hard, I have a hashtable containing all the
active monitors.

Thanks for the suggestion, I'm definitely going to give this some more
thought.

Michael









view thread (23+ messages)  latest in thread

Message-ID: <CJEBLDCHAADCLAGIGCOOCEJICKAA.michael.mattox@verideon.com>
Permalink:  ../CJEBLDCHAADCLAGIGCOOCEJICKAA.michael.mattox@verideon.com/
Also on:    postgresql.org/message-id/CJEBLDCHAADCLAGIGCOOCEJICKAA.michael.mattox@verideon.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: michael.mattox@verideon.com, dev@archonet.com
  Subject: Re: Performance advice
  In-Reply-To: <CJEBLDCHAADCLAGIGCOOCEJICKAA.michael.mattox@verideon.com>
  References: <200306241233.42361.dev@archonet.com> <CJEBLDCHAADCLAGIGCOOCEJICKAA.michael.mattox@verideon.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