Architecture analysis of message push system based on go language

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

This system is cheetah mobile based on go language development of a set of message push system, Source address: Https://github.com/Terry-Mao/goim

First, the structure diagram


Second, the function of the introduction


1.comet

Long connection server, support long rotation, TCP, websocket connection, have timeout mechanism

2.logic

Logical processing server, message push into the port, through the UserID in the router server to find the corresponding Comet server, the ServerID and messages saved to the Kafka queue, logic is a stateless server, can be arbitrarily add and remove, because comet needs to connect logic, So the virtual Ip,lvs with the LVS that need to connect logic in the comet server will not be broken after adding the real server, so it is necessary to trigger sighup in the comet service and re-load the configuration file.

3.router

routing server, save userid and serverid userid roomid roomid

4.job

Message forwarding server, from the Kafka queue to get messages, sent to the comet server, stateless server can be arbitrarily additions and deletions.

Third, the characteristics of the push service

1. Support multiple connections on one side, such as the same user on a different computer login can receive messages at the same time;

2. Client-side differentiation not supported (pc/wap/ios/android)

3. There is currently no query whether a user is online, some business has the need to display online status, this can add an interface to the logic server, if the message is not in the line may be sent through other push services (such as carrier pigeon push), this can be modified by the push interface return value to determine

4. Mass can only be received online, if not on the line to discard this message, of course, the next time users can log on through the unread message interface to get

5. Comet->logic->router, rather than comet->router, during long connections, so that other user states, unread messages, etc. can be obtained in the logical server, which makes comet simple and does not have consistency issues.

6. Support the mass function, all users or according to Roomid to Mass, this function is too cool, efficiency is not to improve the 1:30 point.


Thanks to the open source IM products of the cheetah students, so that we can have more beautiful things


Other similar software are:

moonmq:http://blog.csdn.net/siddontang/article/details/22889495

rocketmq:http://blog.csdn.net/a19881029/article/details/34446629

beanstalkd:http://blog.csdn.net/xcl168/article/details/47705725

fishchat:https:// Github.com/oikomi/fishchatserver

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.