GithubHelp home page GithubHelp logo

sunshinexb / gru Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sumory/gru

0.0 2.0 0.0 2.04 MB

即时通讯服务集群,可用于构建聊天等实时交互系统

Shell 0.52% Java 10.44% Makefile 0.01% JavaScript 42.32% CSS 46.14% HTML 0.57%

gru's Introduction

Gru

Gru是一个长连接服务解决方案,可用于各种类型的实时交互应用。

目前主要模块

  • common 通用的一些代码、工具类等
  • idgen 消息id、某些业务id生成服务
  • ticket
    • 处于最前端,客户端首先请求该服务拿到ticket才能建立长连接
    • 目前实现了基于一致性hash的负载均衡,将客户端路由到不同的spear节点
    • 其它位于前端的策略,如准入机制等可在此模块扩展
  • stat 统计模块、业务模块
    • 目前实现了在线统计,数据存储在redis
    • 若还需要后端接入其他业务服务,可在此模块扩展
  • spear 长连接服务模块
    • 提供长连接接入的模块
    • 最小化模式部署时只需要此模块的一个实例即可
  • minions 监控模块
    • 目前可监控集群长连接服务spear节点数、每个节点的用户数等
    • 节点间管理、用户管理可在此模块扩展
  • spear-client 客户端模拟,压测示例代码
  • 示例项目: gru-example
    • 以IM作为示例展示基于Gru构建实时应用
    • 支持群聊和单聊

特性

  • 支持单点部署和集群模式部署
  • 采用socket.io协议
  • 各模块均支持水平扩展
  • 单节点可服务10W+以上长连接,具体为在不断发消息的情况下(1000条/秒),单长连接服务节点支持的稳定连接数量在10W+(8核16G)
  • 节点间通讯支持多种方式:进程内、redis、rocketmq

安装部署

git clone https://github.com/sumory/gru.git /data/tmp/gru

最小安装,单点部署

如果只想体验单节点的部署模式,不需要监控、负载均衡及其它业务服务,只需要部署一个spear节点即可。部署方式如下:

cd /data/tmp/gru
mvn install #本地安装
cd spear
mvn clean package -Pdev #生成spear可运行包,使用dev的配置文件
cd target/release #该目录下有所有spear运行需要的文件
ll conf # 主要配置文件位于conf/system.properties下,默认以single模式运行,不依赖zookeeper/redis等
sh bin/start.sh # 启动

以上步骤完成后即可在本地的31001端口开启一个spear实例监听,等待客户端连接。

若想查看如何使用该spear实例,请移步gru-example,启动该项目,访问http://127.0.0.1:60000即可。

集群方式部署

集群的安装配置较为复杂,详见Gru集群安装配置

监控后台screenshots

gru's People

Contributors

sumory avatar

Watchers

James Cloos avatar Leon Basse avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.