Code Monkey home page Code Monkey logo

performance-monitoring's Introduction

Performance-Monitoring

为showjoy前端组开发的前端性能监控系统

需求

服务器自动跑线上页面,收集性能指标数据,前端展示数据。 收集真实用户的线上性能数据,在后台页面展示。

参考文档

目标

完成服务器搭建,写好埋点js,手动跑页面,得到页面加载性能的数据(json格式)。数据类型有:

  • 白屏时间
  • 页面渲染完成时间
  • 页面load时间
  • 。。。

TODO

统计脚本:

  • 主文档加载速度,利用 Navigation Timing API 取得;
  • 静态资源加载速度,利用 Resource Timing API 取得;
  • 首次渲染速度,IE 下用 msFirstPaint 取得,Chrome 下利用 loadTimes 取得;
  • 文档生成速度,这个是后端的事,不做;

采集主文档加载速度的具体做法是:

navigation-timing

  • 在主文档 load 之前提供可缓存数据的接口,方便在统计脚本载入前就可以准备数据;
  • 在主文档 load 之后注入数据收集脚本,该脚本加载完成之后会处理所有的数据;
  • 利用 Navigation Timing API 收集计算得到上图中的指标;
  • 给所有数据打上页面、地理位置、浏览器等标签,方便更细维度的分析;

采集静态资源的加载速度:

resource-timing

如果使用 CDN 的话,需要让 CDN 服务商加上 Timing-Allow-Origin 的响应头,才能拿到静态资源的数据。

本地性能监控:

直接用 PhantomJS,所有数据都有了

需要统计的一些数据:http://fex.baidu.com/blog/2014/05/front_end-data/, 更多的数据项可以直接看 oneAPM 的吧。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.