Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: seata-server remove cms parameters #4434

Merged
merged 46 commits into from Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0ca818d
seata-server support jdk17
funky-eyes Mar 3, 2022
41367a8
update
funky-eyes Mar 4, 2022
29370f8
code formatting
funky-eyes Mar 4, 2022
2ca50e0
code formatting
funky-eyes Mar 4, 2022
72f9a68
Merge branch 'develop' into support_jdk17
funky-eyes Apr 12, 2022
1b3c535
Merge branch 'develop' of github.com:seata/seata into support_jdk17
funky-eyes Jun 7, 2022
b034f4f
bugfix
funky-eyes Jun 7, 2022
6e9fb29
Merge branch 'develop' into support_jdk17
funky-eyes Jun 8, 2022
b4fbd8f
Merge branch 'develop' into support_jdk17
funky-eyes Jun 12, 2022
adcd677
Merge branch 'develop' into support_jdk17
xingfudeshi Jun 17, 2022
ace18c8
Merge branch 'develop' of github.com:seata/seata into support_jdk17
funky-eyes Jun 27, 2022
3ffae02
merge
funky-eyes Jun 27, 2022
4167b6f
Merge branch 'support_jdk17' of github.com:a364176773/seata into supp…
funky-eyes Jun 27, 2022
4a632bb
Merge branch 'develop' into support_jdk17
funky-eyes Jul 20, 2022
5f75d85
Merge branch 'develop' into support_jdk17
funky-eyes Jul 20, 2022
83e553d
update
funky-eyes Jul 20, 2022
f4fb0bb
Merge branch 'develop' of github.com:seata/seata into support_jdk17
funky-eyes Jul 30, 2022
60b276e
Merge branch 'develop' of github.com:seata/seata into support_jdk17
funky-eyes Jul 30, 2022
d1166af
cglib -> byte-buddy
funky-eyes Aug 16, 2022
94d7bb4
cglib -> byte-buddy
funky-eyes Aug 16, 2022
e22fd59
spring-boot->2.5.9
funky-eyes Aug 16, 2022
61c9158
opt
funky-eyes Aug 17, 2022
fc5d93e
opt
funky-eyes Aug 17, 2022
256b06f
opt
funky-eyes Aug 17, 2022
87eb1cc
opt
funky-eyes Aug 17, 2022
21ea347
opt
funky-eyes Aug 17, 2022
4054faf
Merge branch 'develop' into support_jdk17
wangliang181230 Aug 18, 2022
f9e68dc
opt
funky-eyes Aug 18, 2022
621a268
Merge remote-tracking branch 'origin/support_jdk17' into support_jdk17
funky-eyes Aug 18, 2022
b12b7a7
opt
funky-eyes Aug 18, 2022
36aa4df
update
funky-eyes Aug 18, 2022
2a333b7
Merge branch 'develop' into support_jdk17
funky-eyes Aug 19, 2022
2ce2e8f
Update .github/workflows/publishes.yml
funky-eyes Aug 19, 2022
8d660ab
update
funky-eyes Aug 19, 2022
6873818
update
funky-eyes Aug 19, 2022
d1dfc9e
update
funky-eyes Aug 19, 2022
c657f2a
Merge branch 'support_jdk17' of github.com:a364176773/seata into supp…
funky-eyes Aug 19, 2022
2945550
update
funky-eyes Aug 19, 2022
fbfb5eb
Merge branch 'develop' into support_jdk17
wangliang181230 Aug 22, 2022
0a47b29
Merge branch 'develop' into support_jdk17
funky-eyes Sep 3, 2022
a5d749d
Merge branch 'develop' into support_jdk17
funky-eyes Oct 24, 2022
0cf5a42
Merge branch 'develop' into support_jdk17
funky-eyes Nov 5, 2022
3234d07
Merge branch 'develop' into support_jdk17
funky-eyes Nov 7, 2022
11abd83
Merge branch 'develop' into support_jdk17
wangliang181230 Nov 28, 2022
8c1b7de
Merge branch 'develop' into support_jdk17
funky-eyes Dec 16, 2022
c5ae741
Update pom.xml
funky-eyes Dec 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publishes.yml
Expand Up @@ -46,10 +46,10 @@ jobs:
- name: "Package and Publish-Image-To-DockerHub"
if: matrix.type == 'image'
env:
IMAGE_NAME: openjdk:17.0.2
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: |
echo "IMAGE_NAME=openjdk:8u332" >> $GITHUB_ENV;
if [ "${{github.ref}}" == "refs/heads/snapshot" ]; then
funky-eyes marked this conversation as resolved.
Show resolved Hide resolved
./mvnw -T 4C clean package -Pimage -DskipTests -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -29,11 +29,13 @@ dependency-reduced-pom.xml
/distribution/bin/
/distribution/conf/
/distribution/lib/
/distribution/ext/
/distribution/logs/
/distribution/*/bin/
/distribution/*/conf/
/distribution/*/lib/
/distribution/*/logs/
/distribution/*/ext/
/server/*root.*
/server/.root.*
/server/sessionStore/
Expand Down
4 changes: 2 additions & 2 deletions all/pom.xml
Expand Up @@ -417,8 +417,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
Expand Down
4 changes: 2 additions & 2 deletions build/pom.xml
Expand Up @@ -73,8 +73,8 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- The version of spring-boot for 'spring-boot-dependencies' and 'spring-boot-maven-plugin' -->
<spring-boot.version>2.4.13</spring-boot.version>
<spring-framework.version>5.3.18</spring-framework.version>
<spring-boot.version>2.5.14</spring-boot.version>
<spring-framework.version>5.3.22</spring-framework.version>

<!-- Maven plugin versions -->
<!-- Build -->
Expand Down
4 changes: 2 additions & 2 deletions config/seata-config-core/pom.xml
Expand Up @@ -41,8 +41,8 @@
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>
</dependencies>

Expand Down
Expand Up @@ -20,12 +20,12 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

import io.seata.common.util.CollectionUtils;
import io.seata.common.util.DurationUtil;
import io.seata.common.util.StringUtils;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.implementation.InvocationHandlerAdapter;
import net.bytebuddy.matcher.ElementMatchers;

/**
* @author funkye
Expand All @@ -36,7 +36,7 @@ public class ConfigurationCache implements ConfigurationChangeListener {

private static final String METHOD_LATEST_CONFIG = METHOD_PREFIX + "LatestConfig";

private static final ConcurrentHashMap<String, ObjectWrapper> CONFIG_CACHE = new ConcurrentHashMap<>();
private static final Map<String, ObjectWrapper> CONFIG_CACHE = new ConcurrentHashMap<>();

private Map<String, HashSet<ConfigurationChangeListener>> configListenersMap = new HashMap<>();

Expand Down Expand Up @@ -100,11 +100,16 @@ public void onChangeEvent(ConfigurationChangeEvent event) {
}
}

public Configuration proxy(Configuration originalConfiguration) {
return (Configuration)Enhancer.create(Configuration.class,
(MethodInterceptor)(proxy, method, args, methodProxy) -> {
if (method.getName().startsWith(METHOD_PREFIX)
&& !method.getName().equalsIgnoreCase(METHOD_LATEST_CONFIG)) {
public Configuration proxy(Configuration originalConfiguration) throws Exception {
Class<?> clazz;
if (originalConfiguration.getClass().getName().contains("$$")) {
clazz = originalConfiguration.getClass().getSuperclass();
} else {
clazz = originalConfiguration.getClass();
}
return (Configuration)new ByteBuddy().subclass(clazz).method(ElementMatchers.nameStartsWith(METHOD_PREFIX))
.intercept(InvocationHandlerAdapter.of((proxy, method, args) -> {
if (!method.getName().equalsIgnoreCase(METHOD_LATEST_CONFIG)) {
String rawDataId = (String)args[0];
ObjectWrapper wrapper = CONFIG_CACHE.get(rawDataId);
ObjectWrapper.ConfigType type = ObjectWrapper.getTypeByName(method.getName().substring(METHOD_PREFIX.length()));
Expand All @@ -123,7 +128,7 @@ public Configuration proxy(Configuration originalConfiguration) {
return wrapper == null ? null : wrapper.convertData(type);
}
return method.invoke(originalConfiguration, args);
});
})).make().load(this.getClass().getClassLoader()).getLoaded().getDeclaredConstructor().newInstance();
}

private static class ConfigurationCacheInstance {
Expand Down Expand Up @@ -244,7 +249,8 @@ public String getCode() {
}

public static ConfigType fromCode(String code) {
return CODE_TO_VALUE.get(code.toUpperCase());
ConfigType configType = CODE_TO_VALUE.get(code.toUpperCase());
return configType == null ? ConfigType.STRING : configType;
}

public static ConfigType fromName(String name) {
Expand Down
Expand Up @@ -16,6 +16,7 @@
package io.seata.config;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -46,7 +47,7 @@ void addConfigListener() throws InterruptedException {
countDownLatch.countDown();
});
System.setProperty("service.disableGlobalTransaction", String.valueOf(!value));
countDownLatch.await();
countDownLatch.await(5, TimeUnit.SECONDS);
System.setProperty("file.listener.enabled", "false");
System.setProperty("service.disableGlobalTransaction", String.valueOf(value));
Thread.sleep(2000);
Expand Down
9 changes: 5 additions & 4 deletions dependencies/pom.xml
Expand Up @@ -35,6 +35,7 @@
<dubbo.version>2.7.4</dubbo.version>
<brpc.version>2.5.9</brpc.version>
<hsf.version>1.8.3</hsf.version>
<bytebuddy.version>1.12.13</bytebuddy.version>
<dubbo.alibaba.version>2.6.5</dubbo.alibaba.version>
<sofa.rpc.version>5.5.3</sofa.rpc.version>
<fastjson.version>1.2.83</fastjson.version>
Expand All @@ -48,7 +49,7 @@
<apache-zookeeper.version>3.5.9</apache-zookeeper.version>
<curator-test.version>2.9.1</curator-test.version>
<spring-context-support.version>1.0.2</spring-context-support.version>
<apollo-client.version>1.6.0</apollo-client.version>
<apollo-client.version>2.0.1</apollo-client.version>
<mock-jedis.version>0.1.16</mock-jedis.version>
<eureka-clients.version>1.10.17</eureka-clients.version>
<consul-clients.version>1.4.2</consul-clients.version>
Expand Down Expand Up @@ -247,9 +248,9 @@
</exclusions>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>${cglib.version}</version>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${bytebuddy.version}</version>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
Expand Down
3 changes: 2 additions & 1 deletion distribution/Dockerfile
Expand Up @@ -9,7 +9,7 @@
# 1. docker run --name=seata-server -d seata-server:1.6.0-dev
#
# https://hub.docker.com/orgs/seataio
FROM openjdk:8u332
FROM openjdk:17.0.2

# set label
LABEL maintainer="Seata <seata.io>"
Expand All @@ -26,4 +26,5 @@ ADD LICENSE /seata-server/LICENSE

# set extra environment
ENV LOADER_PATH="/seata-server/lib"
ENV JVM_GC="-XX:+UseZGC"
CMD ["bash","-c","/seata-server/bin/seata-server.sh && tail -f /dev/null"]
2 changes: 1 addition & 1 deletion distribution/bin/seata-server.bat
Expand Up @@ -93,7 +93,7 @@ if "%SKYWALKING_ENABLE%"=="true" (
echo "apm-skywalking not enabled"
)

%JAVACMD% %JAVA_OPTS% %SKYWALKING_OPTS% -server -Dloader.path=../lib -Xmx2048m -Xms2048m -Xmn1024m -Xss512k -XX:SurvivorRatio=10 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:MaxDirectMemorySize=1024m -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%BASEDIR%"/logs/java_heapdump.hprof -XX:+DisableExplicitGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75 -Xloggc:"%BASEDIR%"/logs/seata_gc.log -verbose:gc -Dio.netty.leakDetectionLevel=advanced -classpath %CLASSPATH% -Dapp.name="seata-server" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" -Dspring.config.location="%BASEDIR%"/conf/application.yml -Dlogging.config="%BASEDIR%"/conf/logback-spring.xml -jar "%BASEDIR%"/target/seata-server.jar %CMD_LINE_ARGS%
%JAVACMD% %JAVA_OPTS% %SKYWALKING_OPTS% -server -Dloader.path=../lib -Xmx2048m -Xms2048m -Xmn1024m -Xss512k -XX:SurvivorRatio=10 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:MaxDirectMemorySize=1024m -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%BASEDIR%"/logs/java_heapdump.hprof -XX:+DisableExplicitGC -Xloggc:"%BASEDIR%"/logs/seata_gc.log -verbose:gc -Dio.netty.leakDetectionLevel=advanced -classpath %CLASSPATH% -Dapp.name="seata-server" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" -Dspring.config.location="%BASEDIR%"/conf/application.yml -Dlogging.config="%BASEDIR%"/conf/logback-spring.xml -jar "%BASEDIR%"/target/seata-server.jar %CMD_LINE_ARGS%
if %ERRORLEVEL% NEQ 0 goto error
goto end

Expand Down
12 changes: 9 additions & 3 deletions distribution/bin/seata-server.sh
Expand Up @@ -123,16 +123,22 @@ JVM_XMX=$JVM_XMX
JVM_XMS=$JVM_XMS
JVM_XMN=$JVM_XMN
JVM_XSS=$JVM_XSS
JVM_GC=$JVM_GC
JVM_MetaspaceSize=$JVM_MetaspaceSize
JVM_MaxMetaspaceSize=$JVM_MaxMetaspaceSize
JVM_MaxDirectMemorySize=$JVM_MaxDirectMemorySize
LOADER_PATH=$LOADER_PATH
JAVA_OPT="${JAVA_OPT} -server -Dloader.path=${LOADER_PATH:="../lib"} -Xmx${JVM_XMX:="2048m"} -Xms${JVM_XMS:="2048m"} -Xmn${JVM_XMN:="1024m"} -Xss${JVM_XSS:="512k"} -XX:SurvivorRatio=10 -XX:MetaspaceSize=${JVM_MetaspaceSize:="128m"} -XX:MaxMetaspaceSize=${JVM_MaxMetaspaceSize:="256m"} -XX:MaxDirectMemorySize=${JVM_MaxDirectMemorySize:=1024m} -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy"
JAVA_OPT="${JAVA_OPT} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASEDIR}/logs/java_heapdump.hprof -XX:+DisableExplicitGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75"
JAVA_OPT="${JAVA_OPT} -server -Dloader.path=${LOADER_PATH:="../lib"} ${JVM_GC:="-XX:+UseG1GC"} -Xmx${JVM_XMX:="2048m"} -Xms${JVM_XMS:="2048m"} -Xmn${JVM_XMN:="1024m"} -Xss${JVM_XSS:="512k"} -XX:SurvivorRatio=10 -XX:MetaspaceSize=${JVM_MetaspaceSize:="128m"} -XX:MaxMetaspaceSize=${JVM_MaxMetaspaceSize:="256m"} -XX:MaxDirectMemorySize=${JVM_MaxDirectMemorySize:=1024m} -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy"
JAVA_OPT="${JAVA_OPT} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASEDIR}/logs/java_heapdump.hprof -XX:+DisableExplicitGC"

JAVA_MAJOR_VERSION=$($JAVACMD -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}' | awk -F '.' '{print $2}')
if [[ "$JAVA_MAJOR_VERSION" -ge "0" ]] ; then
JAVA_MAJOR_VERSION=$($JAVACMD -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}' | awk -F '.' '{print $1}')
fi
if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASEDIR}/logs/seata_gc.log:time,tags:filecount=10,filesize=102400"
elif [[ "$JAVA_MAJOR_VERSION" -ge "17" ]] ; then
JAVA_OPT="${JAVA_OPT} -Xlog:gc=trace:file=${BASEDIR}/logs/seata_gc.log:time,tags:filecount=10,filesize=10M"
else
JAVA_OPT="${JAVA_OPT} -Xloggc:${BASEDIR}/logs/seata_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
fi
Expand All @@ -152,4 +158,4 @@ CMD_LINE_ARGS=$@
# start
echo "$JAVACMD ${JAVA_OPT} ${CMD_LINE_ARGS}" > ${BASEDIR}/logs/start.out 2>&1 &
nohup $JAVACMD ${JAVA_OPT} ${CMD_LINE_ARGS} >> ${BASEDIR}/logs/start.out 2>&1 &
echo "seata-server is starting, you can check the ${BASEDIR}/logs/start.out"
echo "seata-server is starting, you can check the ${BASEDIR}/logs/start.out"
2 changes: 1 addition & 1 deletion distribution/release-seata.xml
Expand Up @@ -53,7 +53,7 @@

<fileSet>
<directory>../ext/apm-seata-skywalking-plugin/target/ext/skywalking-agent/</directory>
<outputDirectory>ext/apm-skywalking/</outputDirectory>
<outputDirectory>ext/apm-skywalking</outputDirectory>
</fileSet>

<fileSet>
Expand Down
6 changes: 2 additions & 4 deletions server/pom.xml
Expand Up @@ -291,10 +291,8 @@
<jvmFlag>-XX:HeapDumpPath=/var/log/seata_heapdump.hprof</jvmFlag>
<!--gc-->
<jvmFlag>-XX:+DisableExplicitGC</jvmFlag>
<jvmFlag>-XX:+CMSParallelRemarkEnabled</jvmFlag>
<jvmFlag>-XX:+UseCMSInitiatingOccupancyOnly</jvmFlag>
<jvmFlag>-XX:CMSInitiatingOccupancyFraction=75</jvmFlag>
<jvmFlag>-Xloggc:/var/log/seata_gc.log</jvmFlag>
<jvmFlag>-XX:+UseZGC</jvmFlag>
<jvmFlag>-Xlog:gc=trace:file=/var/log/seata_gc.log:time,tags:filecount=10,filesize=10M</jvmFlag>
<jvmFlag>-verbose:gc</jvmFlag>
<!--netty-->
<jvmFlag>-Dio.netty.leakDetectionLevel=advanced</jvmFlag>
Expand Down
4 changes: 0 additions & 4 deletions spring/pom.xml
Expand Up @@ -54,10 +54,6 @@
<artifactId>seata-serializer-all</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</dependency>

<!-- spring -->
<dependency>
Expand Down