IMCAFS

Home

"netease cloud reading"

Posted by trammel at 2020-04-13
all

When I go home for the new year, I can't let go of two apps in my mobile phone, one is wechat, the other is Netease cloud reading. This is not about wechat. Let's talk about Netease cloud reading. Just contact Netease cloud reading, is accidental, how to know the specific has forgotten. This app doesn't talk about the interaction experience (in terms of interaction details, it can only be said that it can meet the needs, but it doesn't exceed the expectations), but it does solve my problem of reading in fragmented time. Before reading the 36 krypton documents and articles of other websites on the web, the next tiger sniffing client saw the articles, and felt a bit scattered. Later, after the app was available, it directly subscribed to it, reducing the trouble of switching back and forth to read the articles. After that, I couldn't help it.  

Recently, there is an article about mobile architecture on InfoQ. After a general look at PPT, I think it's really written. For example, Netease cloud reading. So it's just a brief introduction to translate this article. Combined with my novice's understanding, it's also learning about Youxiu architecture.

The download address of Netease cloud reading: http://yuedu.163.com/

Mobile application architecture strategy (InfoQ address): http://www.infoq.com/cn/presentations/mobile-application-architecture-strategy

1. Application of platform

When using this app for the first time, it is found that it is a platform level application product. It does not produce content by itself, aggregates third-party information, and provides users with reading services. As a user, it does not need to view the article content everywhere, and content providers do not need to consider promotion and other matters, and can focus on their own content.

2. Problems of mobile products

A. the current network is very complex, resulting in uneven network speed, network dead corner and unstable network speed in the process of mobile in some places; (according to the data of the alliance, 2G and WiFi currently account for about 40% respectively, and 3G for about 20%).

B. the screen size of different devices is not uniform, which leads to the need for content adaptation according to the size, and it is a bit hard to achieve two boxes of visual presentation; (there are more than ten IOS products, among which iPhone and iPad account for a large proportion; there are many Android products, and there are more than 40 kinds of data from the alliance, http://umindex.com/ #android_device) 。

C. The hardware capabilities of mobile devices are limited

The mobile device is running app, which is equivalent to an independent server. First of all, the battery capacity is small, which requires the app to be written to save power; small memory often causes the app to flash back due to the lack of memory (that is to say, the toy I made before often flickers back when testing); CPU processing capacity is limited, and complex logic processing needs to be carried out to deal with it in the cloud server; storage space is limited, which is limited by Save the card, everyone knows.

3. Server architecture

There is nothing special about this. The typical architecture of web application (providing HTTP request service for app, if it is static picture or static file, there will be corresponding CDN server to speed up such request). At the front end, there is a load balancing processor (such as the LVS program running machine); then there is a web server (such as Apache or nginx, currently the main engine of Taobao, Tengine, an improved version of nginx, which is maintained by a team); then there is an app server (as a java development, I temporarily understand it as a java web program, which is distributed and can be expanded dynamically horizontally, It means that the addition and subtraction machine has no impact on the foreground request and background data); then it is followed by the database, cache processor, distributed file system and other persistence facilities.

For cloud reading products, it seems that there are several strategies for obtaining information. Although it's anecdotal, I think it's similar.

A. open platform docking: content providers can synchronize the latest article information to the corresponding persistence facilities of app server by calling API interface, which is the most convenient, but need to monitor the stability of the interface;

B. the content provider maintains the content in the background provided by Netease cloud reading, and directly enters the article and other information in the background;

C. Netease cloud reading develops a server-side program to capture the information released by the content provider, filter, clean and store it to provide external services;

The following figure shows the architecture of the capture service:

        

Manager is responsible for loading the URL information provided by the third party, then crawler is responsible for grabbing the information, then analyzer is responsible for analyzing the DOM structure of the page, and then storing it in the DB to provide external services.

4. Client Architecture

From the following figure, the client design is hierarchical and very clear.

A. the local database of the client is responsible for storing the user's personal information, system configuration information, and cache data. The data stored here needs to be stored on the server side, that is, the data needs to be synchronized. It's a painful thing that I replaced a mobile phone and the previously set information didn't synchronize;

B. view layer, which is responsible for the display of view and the optimization of UI. Animation effect, page callback, etc., similar to the view layer in the web, are responsible for display;

C. network layer, which I personally understand, is responsible for encapsulating network requests (assembling parameters, initiating requests, parsing returned results);

D. logic control, service composition and data persistence I think it is a layer, which is the core logic processing, running on the client side, and data acquisition and storage depend on the network layer to send requests to the server side;

In this way, the architecture of the client is relatively clear and the maintenance is less painful.

        

5. Optimization strategy

A. the image server is intelligent. Try to return the appropriate pictures on the client side, such as the pad products, which directly return the pictures with larger size, and the mobile phones which return the pictures with smaller size. The cutting and concentration of the pictures are completed on the server side, which needs to be done again on the client side;

B. determine whether to preload and load the priority. Pictures or articles have page turning operations of "next page" and "previous page", which can be preloaded according to the user's usage habits. For example, users are used to "next page" operations when reading articles, so we will put the next page when the user "reads the current page" The article is loaded on the page, so that the user will have a good experience when reading the next page (several variables can be maintained on the client side, and the user's behavior can be transformed into measurable numbers, so that these variables can be relied on to determine whether to load in advance);

C. the cache needs to be managed. Whether the cache needs to be invalidated needs to be judged. One is to request the server. If the data expires, it can be invalidated directly. The other is that the client fails according to the capacity (this is similar to the server cache invalidation strategy);

D. data compression: to save traffic, you need to compress (UC browser can save traffic, because of compression). Netease cloud reading uses gzip compression. When the server sends data, it compresses the data through gzip, and then the client accepts it, and then decompresses it according to the protocol, so the traffic is saved;

E. use HTTP long connection (because building HTTP link is a time-consuming operation, it can preserve the long connection, reduce the network and resource overhead of repeated handshake), resume at breakpoint (for large files, it can reduce the network traffic), and reconnect strategy (if the network is abnormal, reconnect according to the appropriate algorithm, but the best method is idempotent) ;

F. message push. IOS has its own notification mechanism (IOS push). Android Google has products, but they are not easy to use in China. You know, you need to build your own push service for mobile terminals. One principle is shared by Netease cloud reading. One is that after the mobile terminal logs in, it maintains the connection with the push server, and the push server actively beats to maintain the connection (the mobile terminal can dynamically adjust the heartbeat interval of the push server);

6. System reuse

A. try to use the existing solutions because of low cost and low risk;

B. reuse of UI components, source code and open source components. The framework design is ingenious, and the plug-in development is enough;

Ideally, integrate existing systems to create new applications.

Ppt basically introduces the situation of "Netease cloud reading" product, which is very detailed. Later, the author mentioned the product design and demand processing, which is not covered here. ​