基于Spring boot 2.0+ 脚手架重构微服务系统,CI、DevOps、Redisson、Shiro、RocketMQ tx、Dubbo、Sentinel、Sharding-Sphere、Fescar、Skywalking、Apollo、SocketIO, 小程序服务端快速上手Sample, Netty Socket Game/PUSH Server
使用一个简单的小程序后台快速上手案例包含以下内容:
CI配套
JVM配置
多环境支持及参数配置
参考aws服务本地化配置方式, 多环境多个配置文件,多个module可分别制定外部配置文件,[推荐]使用外部地址配置文件,指定/etc/.myproject.yml
IDE环境maven配置:
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug -Dspring.config.location=file:../.././yml/application-local.yml,classpath:application.yml
</jvmArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xdebug -Dspring.config.location=file:../.././yml/application-local.yml,file:../.././yml/application-sharding.yml,classpath:application.yml</argLine>
</configuration>
</plugin>
</plugins>
独立环境:
shell env中增加以下参数
java -jar xxxx.jar -Dspring.config.location=file:.././yml/application-local.yml,classpath:application.yml,classpath:application-sharding.yml
VM监控
启动server.sh shell中开启JMX env中定义环境和额外的vm参数
Log支持
启动集成
多环境、多配置支持:配置和源码分离可以通过vm参数进行多环境的配置支持
RPC集成
dubbo2.7 + boot start
Web集成
Shiro集成
分表分库读写分离
sharding-sphere v3.1 boot2
全链路跟踪 Skywalking/Zipkin
分布式事务
RocketMQ 事务消息,异步可靠性消息事务实现最终一致性机制,在部分场景下实现资源最终一致性。
限流 Sentinel
分布式配置 Apollo/Nacos
规则引擎: Drools
SocketIO with Netty
[Kamon](http://kamon.io/documentation/get-started/) is used to track saga performance and reports trace data to both log
and [StatsD](https://github.com/etsy/statsd/). The easiest way to visualize tracing reports is to use a [docker image](http://kamon.io/documentation/kamon-statsd/0.6.6/overview/)
composed with StatsD, [Graphite](http://graphite.wikidot.com/), and [Grafana](http://grafana.org/)
java -javaagent:/path/to/aspectj-weaver.jar -Dkamon.modules.kamon-annotation.auto-start=yes -Dkamon.modules.kamon-log-reporter.auto-start=yes -Dkamon.modules.kamon-statsd.auto-start=yes -jar saga.jar
b. Tracing data reported to prometheus
grafana + prometheus
-Dspring.config.location=file:.././yml/application-local.yml,classpath:application.yml,classpath:application-sharding.yml
限流监控在首次拦截时初始化并生成数据,Dashboard需要才能同步到对应的数据
Shell
-Djava.net.preferIPv4Stack=true -Dcsp.sentinel.api.port=8731 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=dubbo-web-demo
reset vm args in script/bin/env
SERVER_OPTS_MEMORY="-Xms64M -Xmx1G"
SERVER_OPTS_VM="-server -XX:NewRatio=3 -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=6 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=256M -XX:ReservedCodeCacheSize=240M -XX:+ExplicitGCInvokesConcurrent -XX:PretenureSizeThreshold=64m -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75 -XX:CMSMaxAbortablePrecleanTime=6000 -XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=10 -verbose:gc -Xloggc:gc_%p.log -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=. -XX:-OmitStackTraceInFastThrow -XX:-UseBiasedLocking -XX:AutoBoxCacheMax=20000 -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"
SERVER_OPTS="$SERVER_OPTS_MEMORY $SERVER_OPTS_VM -Dspring.config.location=file:.././yml/application-local.yml,classpath:application.yml"
针对支持ACID SQL数据库提供无入侵的分布式事务读未提交隔离级别支持,对于其他类存储提供手动Commit和Rollback支持.