Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

hasting

> 编程语言
Open source

使用java nio,oio,aio等原生态io和线程池,实现的分布式跨语言服务化框架

198 stars0 likes0 views
WebsiteGitHub

About

使用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

如何加入项目

  1. 有问题直接提issues : https://github.com/lindzh/hasting/issues
  2. 改进项目请直接提PullRequest:https://github.com/lindzh/hasting/pulls

Lisence

…

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言