[GSOC][weekly report 5] 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 5] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions
Date: 2017-07-09 16:38:35
Message-ID: 56f0a8b5.1e4ce.15d28378ccf.Coremail.liu-mx15@mails.tsinghua.edu.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sorry for report late. Our lab's machines crashed for several days.

As I reported in the last email,
https://www.postgresql.org/message-id/5b6b452.16851.15cf1ec010e.Coremail.liu-mx15@mails.tsinghua.edu.cn
I tried to decrease the contention on SerializableFinishedListLock.
It works actually. But I don't know why my optimization results in another problems: more contention on PREDICATELOCK_MANAGER_LWLOCK.

Here is the result of statistics collector. There were 36 connections in all, so most of them are waiting for locks.
(benchmark is ssibench, but other benchmarks have the same result)

Original:
SerializableXactHashLock, 0.36
predicate_lock_manager, 6.00
wal_insert, 0.07
SerializableFinishedListLock, 16.50

After optimization:
SerializableXactHashLock, 0.35
predicate_lock_manager, 11.53
buffer_content, 0.12
SerializableFinishedListLock, 11.47

So in the end, the performance did not change obviously.
Even if I enlarged the number of predicate locks (NUM_PREDICATELOCK_PARTITIONS) from 16 to 1024,
there were still so many contentions.

It bothered me for several days. The patch is attached.
To focus on this issue, I removed other parts of modification.
Do you have any advices for this ?

--

Sincerely

Mengxing Liu

Attachment Content-Type Size
finishedlock.patch application/octet-stream 2.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Victor Drobny 2017-07-09 16:47:29 Authentification method on client side checking
Previous Message Tom Lane 2017-07-09 16:28:43 Re: [PATCH] Minor typo in the source repository documentation