使用java nio、oio、aio 等原生态io 和线程池,实现分布式跨语言服务化框架
轻量级分部署服务调度框架的基本原理是服务提供方Provider提供rpc服务,同时把ip和端口以及发布的rpc服务注册
到注册中心,客户端或者rpc消费者从注册中心获取服务Provider列表,同时获取Provider提供的服务列表。另外客
户端还会监听注册中心的数据变化,获知server宕机或者服务不可用,将该Provider从客户端Provider缓存列表中
剔除,方便做容错和负载均衡。…泛型:GenericService,Consumer不依赖Provider的api jar包即可完成remote api调用
监控:StatMonitor,consumer注册需要的远程服务StatMonitor,调用rpc获取监控数据
Webui:一个可视化rpc管理界面,https://github.com/lindzh/rpc-webui
RPC调用:使用jdk proxy封装发送tcp数据,并等待数据返回,完成RPC调用。
负载均衡:在集群模式下,同一个版本的Rpc服务在多台服务器上部署,Consumer发起rpc调用使用负载均衡。
自动容错:发现rpc provider不可用及时剔除,当可用时加入。
代理:rpcClient注册一个remote intface时会返回一个代理。
多注册中心:提供Zookeeper,etcd,redis等注册中心,并可以实现高可用。Provider
SimpleRpcServer rpcServer = new SimpleRpcServer();
rpcServer.setHost("192.168.132.87");
rpcServer.setPort(4321);
//将一个service暴露为rpc服务
rpcServer.register(LoginRpcService.class, new LoginRpcServiceImpl());
rpcServer.startService();
// Thread.currentThread().sleep(100000);//wait for call
rpcServer.stopService();Consumer
SimpleRpcClient rpcClient = new SimpleRpcClient();
rpcClient.setHost("192.168.132.87");
rpcClient.setPort(4321);
LoginRpcService loginRpcService = rpcClient.register(LoginRpcService.class);
rpcClient.startService();
boolean loginResult = loginRpcService.login("admin", "admin");
rpcClient.stopService();https://github.com/lindzh/hasting/tree/master/docs
…暂无开放 Issues,或尚未同步最近议题。