zhyyu opened a new issue #6803:
URL: https://github.com/apache/skywalking/issues/6803
Please answer these questions before submitting your issue.
- Why do you submit this issue?
- [x] Question or discussion
- [ ] Bug
- [ ] Requirement
- [ ] Feature or performance improvement
___
### Question
- What do you want to know?
- I reviewed the code and found that, if there are two L2 aggregators,
when they call the "MetricsPersistentWorker#flushDataToStorage" at the same
time, the final cpm data maybe not accurate. Example steps: two L2 aggregator,
backend A and B
```mermaid
sequenceDiagram
participant L2_A
participant L2_A_context_cache
participant L2_B
participant L2_B_context_cache
participant persistent_layer
L2_A ->> persistent_layer: MetricsPersistentWorker.loadFromStorage return
metrics (demoservice value 2)
L2_A ->> L2_A_context_cache: load persistent metrics to cache
L2_B ->> persistent_layer: MetricsPersistentWorker.loadFromStorage return
metrics (demoservice value 2)
L2_B ->> L2_B_context_cache: load persistent metrics to cache
L2_A ->> L2_A_context_cache: get cache metrics
L2_A ->> L2_A: combine current metrics(value 2) with cache metrics,
calculate it (value 4) 4 = 2 + 2
L2_A ->> persistent_layer: update metrics to (demoservice value 4)
L2_B ->> L2_B_context_cache: get cache metrics
L2_B ->> L2_B: combine current metrics(value 2) with cache metrics,
calculate it (value 4) 4 = 2 + 2
L2_B ->> persistent_layer: update metrics to (demoservice value 4)
L2_A ->> L2_A_context_cache: get cache metrics
L2_A ->> L2_A: combine current metrics(value 3) with cache metrics,
calculate it (value 7) 7 = 4 + 3
L2_A ->> persistent_layer: update metrics to (demoservice value 7)
L2_B ->> L2_B_context_cache: get cache metrics
L2_B ->> L2_B: combine current metrics(value 3) with cache metrics,
calculate it (value 7) 7 = 4 + 3
L2_B ->> persistent_layer: update metrics to (demoservice value 7)
```
- above steps, when L2_A L2_B PersistenceTimer.extractDataAndSave are
executed intersect, and enableDatabaseSession = true, the final result will be
7, but accurate result should be 12 = (2 + (2 + 3) L2_A + (2 + 3)L2_B)
___
### Requirement or improvement
- Please describe your requirements or improvement suggestions.
- If I deploy multi backends in mixed role (multi L2), is it right to turn
enableDatabaseSession off to avoid service cpm not accurate?
- Even though switch enableDatabaseSession off try best avoid cpm not
accurate, but when multi L2 query persistent metrics the same time, the cpm
will still not accurate (like multi-thread no safe)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]