You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/02/18 13:23:42 UTC

[incubator-skywalking] branch master updated: Provide slow database rule document. (#2253)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 333bcd4  Provide slow database rule document. (#2253)
333bcd4 is described below

commit 333bcd48e05bc57ecfc7fe5517df5ab3239e2419
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Mon Feb 18 21:23:36 2019 +0800

    Provide slow database rule document. (#2253)
---
 README.md                                                  |  1 +
 docs/en/setup/backend/backend-setup.md                     |  2 ++
 docs/en/setup/backend/slow-db-statement.md                 | 14 ++++++++++++++
 .../receiver/trace/provider/DBLatencyThresholds.java       |  2 +-
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 747646c..77d0434 100644
--- a/README.md
+++ b/README.md
@@ -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
 
 
diff --git a/docs/en/setup/backend/backend-setup.md b/docs/en/setup/backend/backend-setup.md
index 13edff0..0c30535 100644
--- a/docs/en/setup/backend/backend-setup.md
+++ b/docs/en/setup/backend/backend-setup.md
@@ -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.
diff --git a/docs/en/setup/backend/slow-db-statement.md b/docs/en/setup/backend/slow-db-statement.md
new file mode 100644
index 0000000..c8bb54e
--- /dev/null
+++ b/docs/en/setup/backend/slow-db-statement.md
@@ -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.
\ No newline at end of file
diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/DBLatencyThresholds.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/DBLatencyThresholds.java
index b66c890..a0fbbec 100644
--- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/DBLatencyThresholds.java
+++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/DBLatencyThresholds.java
@@ -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")) {