Provide slow database rule document. (#2253)

This commit is contained in:
吴晟 Wu Sheng 2019-02-18 21:23:36 +08:00 committed by GitHub
parent 486a98adcb
commit 333bcd48e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

View File

@ -27,6 +27,7 @@ The core features are following.
- Slow services and endpoints detected
- Performance optimization
- Distributed tracing and context propagation
- Database access metric. Detect slow database access statements(including SQL statements).
- Alarm

View File

@ -68,6 +68,8 @@ Choose the one you like, we are also welcome anyone to contribute new storage im
are harmless, at least our default receivers are. You would set and active all receivers provided.
1. Do [trace sampling](trace-sampling.md) at backend. This sample keep the metric accurate, only don't save some of traces
in storage based on rate.
1. Follow [slow DB statement threshold](slow-db-statement.md) config document to understand that,
how to detect the Slow database statements(including SQL statements) in your system.
1. Official [OAL scripts](../../guides/backend-oal-scripts.md). As you known from our [OAL introduction](../../concepts-and-designs/oal.md),
most of backend analysis capabilities based on the scripts. Here is the description of official scripts,
which helps you to understand which metric data are in process, also could be used in alarm.

View File

@ -0,0 +1,14 @@
# Slow Database Statement
Slow Database statements are significant important to find out the bottleneck of the system, which relied on Database.
Slow DB statements are based on sampling, right now, the core samples top 50 slowest in every 10 minutes.
But duration of those statements must be slower than threshold.
The setting format is following, unit is millisecond.
> database-type:thresholdValue,database-type2:thresholdValue2
Default setting is `default:200,mongodb:100`. `Reserved DB type` is **default**, which be as default threshold for all
database types, except set explicitly.
**Notice**, the threshold should not be too small, like `1ms`. Functionally, it works, but would cost OAP performance issue,
if your system statement access time are mostly more than 1ms.

View File

@ -32,7 +32,7 @@ public class DBLatencyThresholds {
for (String setting : settings) {
String[] typeValue = setting.split(":");
if (typeValue.length == 2) {
thresholds.put(typeValue[0].toLowerCase(), Integer.parseInt(typeValue[1]));
thresholds.put(typeValue[0].trim().toLowerCase(), Integer.parseInt(typeValue[1].trim()));
}
}
if (!thresholds.containsKey("default")) {