You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2022/07/19 01:28:11 UTC

[servicecomb-service-center] branch master updated: add benchmark for different deploy topology (#1312)

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

littlecui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 98da7bba add benchmark for different deploy topology (#1312)
98da7bba is described below

commit 98da7bba51734fefe78f3e2e31bd8dc2c0ab8428
Author: Shawn <xi...@gmail.com>
AuthorDate: Tue Jul 19 09:28:06 2022 +0800

    add benchmark for different deploy topology (#1312)
---
 benchmark/READM.md                            | 22 +++++++++
 benchmark/find/find_1000_intance.js           | 56 ++++++++++++++++++++++
 benchmark/find/find_100_intance.js            | 56 ++++++++++++++++++++++
 benchmark/find/find_one_intance.js            | 52 +++++++++++++++++++++
 benchmark/register/hb_same_service.js         | 67 +++++++++++++++++++++++++++
 benchmark/register/register_random_service.js | 48 +++++++++++++++++++
 benchmark/register/register_same_service.js   | 49 ++++++++++++++++++++
 7 files changed, 350 insertions(+)

diff --git a/benchmark/READM.md b/benchmark/READM.md
new file mode 100644
index 00000000..a970d01e
--- /dev/null
+++ b/benchmark/READM.md
@@ -0,0 +1,22 @@
+# Benchmark
+Use [k6](https://k6.io/) to call service center API
+## service center and etcd deployed in local host
+#### virtual user 10
+|  scene | TPS  |  Latency | sc mem  | etcd mem  |
+|---|---|---|---|---|
+| register growing instance  |  348.244462/s  | p(90)=76.64ms p(95)=84.73ms  |  95 | 256  |
+| register same instance | 1937.723719/s  |  p(90)=5.04ms  p(95)=22.23ms |   |   |
+| find one instance  | 1374.776952/s  | p(90)=13.93ms p(95)=43.8ms  |  76m | 232  |
+| find 100 instance  | 1838.609097/s  | p(90)=5.49ms   p(95)=21.32ms  | 72  | 196  |
+| find 1000 instance  |  267.533417/s  | p(90)=75.23ms p(95)=90.71ms  |  106 | 234  |
+| heartbeat one instance  |  3430.479538/s  | p(90)=1.75ms  p(95)=4.28ms  | 75m  |  195m |
+## service center with embedded etcd in local host
+#### virtual user 10
+|  scene | TPS  |  Latency | sc mem  | etcd mem  |
+|---|---|---|---|---|
+| register growing instance  |  478.132249/s | p(90)=63.74ms  p(95)=74.8ms  |  206m |   |
+| register same instance |2773.890508/s   |  p(90)=3.03ms  p(95)=7.62ms |  156m |   |
+| find one instance  | 4182.78487/s  | p(90)=1.76ms  p(95)=3.7ms  |  175m |   |
+| find 100 instance  | 1531.041088/s  | p(90)=8.62ms   p(95)=33.72ms  |  171m |   |
+| find 1000 instance  | 253.041503/s  | p(90)=81.54ms p(95)=97.55ms  |  240m |   |
+| heartbeat one instance  | 3232.36232/s  | p(90)=2.25ms p(95)=5.34ms  |  156m |   |
\ No newline at end of file
diff --git a/benchmark/find/find_1000_intance.js b/benchmark/find/find_1000_intance.js
new file mode 100644
index 00000000..1a3e3d9d
--- /dev/null
+++ b/benchmark/find/find_1000_intance.js
@@ -0,0 +1,56 @@
+import http from 'k6/http';
+export const options = {
+    vus: 10,
+    duration: '30s',
+};
+export function setup() {
+    const url3 = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3?force=1';
+    http.del(url3);
+
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices';
+    const payload = JSON.stringify({
+        service: {
+            serviceName: 'test3',
+            serviceId: 'test3',
+        }});
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+    for (let index = 0; index < 1000; index++){
+        const url2 = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3/instances';
+        const payload2 = JSON.stringify({
+            instance: {
+                hostName: "tian",
+                endpoints: [
+                    "ex of",
+                    "labore"
+                ],
+                serviceId: "test3",
+                properties: {},
+                dataCenterInfo: {
+                    name: "beijing",
+                    region: "beijing",
+                    availableZone: "az1"
+                }
+            }
+        });
+
+        const params2 = {
+            headers: {
+                'Content-Type': 'application/json',
+            },
+        };
+
+        http.post(url2, payload2, params2);
+    }
+
+}
+export default function () {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/instances?appId=default&serviceName=test3';
+    http.get(url);
+}
\ No newline at end of file
diff --git a/benchmark/find/find_100_intance.js b/benchmark/find/find_100_intance.js
new file mode 100644
index 00000000..6d07e559
--- /dev/null
+++ b/benchmark/find/find_100_intance.js
@@ -0,0 +1,56 @@
+import http from 'k6/http';
+export const options = {
+    vus: 10,
+    duration: '30s',
+};
+export function setup() {
+    const url3 = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3?force=1';
+    http.del(url3);
+
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices';
+    const payload = JSON.stringify({
+        service: {
+            serviceName: 'test3',
+            serviceId: 'test3',
+        }});
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+    for (let index = 0; index < 100; index++){
+        const url2 = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3/instances';
+        const payload2 = JSON.stringify({
+            instance: {
+                hostName: "tian",
+                endpoints: [
+                    "ex of",
+                    "labore"
+                ],
+                serviceId: "test3",
+                properties: {},
+                dataCenterInfo: {
+                    name: "beijing",
+                    region: "beijing",
+                    availableZone: "az1"
+                }
+            }
+        });
+
+        const params2 = {
+            headers: {
+                'Content-Type': 'application/json',
+            },
+        };
+
+        http.post(url2, payload2, params2);
+    }
+
+}
+export default function () {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/instances?appId=default&serviceName=test3';
+    http.get(url);
+}
\ No newline at end of file
diff --git a/benchmark/find/find_one_intance.js b/benchmark/find/find_one_intance.js
new file mode 100644
index 00000000..917c07d0
--- /dev/null
+++ b/benchmark/find/find_one_intance.js
@@ -0,0 +1,52 @@
+import http from 'k6/http';
+export const options = {
+    vus: 10,
+    duration: '30s',
+};
+export function setup() {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices';
+    const payload = JSON.stringify({
+        service: {
+            serviceName: 'test3',
+            serviceId: 'test3',
+        }});
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+
+    const url2 = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3/instances';
+    const payload2 = JSON.stringify({
+        instance: {
+            hostName: "tian",
+            endpoints: [
+                "ex of",
+                "labore"
+            ],
+            instanceId: "1",
+            serviceId: "test3",
+            properties: {},
+            dataCenterInfo: {
+                name: "beijing",
+                region: "beijing",
+                availableZone: "az1"
+            }
+        }
+    });
+
+    const params2 = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url2, payload2, params2);
+}
+export default function () {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/instances?appId=default&serviceName=test3';
+    http.get(url);
+}
\ No newline at end of file
diff --git a/benchmark/register/hb_same_service.js b/benchmark/register/hb_same_service.js
new file mode 100644
index 00000000..d22c1ea1
--- /dev/null
+++ b/benchmark/register/hb_same_service.js
@@ -0,0 +1,67 @@
+import http from 'k6/http';
+export const options = {
+    vus: 10,
+    duration: '30s',
+};
+export function setup() {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices';
+    const payload = JSON.stringify({
+        service: {
+            serviceName: 'test3',
+            serviceId: 'test3',
+        }});
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+
+    const url2 = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3/instances';
+    const payload2 = JSON.stringify({
+        instance: {
+            hostName: "tian",
+            endpoints: [
+                "ex of",
+                "labore"
+            ],
+            instanceId: "1",
+            serviceId: "test3",
+            properties: {},
+            dataCenterInfo: {
+                name: "beijing",
+                region: "beijing",
+                availableZone: "az1"
+            }
+        }
+    });
+
+    const params2 = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url2, payload2, params2);
+}
+export default function () {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/heartbeats';
+    const payload = JSON.stringify({
+        Instances: [
+            {
+                serviceId: "test3",
+                instanceId: "1"
+            }
+        ]
+    });
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+}
\ No newline at end of file
diff --git a/benchmark/register/register_random_service.js b/benchmark/register/register_random_service.js
new file mode 100644
index 00000000..ae7091fe
--- /dev/null
+++ b/benchmark/register/register_random_service.js
@@ -0,0 +1,48 @@
+import http from 'k6/http';
+export const options = {
+    vus: 10,
+    duration: '30s',
+};
+export function setup() {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices';
+    const payload = JSON.stringify({
+        service: {
+            serviceName: 'test3',
+            serviceId: 'test3',
+        }});
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+}
+export default function () {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3/instances';
+    const payload = JSON.stringify({
+        instance: {
+            hostName: "tian",
+            endpoints: [
+                "ex of",
+                "labore"
+            ],
+            serviceId: "test3",
+            properties: {},
+            dataCenterInfo: {
+                name: "beijing",
+                region: "beijing",
+                availableZone: "az1"
+            }
+        }
+    });
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+}
\ No newline at end of file
diff --git a/benchmark/register/register_same_service.js b/benchmark/register/register_same_service.js
new file mode 100644
index 00000000..6cf9bcd4
--- /dev/null
+++ b/benchmark/register/register_same_service.js
@@ -0,0 +1,49 @@
+import http from 'k6/http';
+export const options = {
+    vus: 10,
+    duration: '30s',
+};
+export function setup() {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices';
+    const payload = JSON.stringify({
+        service: {
+            serviceName: 'test3',
+            serviceId: 'test3',
+        }});
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+}
+export default function () {
+    const url = 'http://127.0.0.1:30100/v4/default/registry/microservices/test3/instances';
+    const payload = JSON.stringify({
+        instance: {
+            hostName: "tian",
+            endpoints: [
+                "ex of",
+                "labore"
+            ],
+            instanceId: "1",
+            serviceId: "test3",
+            properties: {},
+            dataCenterInfo: {
+                name: "beijing",
+                region: "beijing",
+                availableZone: "az1"
+            }
+        }
+    });
+
+    const params = {
+        headers: {
+            'Content-Type': 'application/json',
+        },
+    };
+
+    http.post(url, payload, params);
+}
\ No newline at end of file