This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 167
RSocket GraalVM
linux_china edited this page Jan 13, 2021
·
5 revisions
RSocket结合GraalVM实现应用的Native Image化,GraalVM native image化后,会让应用启动的更快,内存消耗更小。 Alibaba RSocket Broker在Spring Native基础上全面支持应用的native image化。
- 将@SpringBootApplication的proxyBeanMethods属性设置为false
@SpringBootApplication(proxyBeanMethods = false)
public class RsocketGraalApp {
public static void main(String[] args) {
SpringApplication.run(RsocketGraalApp.class, args);
}
}
- RSocket通讯主要是基于interface通讯,这就不涉及到GraalVM Proxy的问题,详细的请参考: https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#assisted-configuration-of-native-image-builds
GraalVM Native-Image生成的可执行文件还是比较大,考虑到应用分发和Docker镜像制作的方便,可以考虑使用upx工具进行一下压缩,命令如下:
$ upx -7 -k rsocket-graal-demo-opt rsocket-graal-demo
upx的压缩效果非常好,压缩后的文件只有原来文件的1/3左右,但是启动速度并没有受到影响,非常便于分发。
更详细的应用请参考: https://github.com/alibaba-rsocket-broker/ali-rsocket-graal-demo
- Binary: byte stream
- Async message
- Multi transports
- Reactive Semantics
- request/response
- request/stream
- fire-and-forget
- channel
- TCP+TLS
- WebSocket+TLS
- UDP(Aeron)
- RDMA