preface

Only a bald head can be strong.

Star: github.com/ZhongFuChen…

Since doing push, every once in a while we found that there are major companies push accidents.




You ask me if I do development panic, of course I panic a lot.

Why do push accidents happen so often

Why do similar accidents often occur? I think the main reason is: the pre-delivery and online environment is the same.

As we all know, our system has several sets of environment (such as local/offline/pre-delivery/online environment). Most of the pre-delivery and online environment databases are the same, but the pre-delivery environment calls the interface of the pre-delivery environment, and the online environment calls the interface of the online environment.

In fact, there is not much difference between the online and pre-send environment of push system, because at the bottom, external interfaces are called to realize sending, so the pre-send and online environment are actually the same interface.


How does push work

I wrote an article about Push before, which is also a popular science of what Push message is. Interested students can go to see: Three Slanting guide you to understand what Push message is. This time on the basis of the above article to complete.

Push notifications can be used to Push information to you when your phone is closed (even if you don’t have the APP open), which is a kind of notification Push that can reach users directly

To send messages to users, we need to maintain a “long connection heartbeat” between the APP client and the server. If we maintain this long-connection heartbeat by ourselves, it will be very difficult, and most companies will not build their own push service.

Right now we have two types of phones: Android and iOS.

  • IOS we default to the official push channel APNS. IOS establishes a connection with the Apple Push Notification Service (APNs) server at the system level. After receiving the message from the APNs server, the system forwards it to the corresponding APP
  • Android due to Google in the domestic access instability, in the domesticyetUnified drop push service. At present, many mobile phone manufacturers are more in itscustomIs also built into the system push function, such as Xiaomi, Huawei, etc.. Due to the problem of access cost, there are also a large number of third-party push service providers, such as Getui, Aurora and Umeng.
    • The “Android Unified Push Alliance” led by the Ministry of Industry and Information Technology is still expected

Conclusion:

  • On iOS, APNs server is more commonly used to deliver push messages
  • Due to the problem of access cost, Android terminal is more connected to each third-party push service provider, and the third-party push service provider will also connect to the corresponding mobile phone manufacturer to deliver the message

What are we doing to prevent push incidents?

In most cases, push incidents tend to be caused by “operational” push. Operation to push messages to users, first need to circle a crowd to push.

Crowd size needs to be controlled: When we circle, if the number of people designated by the operation is greater than a threshold value, we will ask the supervisor to confirm whether we need to circle such a large crowd to push.

This piece serves two purposes:

  1. First of all, we think that the push crowd should be refined, and what tag crowd should receive what push. A large group of people should not be designated to push news about the same case (except news apps).
  2. Even if there is an accident, only some users will receive it, not all users.

In our system, there is no push by all users.


After the operation has defined the crowd, we will have a separate test function to “test whether a single user” can send messages normally and whether there are problems with copywriting links.

This step is mandatory. The message sent to the user must first pass through its own verification. If it is confirmed that there is no problem with the link and copy, the task will be submitted, and the work order can only be sent after approval.


You can also intercept the remaining unposted messages if you find problems with copywriting/links after startup.


For the notification messages (pushed by the technical side), we configure a “whitelist” in the pre-sending environment to receive the messages.

Online messages have a “de-duplication” logic:

  • Filter out duplicate messages for a certain period of time
  • Operational notification push (to send messages by targeting people) can be sent once by the same user at intervals.

Although we have made a lot of rules to avoid accidents, push is still an accident-prone function.

My cow force has been blown over, if one day found my push out of the accident, do not @ me, as never seen this article.

Summary of various knowledge points

The following articles have the corresponding original exquisite PDF, in the continuous update, you can come to me to urge more ~

  • The 92 – page Mybatis
  • Multithreading on page 129
  • 141 pages of the Servlet
  • The JSP page 158
  • A collection of 76 pages
  • 64 pages of JDBC
  • 105 pages of data structures and algorithms
  • The family of the Spring
  • Hibernate
  • AJAX
  • Listeners and filters
  • .

7 K STAR: github.com/ZhongFuChen…

If you want to follow my updated articles and shared dry goods in real time, you can search Java3y on wechat.

The content of the PDF document is typed by hand. If you don’t understand anything, you can ask me directly (the official account has my contact information).