Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id B0392779692 for ; Thu, 7 Jun 2012 04:54:08 -0300 (ADT) Received: from smtp.checkpoint.com ([194.29.34.68] helo=michael.checkpoint.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ScXXi-0005rW-Uw for pgsql-performance@postgresql.org; Thu, 07 Jun 2012 07:54:08 +0000 Received: from il-ex01.ad.checkpoint.com (dlpgw.checkpoint.com [194.29.34.27]) by michael.checkpoint.com (8.13.8/8.13.8) with ESMTP id q577rrBi009873 for ; Thu, 7 Jun 2012 10:53:53 +0300 X-CheckPoint: {4FD069F6-0-1B221DC2-2FFFF} Received: from il-ex01.ad.checkpoint.com ([126.0.0.2]) by il-ex01.ad.checkpoint.com ([126.0.0.2]) with mapi; Thu, 7 Jun 2012 10:53:50 +0300 From: Nir Zilberman To: "pgsql-performance@postgresql.org" Date: Thu, 7 Jun 2012 10:53:48 +0300 Subject: Multiple Concurrent Updates of Shared Resource Counter Thread-Topic: Multiple Concurrent Updates of Shared Resource Counter Thread-Index: Ac1EgqbKO0UErdBxTHqGSl+lc6D+1Q== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US x-kse-antivirus-interceptor-info: scan successful x-kse-antivirus-info: Clean x-cpdlp: 11ae21ebbaf09dc78ed09dc28e09a16467b1a412d8 Content-Type: multipart/alternative; boundary="_000_A305A29309C1274FAA7A0FED4F1F75666EBC3CD433ilex01adcheck_" MIME-Version: 1.0 X-Pg-Spam-Score: -6.9 (------) X-Archive-Number: 201206/31 X-Sequence-Number: 47057 --_000_A305A29309C1274FAA7A0FED4F1F75666EBC3CD433ilex01adcheck_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi. We are handling multiple concurrent clients connecting to our system - tryi= ng 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 take= s a long time to complete because it waits on the lock for the shared resou= rce table. Any suggestions for better implementation/design of this feature would be m= uch appreciated. Regards, Nir. --_000_A305A29309C1274FAA7A0FED4F1F75666EBC3CD433ilex01adcheck_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi.
 
We are handling multiple concurrent clients connecting to our system -= trying to get a license seat (each license has an initial capacity of seat= s).
We have a table which keeps count of the acquired seats for each licen= se.
When a client tries to acquire a seat we first make sure that the numb= er 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 concurrentl= y 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.
 
Regards,
Nir.
 
 
--_000_A305A29309C1274FAA7A0FED4F1F75666EBC3CD433ilex01adcheck_--