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:

Android 性能优化(6)网络优化( 2) Analyzing Network Traffic Data:分析网络数据的更多相关文章

  1. Android 性能优化(5)网络优化 (1) Collecting Network Traffic Data 用Network Traffic tool :收集传输数据

    Collecting Network Traffic Data 1.This lesson teaches you to Tag Network Requests 标记网络类型 Configure a ...

  2. Android性能优化典范第二季

      Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitma ...

  3. Android性能优化典范(二)

    Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的 ...

  4. android app性能优化大汇总(google官方Android性能优化典范 - 第2季)

    Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的 ...

  5. Android性能优化典范 - 第2季

    Google发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的缩放,缓 ...

  6. Android性能优化问题总结

    性能优化这块,分为UI性能优化.内存优化.数据库优化.网络优化.耗电优化等等.可以从1.如何发现问题,2.怎么解决问题,3.解决效果对比,这几个方面去描述.举个简单例子——UI优化,可以从 UI出现什 ...

  7. Android 性能优化探究

    使用ViewStub动态载入布局.避免一些不常常的视图长期握住引用: ViewStub的一些特点: 1. ViewStub仅仅能Inflate一次,之后ViewStub对象被置空:某个被ViewStu ...

  8. 我把阿里、腾讯、字节跳动、美团等Android性能优化实战整合成了一个PDF文档

    安卓开发大军浩浩荡荡,经过近十年的发展,Android技术优化日异月新,如今Android 11.0 已经发布,Android系统性能也已经非常流畅,可以在体验上完全媲美iOS. 但是,到了各大厂商手 ...

  9. 【腾讯Bugly干货分享】Android性能优化典范——第6季

    本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/580d91208d80e49771f0a07c 导语 这里是Android性能优 ...

随机推荐

  1. 2018/4/7 Mybatis源码结构概览

    在观看Mybatis源码的过程中,有一点疑惑,就是Mybatis的缓存设计明显有问题,首先,Mybatis缓存分为两级,先说一级,生命周期为一个sqlsession,只有在查询相同方法时才会命中缓存, ...

  2. 1085 数字游戏 2003年NOIP全国联赛普及组

    丁丁最近沉迷于一个数字游戏之中.这个游戏看似简单,但丁丁在研究了许多天之后却发觉原来在简单的规则下想要赢得这个游戏并不那么容易.游戏是这样的,在你面前有一圈整数(一共n个),你要按顺序将其分为m个部分 ...

  3. P1605 迷宫 洛谷

    https://www.luogu.org/problem/show?pid=1605 题目背景 迷宫 [问题描述] 给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过.给定起点坐标和 终点坐 ...

  4. 使用异步委托执行线程(delegate)

    由于异步委托产生的线程与应用程序主线程是分开执行的,若主线程要获取异步委托线程的结果,则主线程需要等待异步委托的执行结果. BeginInvoke是Delegate类型的一个方法,它的返回类型为IAs ...

  5. SystemTap 学习笔记 - 安装篇

    https://segmentfault.com/a/1190000000671438 在安装前,需要知道下自己的系统环境,我的环境如下: uname -r 2.6.18-308.el5 Linux ...

  6. [52ABP系列] - 001、SPA免费项目模版搭建教程

    前言 这个项目是基于 ABP ASPNetCore 免费版,整合 NG-Alian 和 NG-Zorro 的项目,所以比较适合熟悉 ABP 和 Angular2+ 的开发人员, 如果你是新手,学习的话 ...

  7. 条款十六: 在operator=中对所有数据成员赋值

    当涉及到继承时,派生类的赋值运算符也必须处理它的基类成员的赋值!否则,当派生类对象向另一个派生类对象赋值时,只有派生类部分赋值了.看看下面: class base { public: ): x(ini ...

  8. Moravec算子

    Moravec在1981年提出了Moravec角点检測算子,并将它应用于立体匹配.它是一种基于灰度方差的角点检測方法.该算子计算图像中某个像素点沿着水平.垂直.对角线.反对角线四个方向的灰度方差,当中 ...

  9. 域名添加HTTPS

    准备 需要python版本为2.7以上,所以centos6需要把2.6升级成2.7 升级python ###安装python2.7 tar -xvf Python-2.7.5tar.bz2 cd Py ...

  10. C#.NET 如何在系统变量中加入新的环境变量

    比如我要将C:\Windows\Microsoft.NET\Framework\v3.5这个目录加入环境变量 则在系统的环境变量中点击Path,编辑,然后加入一个分号";",然后粘 ...