当前位置:网站首页>Monitoring web performance with performance
Monitoring web performance with performance
2022-07-05 03:10:00 【Sanshui caoshu】
Monitoring indicators :
google The developers came up with a RAIL Model to measure application performance .
Response: Respond to user input ,
Animation: Animation or scrolling needs to be done in 10ms The next frame is generated within the frame ,
Ilde: Maximize free time ,
Load: Page load time is not more than 5 second .
Animation,Idle,Load, Separate codes web Four different aspects of the application life cycle .
user-centric , The ultimate goal is to make your website run quickly on any specific device , It's about satisfying users ,
Respond to users immediately , stay 100 Confirm user input... In milliseconds ,
When animating or scrolling , stay 10 Generate frames in milliseconds ,
Maximize the idle time of the main thread ,
Continue to attract users , stay 1000 Present interactive content within seconds .
We can look at it from three aspects : Response speed , Page stability , External service call .
Response speed : Initial page access speed + Interactive response speed ,
Page stability : Page error rate ,
External service call : Network request access speed .
Page access speed : hang , First screen time , Interactive time .
performance Of The Paint Timing API: window.performance.getEntriesByType(“paint”);
first paint(FP): First render ,
first contentful paint(FCP): For the first time, there's content rendering .
These two indicators have been standardized , from performance Of The Paint Timing API Can be obtained , Generally speaking, I want to love you and communicate with you in two times , But there are also cases where the two are different .
Suppose a web page DOM When the structure changes dramatically , That's when the main content of this page appears , So at such a point in time , It's the first meaningful rendering
First meaingFul paint: The first meaningful rendering ,
hero element timing: Key elements of the page .
Time to interactive: Interactive time .
Performace analysis
performance attribute
Browser provided performace API, This is also the main source of performance monitoring data ,performace Provide high precision timestamps , The accuracy can reach nanosecond level , And it won't be affected by the time setting of the operating system . At present, mainstream browsers support .
window.performance.navigation: Page load or refresh , How many redirections have occurred ,
window.performance.timing: The duration of each stage of page loading ,
window.performance.memory: Basic memory usage ,Chrome A nonstandard extension added .
window.performance.timeorigin: Time at the beginning of performance measurement high precision timestamp .
Use performace Calculation
performance.getEntriesByType(“navigation”);
Number of redirects :performance.navigation.redirectCount,
Redirection takes time : redirectEnd - redirectStart,
DNS Analytical time consuming : domainLookupEnd - domainLookupStart,
TCP Time consuming to connect : connectEnd - connectStart,
SSL Secure connections take time : connectEnd - secureConnectionStart,
Network requests take time (TTFB): responseStart - requestStart,
Data transmission takes time : responseEnd - responseStart,
DOM Analytical time consuming : domInteractive - responseEnd,
Resource load time : loadEventStart - domContentLoadedEventEnd,
First package time : responseStart - domainLookupStart,
White screen time : responseEnd - fetchStart,
First interactive time : domInteractive - fetchStart,
DOM Ready Time : domContentLoadEventEnd - fetchStart,
Page full load time : loadEventStart - fetchStart,
http Head size : transferSize - encodedBodySize.
Resource Timing API
performance.getEntriesByType(“resource”);
/ Load time of a resource type , Measurable pictures 、js、css、XHR
performance.getEntriesByType("resource").forEach(resource => {
if (resource.initiatorType == 'img') {
console.info(`Time taken to load ${
resource.name}: `, resource.responseEnd - resource.startTime);
}
});
summary
be based on performance We can measure the following aspects :mark、measure、navigation、resource、paint、frame.
let p = window.performance.getEntries();
Number of redirects :performance.navigation.redirectCount
JS Number of resources :p.filter(ele => ele.initiatorType === “script”).length
CSS Number of resources :p.filter(ele => ele.initiatorType === “css”).length
AJAX Number of requests :p.filter(ele => ele.initiatorType === “xmlhttprequest”).length
IMG Number of resources :p.filter(ele => ele.initiatorType === “img”).length
Total resources : window.performance.getEntriesByType(“resource”).length
It's time-consuming and time-consuming :
Redirection takes time : redirectEnd - redirectStart
DNS Analytical time consuming : domainLookupEnd - domainLookupStart、
TCP Time consuming to connect : connectEnd - connectStart
SSL Secure connections take time : connectEnd - secureConnectionStart
Network requests take time (TTFB): responseStart - requestStart
HTML Download time :responseEnd - responseStart
DOM Analytical time consuming : domInteractive - responseEnd
Resource load time : loadEventStart - domContentLoadedEventEnd
Other portfolio analysis :
White screen time : domLoading - fetchStart
Rough first screen time : loadEventEnd - fetchStart perhaps domInteractive - fetchStart
DOM Ready Time : domContentLoadEventEnd - fetchStart
Page full load time : loadEventStart - fetchStart
JS Total load time :
const p = window.performance.getEntries();
let jsR = p.filter(ele => ele.initiatorType === "script");
Math.max(...cssR.map((ele) => ele.responseEnd)) - Math.min(...cssR.map((ele) => ele.startTime));
CSS Total load time :
const p = window.performance.getEntries();
let cssR = p.filter(ele => ele.initiatorType === "css");
Math.max(...cssR.map((ele) => ele.responseEnd)) - Math.min(...cssR.map((ele) => ele.startTime));
Reprinted from AlloyTeam:http://www.alloyteam.com/2020/01/14184/
边栏推荐
- 腾讯云,实现图片上传
- When the low alcohol race track enters the reshuffle period, how can the new brand break the three major problems?
- Problem solving: attributeerror: 'nonetype' object has no attribute 'append‘
- Spoon inserts and updates the Oracle database, and some prompts are inserted with errors. Assertion botch: negative time
- Zabbix
- Hmi-32- [motion mode] add light panel and basic information column
- qrcode:将文本生成二维码
- Utilisation simple de devtools
- Asp+access campus network goods trading platform
- Performance of calling delegates vs methods
猜你喜欢
Avoid material "minefields"! Play with super high conversion rate
Apache build web host
Azkaban installation and deployment
Huawei MPLS experiment
SQL injection exercise -- sqli Labs
Zabbix
College Students' innovation project management system
Three line by line explanations of the source code of anchor free series network yolox (a total of ten articles, which are guaranteed to be explained line by line. After reading it, you can change the
ELFK部署
Why are there fewer and fewer good products produced by big Internet companies such as Tencent and Alibaba?
随机推荐
el-select,el-option下拉选择框
Use of kubesphere configuration set (configmap)
Spark SQL learning bullet 2
Yyds dry goods inventory intelligent fan based on CC2530 design
FBO and RBO disappeared in webgpu
Utilisation simple de devtools
Azkaban实战
PHP cli getting input from user and then dumping into variable possible?
Sqoop命令
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Character painting, I use characters to draw a Bing Dwen Dwen
2021 Li Hongyi machine learning (2): pytorch
Daily question 2 12
Tencent cloud, realize image upload
ELK日志分析系统
Zabbix
this+闭包+作用域 面试题
Watch the online press conference of tdengine community heroes and listen to TD hero talk about the legend of developers
1.五层网络模型
为什么腾讯阿里等互联网大厂诞生的好产品越来越少?