[GSOC][weekly report 7] 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(dot)herrera" <alvaro(dot)herrera(at)2ndquadrant(dot)com>, kgrittn <kgrittn(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [GSOC][weekly report 7] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions
Date: 2017-07-23 14:40:22
Message-ID: 5a6c5274.6231.15d6fe45b03.Coremail.liu-mx15@mails.tsinghua.edu.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In the last week, I focus on
1) Creating an independent skip list data structure and related interfaces.
Now it has only two levels so that I don't have to modify too much existing code. But it is easy to be transformed into the data structure with any number of levels if necessary. Unfortunately, its performance is not good. In some cases, it's only 1/2 of original version. It reminded me that even conflict-tracking didn't consume too much CPU time, it was on the critical path and wrapped by a pair of lock acquiring and releasing. Slower conflicts tracking would result in more lock contentions, which would make the performance drop quickly.
2) Using some tricks to improve its performance.
For example, I found if the length of the conflict list is smaller than 10, the original linked list is faster
than the skip list. So I used it in a hybrid way: if the total conflicts are more than 10, using skip list; otherwise using linked list.
Now, the performance is approximately equal to the original version in different benchmarks.
But I don't found a case in which the new version is much faster.

The patch is attached.

So far, I have tried: 1) using hash table for conflict tracking.
2) reducing the global lock contention
3) using skip list for conflict tracking.
But all of them did not improve the performance. So I'm a little confused now about what to do next.
Could you please give me any suggestions?

--

Sincerely

Mengxing Liu

Attachment Content-Type Size
skip-list-for-conflict-tracking.patch application/octet-stream 10.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Dima Pavlov 2017-07-23 15:22:11 Improve perfomance for index search ANY(ARRAY[]) condition with single item
Previous Message Andrew Dunstan 2017-07-23 13:13:53 Testlib.pm vs msys