The evolution and exploration of the enterprise's self-built Apple notification push system architecture

Source: Internet
Author: User

In enterprise app development, there is a unique notification push function for Apple devices to solve, especially when doing mobile IM, the APNs (Apple Push Notification service) requirements are relatively high, although there are special third parties to provide such services, But for the safety of the filter, the ability of the company would rather self-built push service system. I combine the development experience in the work, in this discussion of the evolution and exploration of its architecture, hoping to make such systems more perfect.

The hierarchical relationship of the IM system self-built Apple notification push service system is as follows:

Figure 1 Hierarchical relationships

Let's start by explaining the use of APNs in my work:


For the initial solution I have been set up in the project team, the specific response plan is as follows:

Figure 3 Original design scheme

Although this method to achieve the function, but for the promotion of the application of a large number of users, the system's ability to withstand and expansion is clearly insufficient, although the push system has been based on user settings information, to minimize the pressure, but for IM software is still not enough, And there are two special requirements for IM class Apps: the corner label and the message order.

For a lot of filtration, two months, I made the following improvements to the push system, first from the architecture:

Figure 4 Single Certificate Solution

I use the RABBITMQ routing function to do the system load balancing support, because the device number of the Apple device is fixed 64-bit length, and unique, so the user's device number to do hash (hash), the specific algorithm is as follows:

Public abstract class Routekeyutil {        private static Properties prop = Configutil.getapnsconfig ();        private static Map<integer, string> Map;        static {        String list = Prop.getproperty ("queues");        string[] queues = List.split (",");        Map = new Hashmap<integer, string> ();        int II = 1;        for (String q:queues) {            if (Stringutils.isnotempty (q)) {                map.put (integer.valueof (ii++), q);            }        }    } Public    static string Genarateroutekey (String token) {        if (token = = NULL | | token.isempty ()) {            throw new Il Legalargumentexception ("token is empty");        int random = Token.charat (0) * Token.charat (1);        int index = random% map.size () + 1;        Return Map.get (integer.valueof (index));    }        public static Map<integer, string> getallqueues () {        return Map;    }}

Because Apple's certificate is divided into enterprise certificates and developer certificates, and the two certificate has a different calling interface address, Apple server returns a Send failure error if it is incorrectly tuned. So for two certificates we make a difference in a system, but the same structure is the same, as follows:

Figure 5 Dual Certificate Solution

But the use of MQ to do load balancing has a mission to the shortcomings, is not mutual perception, one but the monitoring server down, the message will be in MQ backlog, in order to solve this problem, I use the subscription function provided by zookeeper to do a monitoring scheme, zookeeper for storage configuration, The health detection system is used to monitor the service status and dynamically modify the configuration, so that the fail-over transfer (failover) function can be easily implemented, which is designed as follows:

Figure 6 system monitoring

This system design is still a lot of shortcomings, it is proposed that we can give some valuable advice.


The evolution and exploration of the enterprise's self-built Apple notification push system architecture

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.