Re: Backup throttling

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Antonin Houska <antonin(dot)houska(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Backup throttling
Date: 2013-09-03 12:51:55
Message-ID: 20130903125155.GA18486@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2013-09-03 14:35:18 +0200, Antonin Houska wrote:

> + /*
> + * THROTTLING_SAMPLE_MIN / MAX_RATE_LOWER (in seconds) should be the
> + * longest possible time to sleep.
> + */
> + pg_usleep((long) sleep);
> + else
> +
> + /*
> + * The actual transfer rate is below the limit. Negative value would
> + * distort the adjustment of throttled_last.
> + */
> + sleep = 0;
> +
> + /*
> + * Only the whole multiples of throttling_sample processed. The rest will
> + * be done during the next call of this function.
> + */
> + throttling_counter %= throttling_sample;
> + /* Once the (possible) sleep ends, new period starts. */
> + throttled_last += elapsed + sleep;
> +}

It's probably better to use latches for the waiting, those have properly
defined interruption semantics. Whether pg_usleep will be interrupted is
platform dependant...

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2013-09-03 13:22:40 Re: Further XLogInsert scaling tweaking
Previous Message Antonin Houska 2013-09-03 12:35:18 Re: Backup throttling