[GOSC' 17][Performance report] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions

From: "Mengxing Liu" <liu-mx15(at)mails(dot)tsinghua(dot)edu(dot)cn>
To: "Alvaro Herrera" <alvherre(at)2ndquadrant(dot)com>, kgrittn <kgrittn(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [GOSC' 17][Performance report] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions
Date: 2017-07-31 16:11:59
Message-ID: 32941a42.2d24.15d996b1bab.Coremail.liu-mx15@mails.tsinghua.edu.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, all. I wrote a performance report to conclude what I've done so far.
https://docs.google.com/document/d/16A6rfJnQSTkd0SHK-2XzDiLj7aZ5nC189jGPcfVdhMQ/edit?usp=sharing

Three patch are attached. I used the benchmark below to test the performance.
https://github.com/liumx10/pg-bench
It requires golang (>= 1.6) if you want to reproduce the code.

NOTE:
1. The reason why hash table or skip list didn't improve the performance is that
maintaining the conflict list became slower even though conflict tracking was faster.
So far, skip list is the most promising way. But the code is a little tricky.

BTW, if there is a case in which inserting an conflict element is rare but conflict checking is common,
my patch may be better.

2. Reducing contention on global lock has a better performance in this evaluation.
But two weeks ago when I used another machine, it has a worse performance.
It's hard to explain why...

You can reply directly if you have any questions or comments.

--

Sincerely

Mengxing Liu

Attachment Content-Type Size
HTAB-for-conflict-tracking.patch application/octet-stream 28.8 KB
skip-list-for-conflict-tracking.patch application/octet-stream 12.3 KB
reduce-contention-on-FinishedListLock.patch application/octet-stream 2.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-07-31 16:13:17 Re: Clarification in pg10's pgupgrade.html step 10 (upgrading standby servers)
Previous Message Robert Haas 2017-07-31 16:03:17 Re: Update comments in nodeModifyTable.c