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 6206085 add comparison to spring cloud
6206085 is described below
commit 620608560df864a55ce39093a8411469338c4363
Author: liubao <[email protected]>
AuthorDate: Tue Dec 5 10:17:05 2023 +0800
add comparison to spring cloud
---
java-chassis-benchmark/pom.xml | 1 +
.../spring-cloud-2022.0.x/consumer/pom.xml | 56 ++++++++++++++
.../servicecomb/samples/ConsumerApplication.java | 40 ++++++++++
.../servicecomb/samples/ConsumerController.java | 37 +++++++++
.../servicecomb/samples/ProviderService.java | 29 +++++++
.../consumer/src/main/resources/bootstrap.yml | 62 +++++++++++++++
.../consumer/src/main/resources/log4j2.xml | 59 ++++++++++++++
.../spring-cloud-2022.0.x/gateway/pom.xml | 45 +++++++++++
.../servicecomb/samples/GatewayApplication.java | 36 +++++++++
.../gateway/src/main/resources/application.yaml | 33 ++++++++
.../gateway/src/main/resources/bootstrap.yml | 62 +++++++++++++++
.../gateway/src/main/resources/log4j2.xml | 59 ++++++++++++++
.../spring-cloud-2022.0.x/pom.xml | 89 ++++++++++++++++++++++
.../spring-cloud-2022.0.x/provider/pom.xml | 60 +++++++++++++++
.../servicecomb/samples/ProviderApplication.java | 36 +++++++++
.../servicecomb/samples/ProviderController.java | 36 +++++++++
.../provider/src/main/resources/bootstrap.yml | 62 +++++++++++++++
.../provider/src/main/resources/log4j2.xml | 59 ++++++++++++++
18 files changed, 861 insertions(+)
diff --git a/java-chassis-benchmark/pom.xml b/java-chassis-benchmark/pom.xml
index c6448af..972f096 100644
--- a/java-chassis-benchmark/pom.xml
+++ b/java-chassis-benchmark/pom.xml
@@ -40,6 +40,7 @@
<module>basic-1.3.x</module> -->
<module>basic-2.8.x</module>
<module>basic-3.0.x</module>
+ <module>spring-cloud-2022.0.x</module>
<module>test-tool</module>
</modules>
diff --git a/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/pom.xml
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/pom.xml
new file mode 100644
index 0000000..97f6b44
--- /dev/null
+++ b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/pom.xml
@@ -0,0 +1,56 @@
+<!--
+ ~ 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-spring-cloud-2022.0.x</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-consumer-spring-cloud-2022.0.x</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.huaweicloud</groupId>
+ <artifactId>spring-cloud-starter-huawei-service-engine</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-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
new file mode 100644
index 0000000..b1c9ff5
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java
@@ -0,0 +1,40 @@
+/*
+ * 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.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@SpringBootApplication
+@EnableDiscoveryClient
+@EnableFeignClients
+public class ConsumerApplication {
+ public static void main(String[] args) throws Exception {
+ try {
+ new SpringApplicationBuilder()
+ .web(WebApplicationType.SERVLET)
+ .sources(ConsumerApplication.class)
+ .run(args);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java
new file mode 100644
index 0000000..0513444
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.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.springframework.beans.factory.annotation.Autowired;
+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.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping(path = "/")
+public class ConsumerController {
+ @Autowired
+ 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-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
new file mode 100644
index 0000000..2c2b31b
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java
@@ -0,0 +1,29 @@
+/*
+ * 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.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+
+@FeignClient(name = "provider")
+public interface ProviderService {
+ @PostMapping("/benchmark")
+ DataModel sayHello(@RequestHeader("wait") int wait, @RequestBody DataModel
dataModel);
+}
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/resources/bootstrap.yml
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..d795d60
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/resources/bootstrap.yml
@@ -0,0 +1,62 @@
+#
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+server:
+ port: 9094
+
+spring:
+ application:
+ # 微服务名称。 微服务名称定义好以后,后续不能变更。
+ name: consumer
+
+ cloud:
+ servicecomb:
+ # 微服务的基本信息
+ service:
+ # 微服务名称,和spring.application.name保持一致。
+ name: ${spring.application.name}
+ # 微服务版本号,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改版本号,防止契约注册失败。
+ version: ${CAS_INSTANCE_VERSION:0.0.1}
+ # 应用名称。默认情况下只有应用名称相同的微服务之间才可以相互发现。
+ application: ${CAS_APPLICATION_NAME:basic-application}
+ # 环境名称。只有环境名称相同的微服务之间才可以相互发现。
+ # 可以取值 development, testing, acceptance, production
+ environment: production
+ # 注册发现相关配置
+ discovery:
+ # 注册中心地址,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改地址。
+ address: ${PAAS_CSE_SC_ENDPOINT:http://127.0.0.1:30100}
+ # 微服务向CSE发送心跳间隔时间,单位秒
+ healthCheckInterval: 10
+ # 拉取实例的轮询时间,单位毫秒
+ pollInterval: 15000
+ # 优雅停机设置。优雅停机后,先从注册中心注销自己。这个时间表示注销自己后等待的时间,这个时间后才退出。
+ waitTimeForShutDownInMillis: 15000
+ config:
+ # 配置中心地址,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改地址。
+ serverAddr: ${PAAS_CSE_CC_ENDPOINT:http://127.0.0.1:30110}
+ serverType: kie
+ # 自定义配置
+ kie:
+ customLabel: ${spring.application.name}
+ customLabelValue: ${INSTANCE_TAG:default}
+ metrics:
+ logsEnabled: true
+ logsInterval: PT1M # Duration表达式,打印周期
\ No newline at end of file
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/resources/log4j2.xml
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..46de1a2
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/consumer/src/main/resources/log4j2.xml
@@ -0,0 +1,59 @@
+<?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>
+ </Appenders>
+
+ <Loggers>
+ <AsyncLogger name="access_logger" level="INFO" additivity="false">
+ <AppenderRef ref="AccessLog"/>
+ </AsyncLogger>
+ <AsyncLogger name="metrics_logger" level="INFO" additivity="false">
+ <AppenderRef ref="MetricsLog"/>
+ </AsyncLogger>
+
+ <Root level="INFO">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
diff --git a/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/pom.xml
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/pom.xml
new file mode 100644
index 0000000..2d08cfa
--- /dev/null
+++ b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/pom.xml
@@ -0,0 +1,45 @@
+<!--
+ ~ 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-spring-cloud-2022.0.x</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-gateway-spring-cloud-2022.0.x</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.huaweicloud</groupId>
+
<artifactId>spring-cloud-starter-huawei-service-engine-gateway</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-benchmark/spring-cloud-2022.0.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
new file mode 100644
index 0000000..4177bf0
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java
@@ -0,0 +1,36 @@
+/*
+ * 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.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 {
+ try {
+ new SpringApplicationBuilder()
+ .web(WebApplicationType.REACTIVE)
+ .sources(GatewayApplication.class)
+ .run(args);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/application.yaml
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/application.yaml
new file mode 100644
index 0000000..bb24167
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/application.yaml
@@ -0,0 +1,33 @@
+#
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+spring:
+ cloud:
+ gateway:
+ routes:
+ - id: consumer
+ uri: lb://consumer
+ predicates:
+ - Path=/**
+
+ httpclient:
+ pool:
+ maxConnections: 50
+ maxIdleTime: PT300S
+ maxLifeTime: PT600S
+ evictionInterval: PT600S
+ type: FIXED
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/bootstrap.yml
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..fb1d740
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/bootstrap.yml
@@ -0,0 +1,62 @@
+#
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+server:
+ port: 9090
+
+spring:
+ application:
+ # 微服务名称。 微服务名称定义好以后,后续不能变更。
+ name: gateway
+
+ cloud:
+ servicecomb:
+ # 微服务的基本信息
+ service:
+ # 微服务名称,和spring.application.name保持一致。
+ name: ${spring.application.name}
+ # 微服务版本号,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改版本号,防止契约注册失败。
+ version: ${CAS_INSTANCE_VERSION:0.0.1}
+ # 应用名称。默认情况下只有应用名称相同的微服务之间才可以相互发现。
+ application: ${CAS_APPLICATION_NAME:basic-application}
+ # 环境名称。只有环境名称相同的微服务之间才可以相互发现。
+ # 可以取值 development, testing, acceptance, production
+ environment: production
+ # 注册发现相关配置
+ discovery:
+ # 注册中心地址,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改地址。
+ address: ${PAAS_CSE_SC_ENDPOINT:http://127.0.0.1:30100}
+ # 微服务向CSE发送心跳间隔时间,单位秒
+ healthCheckInterval: 10
+ # 拉取实例的轮询时间,单位毫秒
+ pollInterval: 15000
+ # 优雅停机设置。优雅停机后,先从注册中心注销自己。这个时间表示注销自己后等待的时间,这个时间后才退出。
+ waitTimeForShutDownInMillis: 15000
+ config:
+ # 配置中心地址,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改地址。
+ serverAddr: ${PAAS_CSE_CC_ENDPOINT:http://127.0.0.1:30110}
+ serverType: kie
+ # 自定义配置
+ kie:
+ customLabel: ${spring.application.name}
+ customLabelValue: ${INSTANCE_TAG:default}
+ metrics:
+ logsEnabled: true
+ logsInterval: PT1M # Duration表达式,打印周期
\ No newline at end of file
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/log4j2.xml
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..5680024
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/gateway/src/main/resources/log4j2.xml
@@ -0,0 +1,59 @@
+<?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>
+ </Appenders>
+
+ <Loggers>
+ <AsyncLogger name="access_logger" level="INFO" additivity="false">
+ <AppenderRef ref="AccessLog"/>
+ </AsyncLogger>
+ <AsyncLogger name="metrics_logger" level="INFO" additivity="false">
+ <AppenderRef ref="MetricsLog"/>
+ </AsyncLogger>
+
+ <Root level="INFO">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
diff --git a/java-chassis-benchmark/spring-cloud-2022.0.x/pom.xml
b/java-chassis-benchmark/spring-cloud-2022.0.x/pom.xml
new file mode 100644
index 0000000..1ed8658
--- /dev/null
+++ b/java-chassis-benchmark/spring-cloud-2022.0.x/pom.xml
@@ -0,0 +1,89 @@
+<?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>benchmark-parent</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-application-spring-cloud-2022.0.x</artifactId>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <spring-cloud.version>2022.0.2</spring-cloud.version>
+ <spring-boot.version>3.0.7</spring-boot.version>
+ <spring-cloud-huawei.version>1.11.0-2022.0.x</spring-cloud-huawei.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.huaweicloud</groupId>
+ <artifactId>spring-cloud-huawei-dependencies</artifactId>
+ <version>${spring-cloud-huawei.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicecomb.benchmark</groupId>
+ <artifactId>benchmark-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ </dependency>
+ <!-- using log4j2 -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.lmax</groupId>
+ <artifactId>disruptor</artifactId>
+ <version>3.4.4</version>
+ </dependency>
+ </dependencies>
+
+ <modules>
+ <module>provider</module>
+ <module>consumer</module>
+ <module>gateway</module>
+ </modules>
+
+</project>
diff --git a/java-chassis-benchmark/spring-cloud-2022.0.x/provider/pom.xml
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/pom.xml
new file mode 100644
index 0000000..a68bda1
--- /dev/null
+++ b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/pom.xml
@@ -0,0 +1,60 @@
+<?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-spring-cloud-2022.0.x</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>basic-provider-spring-cloud-2022.0.x</artifactId>
+ <packaging>jar</packaging>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.huaweicloud</groupId>
+ <artifactId>spring-cloud-starter-huawei-service-engine</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-benchmark/spring-cloud-2022.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
new file mode 100644
index 0000000..1010cc7
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java
@@ -0,0 +1,36 @@
+/*
+ * 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.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 {
+ try {
+ new SpringApplicationBuilder()
+ .web(WebApplicationType.SERVLET)
+ .sources(ProviderApplication.class)
+ .run(args);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
new file mode 100644
index 0000000..dd5af48
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java
@@ -0,0 +1,36 @@
+/*
+ * 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.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.springframework.web.bind.annotation.RestController;
+
+@RestController
+@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/spring-cloud-2022.0.x/provider/src/main/resources/bootstrap.yml
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..295f5bc
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/resources/bootstrap.yml
@@ -0,0 +1,62 @@
+#
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+server:
+ port: 9092
+
+spring:
+ application:
+ # 微服务名称。 微服务名称定义好以后,后续不能变更。
+ name: provider
+
+ cloud:
+ servicecomb:
+ # 微服务的基本信息
+ service:
+ # 微服务名称,和spring.application.name保持一致。
+ name: ${spring.application.name}
+ # 微服务版本号,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改版本号,防止契约注册失败。
+ version: ${CAS_INSTANCE_VERSION:0.0.1}
+ # 应用名称。默认情况下只有应用名称相同的微服务之间才可以相互发现。
+ application: ${CAS_APPLICATION_NAME:basic-application}
+ # 环境名称。只有环境名称相同的微服务之间才可以相互发现。
+ # 可以取值 development, testing, acceptance, production
+ environment: production
+ # 注册发现相关配置
+ discovery:
+ # 注册中心地址,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改地址。
+ address: ${PAAS_CSE_SC_ENDPOINT:http://127.0.0.1:30100}
+ # 微服务向CSE发送心跳间隔时间,单位秒
+ healthCheckInterval: 10
+ # 拉取实例的轮询时间,单位毫秒
+ pollInterval: 15000
+ # 优雅停机设置。优雅停机后,先从注册中心注销自己。这个时间表示注销自己后等待的时间,这个时间后才退出。
+ waitTimeForShutDownInMillis: 15000
+ config:
+ # 配置中心地址,本示例使用ServiceStage环境变量。建议保留这种配置方式,
+ # 部署的时候,不用手工修改地址。
+ serverAddr: ${PAAS_CSE_CC_ENDPOINT:http://127.0.0.1:30110}
+ serverType: kie
+ # 自定义配置
+ kie:
+ customLabel: ${spring.application.name}
+ customLabelValue: ${INSTANCE_TAG:default}
+ metrics:
+ logsEnabled: true
+ logsInterval: PT1M # Duration表达式,打印周期
diff --git
a/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/resources/log4j2.xml
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..44045d8
--- /dev/null
+++
b/java-chassis-benchmark/spring-cloud-2022.0.x/provider/src/main/resources/log4j2.xml
@@ -0,0 +1,59 @@
+<?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>
+ </Appenders>
+
+ <Loggers>
+ <AsyncLogger name="access_logger" level="INFO" additivity="false">
+ <AppenderRef ref="AccessLog"/>
+ </AsyncLogger>
+ <AsyncLogger name="metrics_logger" level="INFO" additivity="false">
+ <AppenderRef ref="MetricsLog"/>
+ </AsyncLogger>
+
+ <Root level="INFO">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>