pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Cédric Villemain <cedric@2ndquadrant.com>
To: pgsql-performance@postgresql.org
Cc: Nir Zilberman <nirz@checkpoint.com>
Subject: Re: Multiple Concurrent Updates of Shared Resource Counter
Date: Fri, 8 Jun 2012 12:59:53 +0200
Message-ID: <201206081259.57036.cedric@2ndquadrant.com> (raw)
In-Reply-To: <A305A29309C1274FAA7A0FED4F1F75666EBC3CD433@il-ex01.ad.checkpoint.com>
References: <A305A29309C1274FAA7A0FED4F1F75666EBC3CD433@il-ex01.ad.checkpoint.com>

Le jeudi 7 juin 2012 09:53:48, Nir Zilberman a écrit :
> Hi.
> 
> We are handling multiple concurrent clients connecting to our system -
> trying to get a license seat (each license has an initial capacity of
> seats). We have a table which keeps count of the acquired seats for each
> license. When a client tries to acquire a seat we first make sure that the
> number of acquired seats is less than the license capacity. We then
> increase the number of acquired seats by 1.
> 
> Our main problem here is with the acquired seats table.
> It is actually a shared resource which needs to be updated concurrently by
> multiple transactions.
> 
> When multiple transactions are running concurrently - each transaction
> takes a long time to complete because it waits on the lock for the shared
> resource table.
> 
> Any suggestions for better implementation/design of this feature would be
> much appreciated.

maybe you can manage something around UNIQUE (license_id,license_seat_number).

It depends of what you achieve, and the tables structures you have.
-- 
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation

Attachments:

  signature.asc (application/pgp-signature, 489B) download

view thread (3+ messages)

Message-ID: <201206081259.57036.cedric@2ndquadrant.com>
Permalink:  ../201206081259.57036.cedric@2ndquadrant.com/
Also on:    postgresql.org/message-id/201206081259.57036.cedric@2ndquadrant.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: cedric@2ndquadrant.com, nirz@checkpoint.com
  Subject: Re: Multiple Concurrent Updates of Shared Resource Counter
  In-Reply-To: <201206081259.57036.cedric@2ndquadrant.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