Analyzing Network Traffic Data

  In the previous section, you tagged your app code with traffic identifiers, ran tests, and collected data. This lesson teaches you how to look at the network traffic data you have collected and directs you to actions for improving your app's networking performance and reducing power consumption.

2.Analyze App Network Traffic

  Efficient use of network resources by an app is characterized by significant periods where the network hardware is not in use. On mobile devices, there is a significant cost associated with starting up the radio to send or receive data, and with keeping the mobile radio active for long periods. If your app is accessing the network efficiently, you should see that its communications over the network are tightly grouped together, well spaced with periods where the app is making no connection requests.

  Figure 1 shows suboptimal network traffic from app, as measured by the Network Traffic tool. The app is making frequent network requests. This traffic has few periods of rest where the radio could switch to a standby, low-power mode. The network access behavior of this app is likely to keep the radio on for extended periods of time, which is battery-inefficient.

 图1是不规范的网络请求,分析截图。 

        Figure 1. Battery-inefficient network activity measured from an app.

  Figure 2 shows an optimal network traffic pattern. The app sends network requests in bursts, separated by long periods of no traffic where the radio can switch to standby. This chart shows the same amount of work being done as Figure 1, but the requests have been shifted and grouped to allow the radio to be in standby most of the time.

规范的网络请求会产生如下的图,它们分组的,这样网络设备就有空余时间。上图那个太频繁。

              Figure 2. Battery-efficient network activity measured from an app.

  If the network traffic for your app looks similar to the graph in Figure 2, you are in good shape! Congratulations! You may want to pursue further networking efficiency by checking out the techniques described in Optimizing General Network Use

  If the network traffic for your app looks more like the graph in Figure 1, it's time to take a harder look at how your app accesses the network. You should start by analyzing what types of network traffic your app is generating.

3.Analyze Network Traffic Types

  When you look at the network traffic generated by your app, you need to understand the source of the traffic, so you can optimize it appropriately. Frequent network activity generated by your app may be entirely appropriate if it is responding to user actions, but completely inappropriate if you app is not in the foreground or if the device in a pocket or purse. This section discusses how to analyze the types of network traffic being generated by your app and directs you to actions you can take to improve performance.

  In the previous lesson, you tagged your app code for different traffic types and used the Network Traffic tool to collect data on your app and produce a graph of activity, as shown in Figure 3.

              Figure 3. Network traffic tagged for the three categories: user, app, and server.

  The Network Traffic tool colors traffic based on the tags you created in the previous lesson. The colors are based on the traffic type constants you defined in your app code. Refer back to your app code to confirm which constants represent user, app, or server-initiated traffic.

  The following sections discuss how to look at network traffic types and provides recommendations on how to optimize traffic.

3.1 Analyzing user-initiated network traffic

  Network activity initiated by the user may be efficiently grouped together while a user is performing a specific activity with your app, or spread out unevenly as the user requests additional information your app needs to get. Your goal in analyzing user-initiated network traffic is to look for patterns of frequent network use over time and attempt to create, or increase the size of, periods where the network is not accessed.

  The unpredictability of user requests makes it challenging to optimize this type of network use in your app. In addition, users expect fast responses when they are actively using an app, so delaying requests for efficiency can lead to poor user experiences. In general, you should prioritize a quick response to the user over efficient use of the network while a user is directly interacting with your app.

  Here are some approaches for optimizing user-initiated network traffic:

  Caution: Beware of network activity grouping bias in your user activity test data! If you ran a set of user scenarios with your network testing plan, the graph of user-initiated network access may be unrealistically grouped together, potentially causing you to optimize for user behavior that does not actually occur. Make sure your user network test scenarios reflect realistic use of your app.

3.2 Analyzing app-initiated network traffic

  Network activity initiated by your app code is typically an area where you can have a significant impact on the efficient use of network bandwidth. In analyzing the network activity of your app, look for periods of inactivity and determine if they can be increased. If you see patterns of consistent network access from your app, look for ways to space out these accesses to allow the device radio to switch into low power mode.

  Here are some approaches for optimizing app-initiated network traffic:

3.3 Analyzing server-initiated network traffic

  Network activity initiated by servers communicating with your app is also typically an area where you can have a significant impact on the efficient use of network bandwidth. In analyzing the network activity from server connections, look for periods of inactivity and determine if they can be increased. If you see patterns of consistent network activity from servers, look for ways to space out this activity to allow the device radio to switch into low power mode.

  Here is an approach for optimizing app-initiated network traffic:

最新文章

  1. mybatis 中的where标签
  2. SAP验证
  3. Bootstrap_进度条
  4. java取整和java四舍五入方法 转自董俊杰
  5. 3 Servlet监听器
  6. windows phone 8 开发系列(二)Hello Wp8!
  7. POJ1947 - Rebuilding Roads(树形DP)
  8. 每天一条linux命令——login
  9. 根据图像路径,创建CBitmap对象的方法
  10. 《Java并发编程实战》第十四章 构建自己的同步工具定义 札记
  11. Git:四、连接GitHub远程仓库
  12. Data Source与数据库连接池简介 JDBC简介(八)
  13. Rocketlab公司火箭Electron介绍
  14. JDK源码分析(一)—— String
  15. H5——简易马祖
  16. 《Android进阶之光》--注解与依赖注入框架
  17. nginx保持会话的方式
  18. Java实现循环链表
  19. STM32的CRC32 软件实现代码
  20. Django服务端读取excel文件并且传输到接口

热门文章

  1. 基于端口的信息探测-portscan-1.0
  2. SQL SERVER示例:修改自定义数据类型精度
  3. jmeter的master-slave模式
  4. 当遇到Mac的Excel或者Word老是重复崩溃的时候
  5. Kafka跨集群同步工具——MirrorMaker
  6. PCCs系数
  7. linux 打包 压缩
  8. iOS开发——高级篇——iOS如何彻底避免数组越界
  9. POJ3254 状压dp
  10. ip(点分十进制 <==> 二进制整数)之间的转换