apache / apache/shardingsphere
high latency for shardingsphere-jdbc initializing schema metadata in Single table rule
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 326
Description
version: shardingsphere-jdbc-5.5.2
we have about 4500 tables in our database. and the rule configuration is as below. there are no other rules except the SINGLE one. The initialization latency is about 4 minutes.
```
rules:
- !SINGLE
tables:
- "ds0.restful_message_b_table"
defaultDataSource: ds0
```
I analyzed the initialization procedure and found it is blocked in `org.apache.shardingsphere.mode.metadata.persist.service.metadata.table.TableMetaDataPersistService::persist`.
Can we optimize the `persist` method by parallel execution.
Contributor guide
Research direction
Start by reading org.apache.shardingsphere.mode.metadata.persist.service.metadata.table.TableMetaDataPersistService::persist and tracing how it is reached during Single table rule initialization. Measure initialization with the reported 4,500-table database and verify that the latency is reduced without changing the metadata persisted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100