pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3693: Overhead of uncontended use of ResourceLock
Date: Mon, 30 Jun 2025 07:02:12 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
@Sanne , can you please double-check you shared the right profiling results?
I am afraid the file does not contain the traces of async-profiler data.
---
> For example, I think that in the case of PgConnection.clearWarnings one could simply remove the lock: it's guarding a checkClosed() ... The method is also setting firstWarning to null but we'd be better off in replacing this with a volatile.
Imagine the following:
1) A connection executes `copy` command
2) A different thread calls `.getWarnings()`
If we remove the locking there, the noticeable behaviour will change, and we want keeping the backward compatibility:
a) With locking, the second thread would have to wait for `copy` completion and then it will obtain the warnings
b) Without locking, it would return no warnings
Of course, the reentrant locking could probably be eliminated (e.g. we should probably aquire a lock on the top-level method, and we should refrain from reentrant acquire of the same lock). We could indeed replace certain lock instances with `synchronized` (e.g. `LruCache`), however [previously](https://github.com/pgjdbc/pgjdbc/issues/1951#issuecomment-1254442789), the understanding was that `ReentrantLock` was cheap enough.
---
Benchmarks are always welcome. If you could contribute a benchmark (Quarkus + Hibernate is fine) or a link to the benchmark, that would be great.
view thread (14+ messages) latest in thread
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: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3693: Overhead of uncontended use of ResourceLock
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox