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 bb068ea add 2.8.x performance (#125) bb068ea is described below commit bb068ead1d4054d8a65fbeb3ae883fcc1ec0124d Author: liubao68 <bi...@qq.com> AuthorDate: Wed Nov 15 12:30:03 2023 +0800 add 2.8.x performance (#125) --- .../{ => basic-2.8.x/consumer}/pom.xml | 55 +++++++-------- .../servicecomb/samples/ConsumerApplication.java | 38 ++++++++++ .../servicecomb/samples/ConsumerController.java | 37 ++++++++++ .../servicecomb/samples/ProviderService.java | 22 ++++++ .../consumer/src/main/resources/application.yml | 28 ++++++++ .../consumer/src/main/resources/log4j2.xml | 71 +++++++++++++++++++ .../{ => basic-2.8.x/gateway}/pom.xml | 60 ++++++++-------- .../servicecomb/samples/GatewayApplication.java | 38 ++++++++++ .../gateway/src/main/resources/application.yml | 43 ++++++++++++ .../gateway/src/main/resources/log4j2.xml | 71 +++++++++++++++++++ .../{basic-3.0.x => basic-2.8.x}/pom.xml | 80 +++------------------- .../{ => basic-2.8.x/provider}/pom.xml | 53 +++++++------- .../servicecomb/samples/ProviderApplication.java | 38 ++++++++++ .../servicecomb/samples/ProviderController.java | 36 ++++++++++ .../provider/src/main/resources/application.yml | 26 +++++++ .../provider/src/main/resources/log4j2.xml | 71 +++++++++++++++++++ java-chassis-benchmark/basic-3.0.x/pom.xml | 30 -------- java-chassis-benchmark/pom.xml | 14 ++++ 18 files changed, 626 insertions(+), 185 deletions(-) diff --git a/java-chassis-benchmark/pom.xml b/java-chassis-benchmark/basic-2.8.x/consumer/pom.xml similarity index 52% copy from java-chassis-benchmark/pom.xml copy to java-chassis-benchmark/basic-2.8.x/consumer/pom.xml index 1ae9505..b98f93d 100644 --- a/java-chassis-benchmark/pom.xml +++ b/java-chassis-benchmark/basic-2.8.x/consumer/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 @@ -20,36 +19,34 @@ 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> + <parent> + <groupId>org.apache.servicecomb.benchmark</groupId> + <artifactId>basic-application-2.8.x</artifactId> + <version>3.0-SNAPSHOT</version> + </parent> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> - </properties> + <artifactId>basic-consumer-2.8.x</artifactId> + <packaging>jar</packaging> - <modules> - <module>common</module> - <module>basic-3.0.x</module> - <module>test-tool</module> - </modules> + <dependencies> + <dependency> + <groupId>org.apache.servicecomb</groupId> + <artifactId>java-chassis-spring-boot-starter-standalone</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> <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> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> </build> -</project> +</project> \ No newline at end of file diff --git a/java-chassis-benchmark/basic-2.8.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java b/java-chassis-benchmark/basic-2.8.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java new file mode 100644 index 0000000..eb7abd8 --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerApplication.java @@ -0,0 +1,38 @@ +/* + * 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.springboot2.starter.EnableServiceComb; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +@EnableServiceComb +public class ConsumerApplication { + public static void main(String[] args) throws Exception { + try { + new SpringApplicationBuilder() + .web(WebApplicationType.NONE) + .sources(ConsumerApplication.class) + .run(args); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/java-chassis-benchmark/basic-2.8.x/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java b/java-chassis-benchmark/basic-2.8.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-2.8.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-benchmark/basic-2.8.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java b/java-chassis-benchmark/basic-2.8.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java new file mode 100644 index 0000000..00d560e --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.x/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java @@ -0,0 +1,22 @@ +/* + * 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 interface ProviderService { + DataModel sayHello(int wait, DataModel dataModel); +} diff --git a/java-chassis-benchmark/basic-2.8.x/consumer/src/main/resources/application.yml b/java-chassis-benchmark/basic-2.8.x/consumer/src/main/resources/application.yml new file mode 100644 index 0000000..5401829 --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.x/consumer/src/main/resources/application.yml @@ -0,0 +1,28 @@ +# +## --------------------------------------------------------------------------- +## 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 + + registry: + address: http://localhost:30100 diff --git a/java-chassis-benchmark/basic-2.8.x/consumer/src/main/resources/log4j2.xml b/java-chassis-benchmark/basic-2.8.x/consumer/src/main/resources/log4j2.xml new file mode 100644 index 0000000..e9e27f1 --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.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="accesslog" level="INFO" additivity="false"> + <AppenderRef ref="AccessLog"/> + </Logger> + <Logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false"> + <AppenderRef ref="MetricsLog"/> + </Logger> + <Logger name="org.apache.servicecomb.metrics.core.publish.SlowInvocationLogger" level="INFO" additivity="false"> + <AppenderRef ref="SlowLog"/> + </Logger> + + <Root level="INFO"> + <AppenderRef ref="Console"/> + </Root> + </Loggers> +</Configuration> diff --git a/java-chassis-benchmark/pom.xml b/java-chassis-benchmark/basic-2.8.x/gateway/pom.xml similarity index 52% copy from java-chassis-benchmark/pom.xml copy to java-chassis-benchmark/basic-2.8.x/gateway/pom.xml index 1ae9505..e2925ba 100644 --- a/java-chassis-benchmark/pom.xml +++ b/java-chassis-benchmark/basic-2.8.x/gateway/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 @@ -20,36 +19,37 @@ 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> + <parent> + <groupId>org.apache.servicecomb.benchmark</groupId> + <artifactId>basic-application-2.8.x</artifactId> + <version>3.0-SNAPSHOT</version> + </parent> - <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> + <artifactId>basic-gateway-2.8.x</artifactId> + <packaging>jar</packaging> + <dependencies> + <dependency> + <groupId>org.apache.servicecomb</groupId> + <artifactId>java-chassis-spring-boot-starter-standalone</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.servicecomb</groupId> + <artifactId>edge-core</artifactId> + </dependency> + </dependencies> <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> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> </build> -</project> +</project> \ No newline at end of file diff --git a/java-chassis-benchmark/basic-2.8.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java b/java-chassis-benchmark/basic-2.8.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java new file mode 100644 index 0000000..53bb51d --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.x/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java @@ -0,0 +1,38 @@ +/* + * 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.springboot2.starter.EnableServiceComb; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +@EnableServiceComb +public class GatewayApplication { + public static void main(String[] args) throws Exception { + try { + new SpringApplicationBuilder() + .web(WebApplicationType.NONE) + .sources(GatewayApplication.class) + .run(args); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/java-chassis-benchmark/basic-2.8.x/gateway/src/main/resources/application.yml b/java-chassis-benchmark/basic-2.8.x/gateway/src/main/resources/application.yml new file mode 100644 index 0000000..79aff6f --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.x/gateway/src/main/resources/application.yml @@ -0,0 +1,43 @@ +# +## --------------------------------------------------------------------------- +## 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 + + registry: + address: http://localhost:30100 + + http: + dispatcher: + edge: + default: + enabled: false + url: + enabled: true + pattern: /(.*) + mappings: + consumer: + prefixSegmentCount: 0 + path: "/.*" + microserviceName: consumer + versionRule: 0.0.0+ diff --git a/java-chassis-benchmark/basic-2.8.x/gateway/src/main/resources/log4j2.xml b/java-chassis-benchmark/basic-2.8.x/gateway/src/main/resources/log4j2.xml new file mode 100644 index 0000000..5d52009 --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.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="accesslog" level="INFO" additivity="false"> + <AppenderRef ref="AccessLog"/> + </Logger> + <Logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false"> + <AppenderRef ref="MetricsLog"/> + </Logger> + <Logger name="org.apache.servicecomb.metrics.core.publish.SlowInvocationLogger" 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/pom.xml b/java-chassis-benchmark/basic-2.8.x/pom.xml similarity index 52% copy from java-chassis-benchmark/basic-3.0.x/pom.xml copy to java-chassis-benchmark/basic-2.8.x/pom.xml index 1ff4cb0..368efc6 100644 --- a/java-chassis-benchmark/basic-3.0.x/pom.xml +++ b/java-chassis-benchmark/basic-2.8.x/pom.xml @@ -26,14 +26,11 @@ <version>3.0-SNAPSHOT</version> </parent> - <artifactId>basic-application-3.0.x</artifactId> + <artifactId>basic-application-2.8.x</artifactId> <packaging>pom</packaging> <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <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> + <servicecomb.version>2.8.12</servicecomb.version> </properties> <dependencyManagement> @@ -58,6 +55,14 @@ <groupId>org.apache.servicecomb</groupId> <artifactId>solution-basic</artifactId> </dependency> + <dependency> + <groupId>org.apache.servicecomb</groupId> + <artifactId>registry-service-center</artifactId> + </dependency> + <dependency> + <groupId>org.apache.servicecomb</groupId> + <artifactId>config-kie</artifactId> + </dependency> <!-- using log4j2 --> <dependency> <groupId>org.apache.logging.log4j</groupId> @@ -73,75 +78,10 @@ </dependency> </dependencies> - <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> - <modules> <module>provider</module> <module>consumer</module> <module>gateway</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> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring-boot-maven-plugin.version}</version> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </pluginManagement> - </build> </project> diff --git a/java-chassis-benchmark/pom.xml b/java-chassis-benchmark/basic-2.8.x/provider/pom.xml similarity index 56% copy from java-chassis-benchmark/pom.xml copy to java-chassis-benchmark/basic-2.8.x/provider/pom.xml index 1ae9505..fa8147f 100644 --- a/java-chassis-benchmark/pom.xml +++ b/java-chassis-benchmark/basic-2.8.x/provider/pom.xml @@ -20,36 +20,37 @@ 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> + <parent> + <groupId>org.apache.servicecomb.benchmark</groupId> + <artifactId>basic-application-2.8.x</artifactId> + <version>3.0-SNAPSHOT</version> + </parent> + + <artifactId>basic-provider-2.8.x</artifactId> + <packaging>jar</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> + <dependencies> + <dependency> + <groupId>org.apache.servicecomb</groupId> + <artifactId>java-chassis-spring-boot-starter-standalone</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> <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> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> </build> -</project> +</project> \ No newline at end of file diff --git a/java-chassis-benchmark/basic-2.8.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java b/java-chassis-benchmark/basic-2.8.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java new file mode 100644 index 0000000..66f7e98 --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderApplication.java @@ -0,0 +1,38 @@ +/* + * 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.springboot2.starter.EnableServiceComb; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +@EnableServiceComb +public class ProviderApplication { + public static void main(String[] args) throws Exception { + try { + new SpringApplicationBuilder() + .web(WebApplicationType.NONE) + .sources(ProviderApplication.class) + .run(args); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/java-chassis-benchmark/basic-2.8.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java b/java-chassis-benchmark/basic-2.8.x/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java new file mode 100644 index 0000000..b956fa1 --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.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.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 = "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-2.8.x/provider/src/main/resources/application.yml b/java-chassis-benchmark/basic-2.8.x/provider/src/main/resources/application.yml new file mode 100644 index 0000000..6069a38 --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.x/provider/src/main/resources/application.yml @@ -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. +## --------------------------------------------------------------------------- +servicecomb: + service: + application: basic-application + name: provider + version: 0.0.1 + rest: + address: 0.0.0.0:9093 + registry: + address: http://localhost:30100 diff --git a/java-chassis-benchmark/basic-2.8.x/provider/src/main/resources/log4j2.xml b/java-chassis-benchmark/basic-2.8.x/provider/src/main/resources/log4j2.xml new file mode 100644 index 0000000..ed57eea --- /dev/null +++ b/java-chassis-benchmark/basic-2.8.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="accesslog" level="INFO" additivity="false"> + <AppenderRef ref="AccessLog"/> + </Logger> + <Logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false"> + <AppenderRef ref="MetricsLog"/> + </Logger> + <Logger name="org.apache.servicecomb.metrics.core.publish.SlowInvocationLogger" 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/pom.xml b/java-chassis-benchmark/basic-3.0.x/pom.xml index 1ff4cb0..cae0b82 100644 --- a/java-chassis-benchmark/basic-3.0.x/pom.xml +++ b/java-chassis-benchmark/basic-3.0.x/pom.xml @@ -32,8 +32,6 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <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> @@ -116,32 +114,4 @@ <module>gateway</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> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring-boot-maven-plugin.version}</version> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </pluginManagement> - </build> </project> diff --git a/java-chassis-benchmark/pom.xml b/java-chassis-benchmark/pom.xml index 1ae9505..fdd4655 100644 --- a/java-chassis-benchmark/pom.xml +++ b/java-chassis-benchmark/pom.xml @@ -28,10 +28,12 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> + <spring-boot-maven-plugin.version>3.1.3</spring-boot-maven-plugin.version> </properties> <modules> <module>common</module> + <module>basic-2.8.x</module> <module>basic-3.0.x</module> <module>test-tool</module> </modules> @@ -49,6 +51,18 @@ <target>17</target> </configuration> </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot-maven-plugin.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </pluginManagement> </build>