This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git
The following commit(s) were added to refs/heads/master by this push:
new d9c7102 add new benchmark projects (#122)
d9c7102 is described below
commit d9c7102a47e20534161d810b4b07d2f6d9a3ee79
Author: liubao68 <[email protected]>
AuthorDate: Wed Nov 15 11:38:54 2023 +0800
add new benchmark projects (#122)
---
java-chassis-benchmark/README.md | 0
.../basic-3.0.x/consumer/pom.xml | 46 ++++++
.../servicecomb/samples/ConsumerApplication.java | 30 ++--
.../servicecomb/samples/ConsumerController.java | 37 +++++
.../servicecomb/samples/ProviderService.java | 10 +-
.../consumer/src/main/resources/application.yml | 58 ++++++++
.../consumer/src/main/resources/log4j2.xml | 71 +++++++++
java-chassis-benchmark/basic-3.0.x/gateway/pom.xml | 49 +++++++
.../servicecomb/samples/GatewayApplication.java | 30 ++--
.../gateway/src/main/resources/application.yml | 73 ++++++++++
.../gateway/src/main/resources/log4j2.xml | 71 +++++++++
.../basic-3.0.x}/pom.xml | 129 +++++++++--------
.../basic-3.0.x/provider/pom.xml | 50 +++++++
.../servicecomb/samples/ProviderApplication.java | 30 ++--
.../servicecomb/samples/ProviderController.java | 32 ++---
.../provider/src/main/resources/application.yml | 57 ++++++++
.../provider/src/main/resources/log4j2.xml | 71 +++++++++
.../common/pom.xml | 26 ++--
.../apache/servicecomb/samples/ChildDataModel.java | 69 +++++++++
.../org/apache/servicecomb/samples/DataModel.java | 51 +++++++
java-chassis-benchmark/pom.xml | 55 +++++++
.../test-tool}/pom.xml | 82 ++++-------
.../servicecomb/samples/ProviderService.java | 10 +-
.../servicecomb/samples/TestCaseService.java | 160 +++++++++++++++++++++
.../servicecomb/samples/TestToolApplication.java | 34 +++--
.../test-tool/src/main/resources/application.yml | 25 ++++
.../test-tool/src/main/resources/log4j2.xml | 71 +++++++++
.../microservices/gateway/ProviderController.yaml | 88 ++++++++++++
.../test-tool/src/main/resources/registry.yaml | 26 ++++
java-chassis-perfermance/README.md | 49 -------
.../org/apache/servicecomb/demo/perf/Code.java | 74 ----------
.../org/apache/servicecomb/demo/perf/Impl.java | 81 -----------
.../servicecomb/demo/perf/PerfConfiguration.java | 133 -----------------
.../apache/servicecomb/demo/perf/PerfConsumer.java | 101 -------------
.../servicecomb/demo/perf/RedisClientUtils.java | 74 ----------
.../apache/servicecomb/demo/perf/RedisSession.java | 71 ---------
.../src/main/resources/microservice.yaml | 79 ----------
37 files changed, 1318 insertions(+), 885 deletions(-)
diff --git a/java-chassis-benchmark/README.md b/java-chassis-benchmark/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/java-chassis-benchmark/basic-3.0.x/consumer/pom.xml
b/java-chassis-benchmark/basic-3.0.x/consumer/pom.xml
new file mode 100644
index 0000000..db575ea
--- /dev/null
+++ b/java-chassis-benchmark/basic-3.0.x/consumer/pom.xml
@@ -0,0 +1,46 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>basic-application-3.0.x</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-consumer-3.0.x</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
similarity index 61%
copy from
java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
copy to
java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
index 871ccb4..d780350 100644
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
+++
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
@@ -15,26 +15,22 @@
* limitations under the License.
*/
-package org.apache.servicecomb.demo.perf;
+package org.apache.servicecomb.samples;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.vertx.VertxUtils;
-
-public class PerfMain {
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+public class ConsumerApplication {
public static void main(String[] args) throws Exception {
- BeanUtils.init();
-
- // redis
- RedisClientUtils.init(VertxUtils.getOrCreateVertxByName("transport",
null));
-
- List<String> argList = Arrays.asList(args);
- if (argList.contains("-c")) {
- PerfConsumer consumer =
BeanUtils.getContext().getBean(PerfConsumer.class);
- consumer.runConsumer();
+ try {
+ new SpringApplicationBuilder()
+ .web(WebApplicationType.NONE)
+ .sources(ConsumerApplication.class)
+ .run(args);
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
}
diff --git
a/java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
new file mode 100644
index 0000000..b23a0e6
--- /dev/null
+++
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RestSchema(schemaId = "ConsumerController")
+@RequestMapping(path = "/")
+public class ConsumerController {
+ @RpcReference(schemaId = "ProviderController", microserviceName = "provider")
+ private ProviderService providerService;
+
+ @PostMapping("/benchmark")
+ public DataModel sayHello(@RequestHeader("wait") int wait, @RequestBody
DataModel dataModel) throws Exception {
+ return providerService.sayHello(wait, dataModel);
+ }
+}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Intf.java
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
similarity index 75%
copy from
java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Intf.java
copy to
java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
index c671fda..00d560e 100644
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Intf.java
+++
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
@@ -15,12 +15,8 @@
* limitations under the License.
*/
-package org.apache.servicecomb.demo.perf;
+package org.apache.servicecomb.samples;
-import java.util.concurrent.CompletableFuture;
-
-public interface Intf {
- String syncQuery(String id, int step, int all, boolean fromDB);
-
- CompletableFuture<String> asyncQuery(String id, int step, int all, boolean
fromDB);
+public interface ProviderService {
+ DataModel sayHello(int wait, DataModel dataModel);
}
diff --git
a/java-chassis-benchmark/basic-3.0.x/consumer/src/main/resources/application.yml
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/resources/application.yml
new file mode 100644
index 0000000..597b7df
--- /dev/null
+++
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/resources/application.yml
@@ -0,0 +1,58 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+servicecomb:
+ service:
+ application: basic-application
+ name: consumer
+ version: 0.0.1
+
+ rest:
+ address: 0.0.0.0:9092
+
+spring:
+ profiles:
+ active: servicecomb # 注册中心类型:servicecomb 或者 nacos
+
+---
+spring:
+ config:
+ activate:
+ on-profile: servicecomb
+servicecomb:
+ # 注册发现
+ registry:
+ sc:
+ address: http://localhost:30100
+ # 动态配置
+ kie:
+ serverUri: http://localhost:30110
+
+---
+spring:
+ config:
+ activate:
+ on-profile: nacos
+servicecomb:
+ # 注册发现
+ registry:
+ nacos:
+ serverAddr: http://localhost:8848
+ # 动态配置
+ nacos:
+ serverAddr: http://localhost:8848
+
diff --git
a/java-chassis-benchmark/basic-3.0.x/consumer/src/main/resources/log4j2.xml
b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..2c557a8
--- /dev/null
+++ b/java-chassis-benchmark/basic-3.0.x/consumer/src/main/resources/log4j2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<Configuration>
+ <Properties>
+ <property name="FILE_PATH" value="./logs/consumer"/>
+ </Properties>
+
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d [%p][%t][%c:%L] %m%n"/>
+ </Console>
+
+ <RollingFile name="AccessLog" fileName="${FILE_PATH}/access.log"
+ filePattern="${FILE_PATH}/access-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="MetricsLog" fileName="${FILE_PATH}/metrics.log"
+ filePattern="${FILE_PATH}/metrics-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="SlowLog" fileName="${FILE_PATH}/slow.log"
+ filePattern="${FILE_PATH}/slow-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+ </Appenders>
+
+ <Loggers>
+ <Logger name="scb-access" level="INFO" additivity="false">
+ <AppenderRef ref="AccessLog"/>
+ </Logger>
+ <Logger name="scb-metrics" level="INFO" additivity="false">
+ <AppenderRef ref="MetricsLog"/>
+ </Logger>
+ <Logger name="scb-slow" level="INFO" additivity="false">
+ <AppenderRef ref="SlowLog"/>
+ </Logger>
+
+ <Root level="INFO">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
diff --git a/java-chassis-benchmark/basic-3.0.x/gateway/pom.xml
b/java-chassis-benchmark/basic-3.0.x/gateway/pom.xml
new file mode 100644
index 0000000..fab495f
--- /dev/null
+++ b/java-chassis-benchmark/basic-3.0.x/gateway/pom.xml
@@ -0,0 +1,49 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>basic-application-3.0.x</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-gateway-3.0.x</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>edge-core</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
b/java-chassis-benchmark/basic-3.0.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
similarity index 61%
copy from
java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
copy to
java-chassis-benchmark/basic-3.0.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
index 871ccb4..2d782e0 100644
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
+++
b/java-chassis-benchmark/basic-3.0.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
@@ -15,26 +15,22 @@
* limitations under the License.
*/
-package org.apache.servicecomb.demo.perf;
+package org.apache.servicecomb.samples;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.vertx.VertxUtils;
-
-public class PerfMain {
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+public class GatewayApplication {
public static void main(String[] args) throws Exception {
- BeanUtils.init();
-
- // redis
- RedisClientUtils.init(VertxUtils.getOrCreateVertxByName("transport",
null));
-
- List<String> argList = Arrays.asList(args);
- if (argList.contains("-c")) {
- PerfConsumer consumer =
BeanUtils.getContext().getBean(PerfConsumer.class);
- consumer.runConsumer();
+ try {
+ new SpringApplicationBuilder()
+ .web(WebApplicationType.NONE)
+ .sources(GatewayApplication.class)
+ .run(args);
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
}
diff --git
a/java-chassis-benchmark/basic-3.0.x/gateway/src/main/resources/application.yml
b/java-chassis-benchmark/basic-3.0.x/gateway/src/main/resources/application.yml
new file mode 100644
index 0000000..6d5a5be
--- /dev/null
+++
b/java-chassis-benchmark/basic-3.0.x/gateway/src/main/resources/application.yml
@@ -0,0 +1,73 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+servicecomb:
+ service:
+ application: basic-application
+ name: gateway
+ version: 0.0.1
+
+ rest:
+ address: 0.0.0.0:9090?sslEnabled=false
+
+ http:
+ dispatcher:
+ edge:
+ default:
+ enabled: false
+ url:
+ enabled: true
+ pattern: /(.*)
+ mappings:
+ consumer:
+ prefixSegmentCount: 0
+ path: "/.*"
+ microserviceName: consumer
+ versionRule: 0.0.0+
+
+spring:
+ profiles:
+ active: servicecomb # 注册中心类型:servicecomb 或者 nacos
+
+---
+spring:
+ config:
+ activate:
+ on-profile: servicecomb
+servicecomb:
+ # 注册发现
+ registry:
+ sc:
+ address: http://localhost:30100
+ # 动态配置
+ kie:
+ serverUri: http://localhost:30110
+
+---
+spring:
+ config:
+ activate:
+ on-profile: nacos
+servicecomb:
+ # 注册发现
+ registry:
+ nacos:
+ serverAddr: http://localhost:8848
+ # 动态配置
+ nacos:
+ serverAddr: http://localhost:8848
+
diff --git
a/java-chassis-benchmark/basic-3.0.x/gateway/src/main/resources/log4j2.xml
b/java-chassis-benchmark/basic-3.0.x/gateway/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..b24f8c5
--- /dev/null
+++ b/java-chassis-benchmark/basic-3.0.x/gateway/src/main/resources/log4j2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<Configuration>
+ <Properties>
+ <property name="FILE_PATH" value="./logs/gateway"/>
+ </Properties>
+
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d [%p][%t][%c:%L] %m%n"/>
+ </Console>
+
+ <RollingFile name="AccessLog" fileName="${FILE_PATH}/access.log"
+ filePattern="${FILE_PATH}/access-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="MetricsLog" fileName="${FILE_PATH}/metrics.log"
+ filePattern="${FILE_PATH}/metrics-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="SlowLog" fileName="${FILE_PATH}/slow.log"
+ filePattern="${FILE_PATH}/slow-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+ </Appenders>
+
+ <Loggers>
+ <Logger name="scb-access" level="INFO" additivity="false">
+ <AppenderRef ref="AccessLog"/>
+ </Logger>
+ <Logger name="scb-metrics" level="INFO" additivity="false">
+ <AppenderRef ref="MetricsLog"/>
+ </Logger>
+ <Logger name="scb-slow" level="INFO" additivity="false">
+ <AppenderRef ref="SlowLog"/>
+ </Logger>
+
+ <Root level="INFO">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
diff --git a/java-chassis-perfermance/pom.xml
b/java-chassis-benchmark/basic-3.0.x/pom.xml
similarity index 51%
copy from java-chassis-perfermance/pom.xml
copy to java-chassis-benchmark/basic-3.0.x/pom.xml
index bf2a136..1ff4cb0 100644
--- a/java-chassis-perfermance/pom.xml
+++ b/java-chassis-benchmark/basic-3.0.x/pom.xml
@@ -19,37 +19,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.servicecomb.samples.performance</groupId>
- <artifactId>performance-application</artifactId>
- <version>2.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Java Chassis::Demo::Perf</name>
+ <parent>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>benchmark-parent</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-application-3.0.x</artifactId>
+ <packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <servicecomb.version>2.6.0</servicecomb.version>
- <demo.main>org.apache.servicecomb.demo.perf.PerfMain</demo.main>
- <vertx.version>3.8.3</vertx.version>
+ <servicecomb.version>3.0.0-SNAPSHOT</servicecomb.version>
+ <spring-boot-maven-plugin.version>3.1.3</spring-boot-maven-plugin.version>
+ <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis</artifactId>
- <version>3.4.5</version>
- </dependency>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis-spring</artifactId>
- <version>1.3.0</version>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.46</version>
- </dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-dependencies</artifactId>
@@ -59,48 +47,74 @@
</dependency>
</dependencies>
</dependencyManagement>
-
+
<dependencies>
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>registry-service-center</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>provider-pojo</artifactId>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>benchmark-common</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>provider-springmvc</artifactId>
+ <artifactId>solution-basic</artifactId>
</dependency>
+ <!-- using log4j2 -->
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>transport-rest-vertx</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>transport-highway</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>inspector</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
</dependency>
+ </dependencies>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
+ <profiles>
+ <profile>
+ <id>servicecomb</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <!-- using service-center & kie -->
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>registry-service-center</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>config-kie</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>nacos</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <dependencies>
+ <!-- using service-center & kie -->
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>registry-nacos</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>config-nacos</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
- <dependency>
- <groupId>io.vertx</groupId>
- <artifactId>vertx-redis-client</artifactId>
- <version>${vertx.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>metrics-core</artifactId>
- </dependency>
- </dependencies>
+ <modules>
+ <module>provider</module>
+ <module>consumer</module>
+ <module>gateway</module>
+ </modules>
<build>
<pluginManagement>
@@ -108,29 +122,26 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
+ <version>${maven-compiler-plugin.version}</version>
<configuration>
- <source>1.8</source>
- <target>1.8</target>
<compilerArgument>-parameters</compilerArgument>
+ <source>17</source>
+ <target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>2.1.6.RELEASE</version>
+ <version>${spring-boot-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
- <configuration>
- <mainClass>${main.class}</mainClass>
- </configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/java-chassis-benchmark/basic-3.0.x/provider/pom.xml
b/java-chassis-benchmark/basic-3.0.x/provider/pom.xml
new file mode 100644
index 0000000..3c75ec9
--- /dev/null
+++ b/java-chassis-benchmark/basic-3.0.x/provider/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>basic-application-3.0.x</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-provider-3.0.x</artifactId>
+ <packaging>jar</packaging>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
b/java-chassis-benchmark/basic-3.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
similarity index 61%
copy from
java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
copy to
java-chassis-benchmark/basic-3.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
index 871ccb4..f429b34 100644
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
+++
b/java-chassis-benchmark/basic-3.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
@@ -15,26 +15,22 @@
* limitations under the License.
*/
-package org.apache.servicecomb.demo.perf;
+package org.apache.servicecomb.samples;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.vertx.VertxUtils;
-
-public class PerfMain {
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+public class ProviderApplication {
public static void main(String[] args) throws Exception {
- BeanUtils.init();
-
- // redis
- RedisClientUtils.init(VertxUtils.getOrCreateVertxByName("transport",
null));
-
- List<String> argList = Arrays.asList(args);
- if (argList.contains("-c")) {
- PerfConsumer consumer =
BeanUtils.getContext().getBean(PerfConsumer.class);
- consumer.runConsumer();
+ try {
+ new SpringApplicationBuilder()
+ .web(WebApplicationType.NONE)
+ .sources(ProviderApplication.class)
+ .run(args);
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
b/java-chassis-benchmark/basic-3.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
similarity index 55%
copy from
java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
copy to
java-chassis-benchmark/basic-3.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
index 871ccb4..b956fa1 100644
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
+++
b/java-chassis-benchmark/basic-3.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
@@ -15,26 +15,22 @@
* limitations under the License.
*/
-package org.apache.servicecomb.demo.perf;
+package org.apache.servicecomb.samples;
-import java.util.Arrays;
-import java.util.List;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.vertx.VertxUtils;
-
-public class PerfMain {
-
- public static void main(String[] args) throws Exception {
- BeanUtils.init();
-
- // redis
- RedisClientUtils.init(VertxUtils.getOrCreateVertxByName("transport",
null));
-
- List<String> argList = Arrays.asList(args);
- if (argList.contains("-c")) {
- PerfConsumer consumer =
BeanUtils.getContext().getBean(PerfConsumer.class);
- consumer.runConsumer();
+@RestSchema(schemaId = "ProviderController")
+@RequestMapping(path = "/")
+public class ProviderController {
+ @PostMapping("/benchmark")
+ public DataModel sayHello(@RequestHeader("wait") int wait, @RequestBody
DataModel dataModel) throws Exception {
+ if (wait > 0) {
+ Thread.sleep(wait);
}
+ return dataModel;
}
}
diff --git
a/java-chassis-benchmark/basic-3.0.x/provider/src/main/resources/application.yml
b/java-chassis-benchmark/basic-3.0.x/provider/src/main/resources/application.yml
new file mode 100644
index 0000000..939720b
--- /dev/null
+++
b/java-chassis-benchmark/basic-3.0.x/provider/src/main/resources/application.yml
@@ -0,0 +1,57 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+servicecomb:
+ service:
+ application: basic-application
+ name: provider
+ version: 0.0.1
+ rest:
+ address: 0.0.0.0:9093
+
+spring:
+ profiles:
+ active: servicecomb # 注册中心类型:servicecomb 或者 nacos
+
+---
+spring:
+ config:
+ activate:
+ on-profile: servicecomb
+servicecomb:
+ # 注册发现
+ registry:
+ sc:
+ address: http://localhost:30100
+ # 动态配置
+ kie:
+ serverUri: http://localhost:30110
+
+---
+spring:
+ config:
+ activate:
+ on-profile: nacos
+servicecomb:
+ # 注册发现
+ registry:
+ nacos:
+ serverAddr: http://localhost:8848
+ # 动态配置
+ nacos:
+ serverAddr: http://localhost:8848
+
diff --git
a/java-chassis-benchmark/basic-3.0.x/provider/src/main/resources/log4j2.xml
b/java-chassis-benchmark/basic-3.0.x/provider/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..3348204
--- /dev/null
+++ b/java-chassis-benchmark/basic-3.0.x/provider/src/main/resources/log4j2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<Configuration>
+ <Properties>
+ <property name="FILE_PATH" value="./logs/provider"/>
+ </Properties>
+
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d [%p][%t][%c:%L] %m%n"/>
+ </Console>
+
+ <RollingFile name="AccessLog" fileName="${FILE_PATH}/access.log"
+ filePattern="${FILE_PATH}/access-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="MetricsLog" fileName="${FILE_PATH}/metrics.log"
+ filePattern="${FILE_PATH}/metrics-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="SlowLog" fileName="${FILE_PATH}/slow.log"
+ filePattern="${FILE_PATH}/slow-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+ </Appenders>
+
+ <Loggers>
+ <Logger name="scb-access" level="INFO" additivity="false">
+ <AppenderRef ref="AccessLog"/>
+ </Logger>
+ <Logger name="scb-metrics" level="INFO" additivity="false">
+ <AppenderRef ref="MetricsLog"/>
+ </Logger>
+ <Logger name="scb-slow" level="INFO" additivity="false">
+ <AppenderRef ref="SlowLog"/>
+ </Logger>
+
+ <Root level="INFO">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
diff --git a/java-chassis-perfermance/src/main/resources/logback.xml
b/java-chassis-benchmark/common/pom.xml
similarity index 62%
rename from java-chassis-perfermance/src/main/resources/logback.xml
rename to java-chassis-benchmark/common/pom.xml
index 5264742..8dd1ada 100644
--- a/java-chassis-perfermance/src/main/resources/logback.xml
+++ b/java-chassis-benchmark/common/pom.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
@@ -16,14 +15,17 @@
~ limitations under the License.
-->
-<configuration scan="true">
- <jmxConfigurator/>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d[%level][%thread][%marker] - %msg (%F:%L\)%n</pattern>
- </encoder>
- </appender>
- <root level="INFO">
- <appender-ref ref="STDOUT"/>
- </root>
-</configuration>
\ No newline at end of file
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>benchmark-parent</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>benchmark-common</artifactId>
+ <packaging>jar</packaging>
+
+</project>
diff --git
a/java-chassis-benchmark/common/src/main/java/org/apache/servicecomb/samples/ChildDataModel.java
b/java-chassis-benchmark/common/src/main/java/org/apache/servicecomb/samples/ChildDataModel.java
new file mode 100644
index 0000000..672c6a1
--- /dev/null
+++
b/java-chassis-benchmark/common/src/main/java/org/apache/servicecomb/samples/ChildDataModel.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.samples;
+
+public class ChildDataModel {
+ private int numInt;
+
+ private long numLong;
+
+ private double numDouble;
+
+ private float numFloat;
+
+ private String data;
+
+ public int getNumInt() {
+ return numInt;
+ }
+
+ public void setNumInt(int numInt) {
+ this.numInt = numInt;
+ }
+
+ public long getNumLong() {
+ return numLong;
+ }
+
+ public void setNumLong(long numLong) {
+ this.numLong = numLong;
+ }
+
+ public double getNumDouble() {
+ return numDouble;
+ }
+
+ public void setNumDouble(double numDouble) {
+ this.numDouble = numDouble;
+ }
+
+ public float getNumFloat() {
+ return numFloat;
+ }
+
+ public void setNumFloat(float numFloat) {
+ this.numFloat = numFloat;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+}
diff --git
a/java-chassis-benchmark/common/src/main/java/org/apache/servicecomb/samples/DataModel.java
b/java-chassis-benchmark/common/src/main/java/org/apache/servicecomb/samples/DataModel.java
new file mode 100644
index 0000000..e0b1058
--- /dev/null
+++
b/java-chassis-benchmark/common/src/main/java/org/apache/servicecomb/samples/DataModel.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DataModel {
+ private Map<String, ChildDataModel> data;
+
+ public Map<String, ChildDataModel> getData() {
+ return data;
+ }
+
+ public void setData(Map<String, ChildDataModel> data) {
+ this.data = data;
+ }
+
+ public static DataModel create(String key, int size) {
+ DataModel dataModel = new DataModel();
+ Map<String, ChildDataModel> data = new HashMap<String,
ChildDataModel>(size);
+
+ for (int i = 0; i < size; i++) {
+ ChildDataModel childDataModel = new ChildDataModel();
+ childDataModel.setData("Have a nice day");
+ childDataModel.setNumDouble(3892382939.3333893D);
+ childDataModel.setNumFloat(87939873297.334F);
+ childDataModel.setNumInt(89273847);
+ childDataModel.setNumLong(983798787837438L);
+ data.put(key + i, childDataModel);
+ }
+
+ dataModel.setData(data);
+ return dataModel;
+ }
+}
diff --git a/java-chassis-benchmark/pom.xml b/java-chassis-benchmark/pom.xml
new file mode 100644
index 0000000..1ae9505
--- /dev/null
+++ b/java-chassis-benchmark/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>benchmark-parent</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
+ </properties>
+
+ <modules>
+ <module>common</module>
+ <module>basic-3.0.x</module>
+ <module>test-tool</module>
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <compilerArgument>-parameters</compilerArgument>
+ <source>17</source>
+ <target>17</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/java-chassis-perfermance/pom.xml
b/java-chassis-benchmark/test-tool/pom.xml
similarity index 57%
rename from java-chassis-perfermance/pom.xml
rename to java-chassis-benchmark/test-tool/pom.xml
index bf2a136..030e748 100644
--- a/java-chassis-perfermance/pom.xml
+++ b/java-chassis-benchmark/test-tool/pom.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
@@ -19,37 +18,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.servicecomb.samples.performance</groupId>
- <artifactId>performance-application</artifactId>
- <version>2.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Java Chassis::Demo::Perf</name>
+ <parent>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>benchmark-parent</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>test-tool</artifactId>
+ <packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <servicecomb.version>2.6.0</servicecomb.version>
- <demo.main>org.apache.servicecomb.demo.perf.PerfMain</demo.main>
- <vertx.version>3.8.3</vertx.version>
+ <servicecomb.version>3.0.0-SNAPSHOT</servicecomb.version>
+ <spring-boot-maven-plugin.version>3.1.3</spring-boot-maven-plugin.version>
+ <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis</artifactId>
- <version>3.4.5</version>
- </dependency>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis-spring</artifactId>
- <version>1.3.0</version>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.46</version>
- </dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>java-chassis-dependencies</artifactId>
@@ -59,46 +46,36 @@
</dependency>
</dependencies>
</dependencyManagement>
-
+
<dependencies>
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>registry-service-center</artifactId>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>benchmark-common</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>provider-pojo</artifactId>
+ <artifactId>solution-basic</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>provider-springmvc</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>transport-rest-vertx</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.servicecomb</groupId>
- <artifactId>transport-highway</artifactId>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>inspector</artifactId>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
-
- <dependency>
- <groupId>io.vertx</groupId>
- <artifactId>vertx-redis-client</artifactId>
- <version>${vertx.version}</version>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>metrics-core</artifactId>
+ <artifactId>registry-local</artifactId>
</dependency>
</dependencies>
@@ -108,25 +85,22 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
+ <version>${maven-compiler-plugin.version}</version>
<configuration>
- <source>1.8</source>
- <target>1.8</target>
<compilerArgument>-parameters</compilerArgument>
+ <source>17</source>
+ <target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>2.1.6.RELEASE</version>
+ <version>${spring-boot-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
- <configuration>
- <mainClass>${main.class}</mainClass>
- </configuration>
</execution>
</executions>
</plugin>
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Intf.java
b/java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/ProviderService.java
similarity index 75%
rename from
java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Intf.java
rename to
java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/ProviderService.java
index c671fda..00d560e 100644
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Intf.java
+++
b/java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/ProviderService.java
@@ -15,12 +15,8 @@
* limitations under the License.
*/
-package org.apache.servicecomb.demo.perf;
+package org.apache.servicecomb.samples;
-import java.util.concurrent.CompletableFuture;
-
-public interface Intf {
- String syncQuery(String id, int step, int all, boolean fromDB);
-
- CompletableFuture<String> asyncQuery(String id, int step, int all, boolean
fromDB);
+public interface ProviderService {
+ DataModel sayHello(int wait, DataModel dataModel);
}
diff --git
a/java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/TestCaseService.java
b/java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/TestCaseService.java
new file mode 100644
index 0000000..b44cee3
--- /dev/null
+++
b/java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/TestCaseService.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.samples;
+
+import java.time.Duration;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.stereotype.Component;
+
+import io.micrometer.core.instrument.DistributionSummary;
+import io.micrometer.core.instrument.Meter;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.distribution.CountAtBucket;
+import io.micrometer.core.instrument.distribution.HistogramSnapshot;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
+
+@Component
+public class TestCaseService {
+ @RpcReference(schemaId = "ProviderController", microserviceName = "gateway")
+ private ProviderService providerService;
+
+ private AtomicLong success = new AtomicLong(0);
+
+ private AtomicLong error = new AtomicLong(0);
+
+ private AtomicLong totalTime = new AtomicLong(0);
+
+ private static MeterRegistry registry = null;
+
+ private static DistributionSummary summary = null;
+
+ public TestCaseService() {
+ init();
+ }
+
+ protected void init() {
+ registerMetrics();
+ }
+
+ private void registerMetrics() {
+ if (registry != null) {
+ registry.close();
+ }
+ registry = new SimpleMeterRegistry();
+ summary = DistributionSummary
+ .builder("response.time")
+ .description("response.time")
+ .tags("response.time", "test") // optional
+ .distributionStatisticExpiry(Duration.ofMinutes(10))
+ .serviceLevelObjectives(10D, 20D, 50D, 100D, 200D, 500D, 1000D,
1000000D)
+ .register(registry);
+ }
+
+ public void run(int threadCount, int countPerThread, int wait, int dataSize)
throws Exception {
+ System.out.println("Preparing run
=======================================");
+ DataModel dataModel = DataModel.create("test-case", dataSize);
+
+ ExecutorService executor = Executors.newFixedThreadPool(threadCount, new
ThreadFactory() {
+ AtomicLong count = new AtomicLong(0);
+
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "test-thread" + count.getAndIncrement());
+ }
+ });
+ CountDownLatch initLatch = new CountDownLatch(threadCount);
+ for (int i = 0; i < threadCount; i++) {
+ executor.submit(() -> {
+ providerService.sayHello(wait, dataModel);
+ initLatch.countDown();
+ });
+ }
+ initLatch.await();
+
+ success.set(0);
+ error.set(0);
+ totalTime.set(0);
+ registerMetrics();
+
+ // run
+ System.out.println("Starting run =======================================");
+
+ CountDownLatch latch = new CountDownLatch(threadCount * countPerThread);
+ long begin = System.currentTimeMillis();
+ for (int i = 0; i < threadCount; i++) {
+ executor.submit(() -> {
+ for (int j = 0; j < countPerThread; j++) {
+ long b = System.currentTimeMillis();
+ try {
+ DataModel result = providerService.sayHello(wait, dataModel);
+ if (result.getData().size() != dataSize) {
+ error.incrementAndGet();
+ } else {
+ success.incrementAndGet();
+ }
+ } catch (Exception e) {
+ error.incrementAndGet();
+ }
+
+ totalTime.addAndGet(System.currentTimeMillis() - b);
+ summary.record(System.currentTimeMillis() - b);
+ latch.countDown();
+ }
+ });
+ }
+
+ latch.await();
+
+ System.out.println("Total time:" + (System.currentTimeMillis() - begin));
+ System.out.println("Success count:" + success.get());
+ System.out.println("Error count:" + error.get());
+ System.out.println("Success average Latency:" + totalTime.get() /
(success.get() + error.get()));
+
+ List<Meter> meters = registry.getMeters();
+
+ for (Meter meter : meters) {
+ if ("response.time".equals(meter.getId().getName())) {
+ DistributionSummary distributionSummary = (DistributionSummary) meter;
+ HistogramSnapshot histogramSnapshot =
distributionSummary.takeSnapshot();
+ CountAtBucket[] countAtBuckets = histogramSnapshot.histogramCounts();
+ System.out.println(histogramSnapshot);
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < countAtBuckets.length; i++) {
+ if (i == 0) {
+ sb.append("|(0, " +
Double.valueOf(countAtBuckets[i].bucket()).intValue()
+ + ")" + Double.valueOf(countAtBuckets[i].count()).intValue());
+ continue;
+ }
+ sb.append("|(" + Double.valueOf(countAtBuckets[i -
1].bucket()).intValue() + "," +
+ Double.valueOf(countAtBuckets[i].bucket()).intValue() +
+ ")" + Double.valueOf(countAtBuckets[i].count() -
countAtBuckets[i - 1].count()).intValue() + "|");
+ }
+ System.out.println(sb);
+ }
+ }
+
+ executor.shutdownNow();
+ }
+}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
b/java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/TestToolApplication.java
similarity index 57%
rename from
java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
rename to
java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/TestToolApplication.java
index 871ccb4..df85396 100644
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfMain.java
+++
b/java-chassis-benchmark/test-tool/src/main/java/org/apache/servicecomb/samples/TestToolApplication.java
@@ -15,26 +15,30 @@
* limitations under the License.
*/
-package org.apache.servicecomb.demo.perf;
-
-import java.util.Arrays;
-import java.util.List;
+package org.apache.servicecomb.samples;
import org.apache.servicecomb.foundation.common.utils.BeanUtils;
-import org.apache.servicecomb.foundation.vertx.VertxUtils;
-
-public class PerfMain {
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+public class TestToolApplication {
public static void main(String[] args) throws Exception {
- BeanUtils.init();
-
- // redis
- RedisClientUtils.init(VertxUtils.getOrCreateVertxByName("transport",
null));
+ try {
+ new SpringApplicationBuilder()
+ .web(WebApplicationType.NONE)
+ .sources(TestToolApplication.class)
+ .run(args);
- List<String> argList = Arrays.asList(args);
- if (argList.contains("-c")) {
- PerfConsumer consumer =
BeanUtils.getContext().getBean(PerfConsumer.class);
- consumer.runConsumer();
+ runTests();
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
+
+ private static void runTests() throws Exception {
+ TestCaseService testCaseService = BeanUtils.getBean(TestCaseService.class);
+ testCaseService.run(10, 1000, 0, 1);
+ }
}
diff --git
a/java-chassis-benchmark/test-tool/src/main/resources/application.yml
b/java-chassis-benchmark/test-tool/src/main/resources/application.yml
new file mode 100644
index 0000000..6a7a115
--- /dev/null
+++ b/java-chassis-benchmark/test-tool/src/main/resources/application.yml
@@ -0,0 +1,25 @@
+#
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+servicecomb:
+ service:
+ application: basic-application
+ name: consumer
+ version: 0.0.1
+
+ rest:
+ address: 0.0.0.0:19092
diff --git a/java-chassis-benchmark/test-tool/src/main/resources/log4j2.xml
b/java-chassis-benchmark/test-tool/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..e14d65e
--- /dev/null
+++ b/java-chassis-benchmark/test-tool/src/main/resources/log4j2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<Configuration>
+ <Properties>
+ <property name="FILE_PATH" value="./logs/test-tool"/>
+ </Properties>
+
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d [%p][%t][%c:%L] %m%n"/>
+ </Console>
+
+ <RollingFile name="AccessLog" fileName="${FILE_PATH}/access.log"
+ filePattern="${FILE_PATH}/access-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="MetricsLog" fileName="${FILE_PATH}/metrics.log"
+ filePattern="${FILE_PATH}/metrics-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+
+ <RollingFile name="SlowLog" fileName="${FILE_PATH}/slow.log"
+ filePattern="${FILE_PATH}/slow-%d{yyyy-MM-dd}_%i.log.gz">
+ <PatternLayout pattern="%d [%t] %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="20MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="100"/>
+ </RollingFile>
+ </Appenders>
+
+ <Loggers>
+ <Logger name="scb-access" level="INFO" additivity="false">
+ <AppenderRef ref="AccessLog"/>
+ </Logger>
+ <Logger name="scb-metrics" level="INFO" additivity="false">
+ <AppenderRef ref="MetricsLog"/>
+ </Logger>
+ <Logger name="scb-slow" level="INFO" additivity="false">
+ <AppenderRef ref="SlowLog"/>
+ </Logger>
+
+ <Root level="INFO">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
diff --git
a/java-chassis-benchmark/test-tool/src/main/resources/microservices/gateway/ProviderController.yaml
b/java-chassis-benchmark/test-tool/src/main/resources/microservices/gateway/ProviderController.yaml
new file mode 100644
index 0000000..446d232
--- /dev/null
+++
b/java-chassis-benchmark/test-tool/src/main/resources/microservices/gateway/ProviderController.yaml
@@ -0,0 +1,88 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+openapi: 3.0.1
+info:
+ title: swagger definition for
org.apache.servicecomb.samples.ProviderController
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /benchmark:
+ post:
+ operationId: sayHello
+ parameters:
+ - name: wait
+ in: header
+ required: true
+ schema:
+ type: integer
+ format: int32
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DataModel'
+ application/protobuf:
+ schema:
+ $ref: '#/components/schemas/DataModel'
+ text/plain:
+ schema:
+ $ref: '#/components/schemas/DataModel'
+ required: true
+ x-name: dataModel
+ responses:
+ "200":
+ description: response of 200
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DataModel'
+ application/protobuf:
+ schema:
+ $ref: '#/components/schemas/DataModel'
+ text/plain:
+ schema:
+ $ref: '#/components/schemas/DataModel'
+components:
+ schemas:
+ ChildDataModel:
+ type: object
+ properties:
+ numInt:
+ type: integer
+ format: int32
+ numLong:
+ type: integer
+ format: int64
+ numDouble:
+ type: number
+ format: double
+ numFloat:
+ type: number
+ format: float
+ data:
+ type: string
+ x-java-class: org.apache.servicecomb.samples.ChildDataModel
+ DataModel:
+ type: object
+ properties:
+ data:
+ type: object
+ additionalProperties:
+ $ref: '#/components/schemas/ChildDataModel'
+ x-java-class: org.apache.servicecomb.samples.DataModel
diff --git a/java-chassis-benchmark/test-tool/src/main/resources/registry.yaml
b/java-chassis-benchmark/test-tool/src/main/resources/registry.yaml
new file mode 100644
index 0000000..0fce4dc
--- /dev/null
+++ b/java-chassis-benchmark/test-tool/src/main/resources/registry.yaml
@@ -0,0 +1,26 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+gateway:
+ - id: "001"
+ version: "1.0"
+ appid: basic-application
+ schemaIds:
+ - ProviderController
+ instances:
+ - endpoints:
+ - rest://localhost:9090
diff --git a/java-chassis-perfermance/README.md
b/java-chassis-perfermance/README.md
deleted file mode 100644
index 7c6a5a9..0000000
--- a/java-chassis-perfermance/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-## Precondition
-see [Precondition](../README.md)
-
-suppose jar named perf.jar
-1.copy perf.jar to different directory
-
-2.create microservice.yaml in each directory
-# change microserviceName to be perf1/perf2/perf3, and so on
-service_description:
- name: perf1
-cse:
- references:
- # use which transport to invoke
- transport: rest
-
-# sync mode consumer count
-sync-count: 10
-# async mode consumer count
-async-count: 20
-# use sync mode or not
-# sync: /v1/syncQuery/{id}?step={step}&all={all}&fromDB={fromDB}
-# async:/v1/asyncQuery/{id}?step={step}&all={all}&fromDB={fromDB}
-sync: false
-# producer microserviceName
-producer: perf1
-id: 1
-# every producer determine:
-# 1)if step equals all, then this is final step, direct return or query from
db
-# 2)otherwise inc step and invoke next microservice
-# 3)if self name if perf1, then next microservice is perf2
-step: 1
-all: 1
-fromDB: false
-response-size: 1
-
-# redis parameter
-redis:
- client:
- count: 8
- host:
- port:
- password:
-
-3.start producers
-java -jar perf.jar
-
-4.start consumer
-java -jar perf.jar -c
-
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Code.java
b/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Code.java
deleted file mode 100644
index 92a93c2..0000000
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Code.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.demo.perf;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.io.FileUtils;
-
-// git log --author="wujimin" --pretty=tformat:%s --shortstat --since
==2017-9-1
-public class Code {
- static File file = new
File("d:/work/git/incubator-servicecomb-java-chassis/0218.txt");
-
- public static void main(String[] args) throws IOException {
- List<String> lines = FileUtils.readLines(file, StandardCharsets.UTF_8);
-
- int totalAdd = 0;
- int totalDel = 0;
- List<String> output = new ArrayList<>();
- System.out.println(lines.size());
- for (int idx = 0; idx < lines.size(); ) {
- String msg = lines.get(idx);
-
- // skip a empty line
- idx += 2;
- // 2 files changed, 2 insertions(+), 2 deletions(-)
- String line = lines.get(idx);
- idx++;
-// System.out.println(idx + ": " + msg);
-
- int add = 0;
- int delete = 0;
- for (String part : line.split(",")) {
- String key = " insertions(+)";
- int matchIdx = part.indexOf(key);
- if (matchIdx > 0) {
- add = Integer.valueOf(part.substring(0, matchIdx).trim());
- continue;
- }
-
- key = " deletions(-)";
- matchIdx = part.indexOf(key);
- if (matchIdx > 0) {
- delete = Integer.valueOf(part.substring(0, matchIdx).trim());
- continue;
- }
- }
-
- totalAdd += add;
- totalDel += delete;
- output.add(String.format("%d | %d | %s", add, delete, msg));
- }
-
- output.add(String.format("summary, add: %d, del: %s", totalAdd, totalDel));
- System.out.println(String.join("\n", output));
- }
-}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Impl.java
b/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Impl.java
deleted file mode 100644
index e2505ed..0000000
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/Impl.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.demo.perf;
-
-import java.util.concurrent.CompletableFuture;
-
-import org.apache.servicecomb.provider.pojo.Invoker;
-import org.apache.servicecomb.provider.rest.common.RestSchema;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-@RestSchema(schemaId = "impl")
-@RequestMapping(path = "/v1")
-public class Impl {
- private Intf intf;
-
- @Value(value = "${service_description.name}")
- public void setSelfMicroserviceName(String selfMicroserviceName) {
- // self: perf-1/perf-a
- // next: perf-2/perf-b
- char last = selfMicroserviceName.charAt(selfMicroserviceName.length() - 1);
- String nextMicroserviceName =
- selfMicroserviceName.substring(0, selfMicroserviceName.length() - 1) +
(char) (last + 1);
- intf = Invoker.createProxy(nextMicroserviceName,
- "impl",
- Intf.class);
- }
-
- @GetMapping(path = "/syncQuery/{id}")
- public String syncQuery(@PathVariable(name = "id") String id,
- @RequestParam(name = "step") int step, @RequestParam(name = "all") int
all,
- @RequestParam(name = "fromDB") boolean fromDB) {
- if (step == all) {
- if (fromDB) {
- return RedisClientUtils.syncQuery(id);
- }
-
- return buildFromMemoryResponse(id);
- }
-
- return intf.syncQuery(id, step + 1, all, fromDB);
- }
-
- public String buildFromMemoryResponse(String id) {
- return PerfConfiguration.buildResponse("memory", id);
- }
-
- @GetMapping(path = "/asyncQuery/{id}")
- public CompletableFuture<String> asyncQuery(@PathVariable(name = "id")
String id,
- @RequestParam(name = "step") int step, @RequestParam(name = "all") int
all,
- @RequestParam(name = "fromDB") boolean fromDB) {
- if (step == all) {
- if (fromDB) {
- return RedisClientUtils.asyncQuery(id);
- }
-
- CompletableFuture<String> future = new CompletableFuture<>();
- future.complete(buildFromMemoryResponse(id));
- return future;
- }
-
- return intf.asyncQuery(id, step + 1, all, fromDB);
- }
-}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfConfiguration.java
b/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfConfiguration.java
deleted file mode 100644
index 8d750b0..0000000
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfConfiguration.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.demo.perf;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import com.google.common.base.Strings;
-
-@Component
-public class PerfConfiguration {
- public static int syncCount;
-
- public static int asyncCount;
-
- public static boolean sync;
-
- public static String producer;
-
- public static String id;
-
- public static int step;
-
- public static int all;
-
- public static boolean fromDB;
-
- public static int responseSize;
-
- public static String responseData;
-
- public static int redisClientCount;
-
- public static String redisHost;
-
- public static int redisPort;
-
- public static String redisPassword;
-
- public static String buildResponse(String from, String id) {
- return new StringBuilder(64 + PerfConfiguration.responseData.length())
- .append(id)
- .append(" from ")
- .append(from)
- .append(": ")
- .append(PerfConfiguration.responseData)
- .toString();
- }
-
- @Value(value = "${response-size}")
- public void setResponseSize(int responseSize) {
- PerfConfiguration.responseSize = responseSize;
- PerfConfiguration.responseData = Strings.repeat("a", responseSize);
- }
-
- @Value(value = "${sync-count}")
- public void setSyncCount(int syncCount) {
- PerfConfiguration.syncCount = syncCount;
- }
-
- @Value(value = "${async-count}")
- public void setAsyncCount(int asyncCount) {
- PerfConfiguration.asyncCount = asyncCount;
- }
-
- @Value(value = "${sync}")
- public void setSync(boolean sync) {
- PerfConfiguration.sync = sync;
- }
-
- @Value(value = "${producer}")
- public void setProducer(String producer) {
- PerfConfiguration.producer = producer;
- }
-
- @Value(value = "${id}")
- public void setId(String id) {
- PerfConfiguration.id = id;
- }
-
- @Value(value = "${step}")
- public void setStep(int step) {
- PerfConfiguration.step = step;
- }
-
- @Value(value = "${all}")
- public void setAll(int all) {
- PerfConfiguration.all = all;
- }
-
- @Value(value = "${fromDB}")
- public void setFromDB(boolean fromDB) {
- PerfConfiguration.fromDB = fromDB;
- }
-
- @Value(value = "${redis.client.count}")
- public void setRedisClientCount(int redisClientCount) {
- PerfConfiguration.redisClientCount = redisClientCount;
- }
-
- @Value(value = "${redis.host}")
- public void setRedisHost(String redisHost) {
- PerfConfiguration.redisHost = redisHost;
- }
-
- @Value(value = "${redis.port}")
- public void setRedisPort(int redisPort) {
- PerfConfiguration.redisPort = redisPort;
- }
-
- @Value(value = "${redis.password:}")
- public void setRedisPassword(String redisPassword) {
- if (StringUtils.isEmpty(redisPassword)) {
- return;
- }
- PerfConfiguration.redisPassword = redisPassword;
- }
-}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfConsumer.java
b/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfConsumer.java
deleted file mode 100644
index a73b768..0000000
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/PerfConsumer.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.demo.perf;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-import org.apache.servicecomb.provider.pojo.Invoker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-@Component
-public class PerfConsumer {
- private static final Logger LOGGER =
LoggerFactory.getLogger(PerfConsumer.class);
-
- private Intf intf;
-
- public void runConsumer() throws InterruptedException, ExecutionException {
- intf = Invoker.createProxy(
- PerfConfiguration.producer,
- "impl",
- Intf.class);
-
- if (PerfConfiguration.sync) {
- runSyncConsumers();
- return;
- }
-
- runAsyncConsumers();
- }
-
- private void runAsyncConsumers() throws InterruptedException,
ExecutionException {
- CompletableFuture<String> future = intf.asyncQuery(PerfConfiguration.id,
- PerfConfiguration.step,
- PerfConfiguration.all,
- PerfConfiguration.fromDB);
- LOGGER.info("runAsyncConsumer: {}", future.get());
-
- for (int idx = 0; idx < PerfConfiguration.asyncCount; idx++) {
- runAsyncConsumer();
- }
- }
-
- private void runAsyncConsumer() {
- CompletableFuture<String> future = intf.asyncQuery(PerfConfiguration.id,
- PerfConfiguration.step,
- PerfConfiguration.all,
- PerfConfiguration.fromDB);
- future.whenComplete((r, e) -> {
- if (e == null) {
- runAsyncConsumer();
- return;
- }
-
- throw new IllegalStateException("invoke failed.", e);
- });
- }
-
- private void runSyncConsumers() {
- LOGGER.info("runSyncConsumer: {}",
- intf.syncQuery(PerfConfiguration.id,
- PerfConfiguration.step,
- PerfConfiguration.all,
- PerfConfiguration.fromDB));
-
- Executor executor =
Executors.newFixedThreadPool(PerfConfiguration.syncCount);
- for (int idx = 0; idx < PerfConfiguration.syncCount; idx++) {
- executor.execute(this::runSyncConsumer);
- }
- }
-
- private void runSyncConsumer() {
- try {
- for (; ; ) {
- intf.syncQuery(PerfConfiguration.id,
- PerfConfiguration.step,
- PerfConfiguration.all,
- PerfConfiguration.fromDB);
- }
- } catch (Throwable e) {
- throw new IllegalStateException("invoke failed.", e);
- }
- }
-}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/RedisClientUtils.java
b/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/RedisClientUtils.java
deleted file mode 100644
index 0ce693a..0000000
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/RedisClientUtils.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.demo.perf;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.apache.servicecomb.foundation.vertx.VertxUtils;
-import org.apache.servicecomb.foundation.vertx.client.ClientPoolFactory;
-import org.apache.servicecomb.foundation.vertx.client.ClientPoolManager;
-import org.apache.servicecomb.foundation.vertx.client.ClientVerticle;
-import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
-
-import io.vertx.core.DeploymentOptions;
-import io.vertx.core.Vertx;
-import io.vertx.redis.RedisClient;
-import io.vertx.redis.RedisOptions;
-
-public class RedisClientUtils {
- private static ClientPoolManager<RedisClient> clientMgr;
-
- public static void init(Vertx vertx) throws InterruptedException {
- RedisOptions redisOptions = new RedisOptions()
- .setHost(PerfConfiguration.redisHost)
- .setPort(PerfConfiguration.redisPort)
- .setAuth(PerfConfiguration.redisPassword);
- ClientPoolFactory<RedisClient> factory = (ctx) -> {
- return RedisClient.create(vertx, redisOptions);
- };
- clientMgr = new ClientPoolManager<>(vertx, factory);
-
- DeploymentOptions deployOptions =
VertxUtils.createClientDeployOptions(clientMgr,
- PerfConfiguration.redisClientCount);
- VertxUtils.blockDeploy(vertx, ClientVerticle.class, deployOptions);
- }
-
- public static String syncQuery(String id) {
- CompletableFuture<String> future = doQuery(id, true);
- try {
- return future.get();
- } catch (InterruptedException | ExecutionException e) {
- throw new
InvocationException(Status.INTERNAL_SERVER_ERROR.getStatusCode(),
- Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), (Object) "Failed to
query from redis.", e);
- }
- }
-
- public static CompletableFuture<String> asyncQuery(String id) {
- return doQuery(id, false);
- }
-
- private static CompletableFuture<String> doQuery(String id, boolean sync) {
- CompletableFuture<String> future = new CompletableFuture<>();
- RedisClient redisClient = clientMgr.findClientPool(sync);
- RedisSession session = new RedisSession(redisClient, id, future);
- session.query();
- return future;
- }
-}
diff --git
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/RedisSession.java
b/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/RedisSession.java
deleted file mode 100644
index f9d657f..0000000
---
a/java-chassis-perfermance/src/main/java/org/apache/servicecomb/demo/perf/RedisSession.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.demo.perf;
-
-import java.util.concurrent.CompletableFuture;
-
-import io.vertx.core.AsyncResult;
-import io.vertx.redis.RedisClient;
-
-public class RedisSession {
- RedisClient redis;
-
- String id;
-
- CompletableFuture<String> future;
-
- String createResult;
-
- public RedisSession(RedisClient redis, String id, CompletableFuture<String>
future) {
- this.redis = redis;
- this.id = id;
- this.future = future;
- }
-
- public void query() {
- redis.get(id, this::onGetResponse);
- }
-
- private void onGetResponse(AsyncResult<String> ar) {
- if (ar.succeeded()) {
- if (ar.result() == null) {
- createCache();
- return;
- }
-
- future.complete(ar.result());
- return;
- }
-
- future.completeExceptionally(ar.cause());
- }
-
- private void createCache() {
- createResult = PerfConfiguration.buildResponse("redis", id);
- redis.set(id, createResult, this::onCreateCacheResponse);
- }
-
- private void onCreateCacheResponse(AsyncResult<Void> ar) {
- if (ar.succeeded()) {
- future.complete(createResult);
- return;
- }
-
- future.completeExceptionally(ar.cause());
- }
-}
diff --git a/java-chassis-perfermance/src/main/resources/microservice.yaml
b/java-chassis-perfermance/src/main/resources/microservice.yaml
deleted file mode 100644
index 4a26c08..0000000
--- a/java-chassis-perfermance/src/main/resources/microservice.yaml
+++ /dev/null
@@ -1,79 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-
-APPLICATION_ID: perfTest
-service_description:
- name: perf1
- version: 0.0.1
-servicecomb:
- service:
- registry:
- address: http://127.0.0.1:30100
- rest:
- address: 0.0.0.0:8080?sslEnabled=false
- server:
- verticle-count: 8
- client:
- verticle-count: 8
- connection:
- maxPoolSize: 30
- highway:
- address: 0.0.0.0:7070?sslEnabled=false
- server:
- verticle-count: 8
- client:
- verticle-count: 8
- executor:
- default:
- group: 4
- maxThreads-per-group: 4
- references:
- transport: highway
- transport: rest
- metrics:
- endpoint:
- enabled: false
- window_time: 1000
- invocation.latencyDistribution: 0,1,3,10,100
- Consumer.invocation.slow:
- enabled: true
- msTime: 40
- Provider.invocation.slow:
- enabled: true
- msTime: 1
- publisher.defaultLog:
- enabled: true
- endpoints.client.detail.enabled: true
- invocation.latencyDistribution:
- minScopeLength: 9
-
-sync-count: 10
-async-count: 10
-sync: false
-producer: perf1
-id: 1
-step: 1
-all: 1
-fromDB: false
-response-size: 1
-
-redis:
- client:
- count: 8
- host: localhost
- port: 6379
-# password: