PDClient
and RegionStoreClient
are slow down massively in heavy workload.
#639
Labels
type/bug
Something isn't working
Bug Report
1. Describe the bug
Every request will create a
RegionStoreClient
by asking theRegionManager
about the region info before it is sent to TiKV servers.client-java/src/main/java/org/tikv/common/region/RegionStoreClient.java
Lines 1430 to 1435 in 5a757d9
However, this method is declared synchronized, which might block the entire client every time it launches a request. It's safe to remove the
synchronized
keyword since the underlying code ofRegionManager
is already synced.Another code path that suffers from the
synchronized
is:client-java/src/main/java/org/tikv/common/PDClient.java
Line 521 in 3128161
This code is executed when there is a request error or response error while interacting with PD servers. Under heavy retry, this code path might be slowed down by the lock. It is also safe to remove the synchronized keyword since the PD server is not required to update to the latest one, we might use
AtomicReference
to wrap and update thepdClientWrapper
. Even if we get a stale leader in this code path, there is a thread that constantly updates the PD leader every 10 seconds.2. Minimal reproduce step (Required)
3. What are your Java Client and TiKV versions? (Required)
The text was updated successfully, but these errors were encountered: