当前位置:网站首页>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/
边栏推荐
- Multi person online anonymous chat room / private chat room source code / support the creation of multiple chat rooms at the same time
- 2021 Li Hongyi machine learning (1): basic concepts
- Design of kindergarten real-time monitoring and control system
- Performance of calling delegates vs methods
- Use of kubesphere configuration set (configmap)
- qrcode:将文本生成二维码
- LeetCode146. LRU cache
- Avoid material "minefields"! Play with super high conversion rate
- 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
- Class inheritance in C #
猜你喜欢
Zabbix
Azkaban安装部署
Port, domain name, protocol.
1.五层网络模型
Hmi-32- [motion mode] add light panel and basic information column
Talk about the SQL server version of DTM sub transaction barrier function
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
Tencent cloud, realize image upload
Accuracy problem and solution of BigDecimal
Ubantu disk expansion (VMware)
随机推荐
Single box check box
打破信息茧房-我主动获取信息的方法 -#3
Breaking the information cocoon - my method of actively obtaining information - 3
College Students' innovation project management system
When sqlacodegen generates a model, how to solve the problem that the password contains special characters?
Talk about the SQL server version of DTM sub transaction barrier function
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Use UDP to send a JPEG image, and UPD will convert it into the mat format of OpenCV after receiving it
看 TDengine 社区英雄线上发布会,听 TD Hero 聊开发者传奇故事
Yyds dry goods inventory intelligent fan based on CC2530 design
Hmi-30- [motion mode] the module on the right side of the instrument starts to write
Voice chip wt2003h4 B008 single chip to realize the quick design of intelligent doorbell scheme
[105] Baidu brain map - Online mind mapping tool
About MySQL database connection exceptions
[2022 repair version] community scanning code into group activity code to drain the complete operation source code / connect the contract free payment interface / promote the normal binding of subordi
2. Common request methods
Elfk deployment
El tree whether leaf node or not, the drop-down button is permanent
Tiny series rendering tutorial
Class inheritance in C #