Coder Social home page Coder Social logo

imgo's Introduction

Imgo

Imgo is a distributed and high performance push server written in golang based on goim. compared to goim,it added offline message support,add will support IM server later on.

Features

  • Light weight and high performance
  • Supports single push, multiple push and broadcasting
  • Supports one key to multiple subscribers (Configurable maximum subscribers count)
  • Supports authentication (Unauthenticated user can't subscribe)
  • Supports multiple protocols (WebSocket,TCP)
  • Supports offline message (you can push even if user is not online)
  • Scalable architecture (Unlimited dynamic comet,logic,router,job modules)
  • Asynchronous push notification based on Kafka

Architecture

Client connect to server:

arch

A client wants to subscribe a channel on comet through tcp or websocket,comet tells logic: "Here comes a guy,shall I keep a connection with him ?".

Logic take the token from comet and showed it to store: "Is this token valid? If it is,tell me the user id".

Logic got the user id,told router this user is online and keeps a connection with that comet,and told comet:"yes, you shall".

Then comet keeps connect to that client,and matains a heartbeat with him.

Logic knowed that comet and client was keep a connection, he ask store:"Is there any offline message of that user ?","yes,three of it",store answered and gave these to logic.

Logic packed the message into an envelope and thrown to kafka.

Job found a new envelope in kafka,fetch it and read the address:"comet 1,user 123456",then he told comet 1:"tell this to user 123456".

At last,comet told this message to user 123456.


Server push message to client:

arch

Caller(usually a bussiness system) tells logic:"I want to send hello to a person,his user id is 123456".

Logic got the user id,ask router:"Is user 123456 online ?","yes,he is keeping a connection with comet 1" router replied.

Logic packed the message into an envelope and thrown to kafka.

Job found a new envelope in kafka,fetch it and read the address:"comet 1,user 123456",then he told comet 1:"tell this to user 123456".

At last,Comet told this message to user 123456.

Protocol:

proto

Document

中文

Examples

Websocket: Websocket Client Demo

Java: Java

Benchmark

benchmark

Benchmark Server

CPU Memory OS Instance
Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz DDR3 32GB Debian GNU/Linux 8 1

Benchmark Case

  • Online: 1,000,000
  • Duration: 15min
  • Push Speed: 40/s (broadcast room)
  • Push Message: {"test":1}
  • Received calc mode: 1s per times, total 30 times

Benchmark Resource

  • CPU: 2000%~2300%
  • Memory: 14GB
  • GC Pause: 504ms
  • Network: Incoming(450MBit/s), Outgoing(4.39GBit/s)

Benchmark Result

  • Received: 35,900,000/s

中文

English

LICENSE

imgo is is distributed under the terms of the MIT License.

imgo's People

Contributors

imroc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.