-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: x1.5 CPU usage increase using Puppeteer between 20.8.3 to 20.9.0+ #12524
Comments
The issue has been labeled as confirmed by the automatic analyser. |
@mostafa-hisham could you check if you see the difference with 21.1.1 to 21.2.0? is it the same as #11944 ? |
@mostafa-hisham could you please also clarify if the increased CPU usage is for the node process running Puppeteer or for the browser process(es)? |
CPU usage in the graphs is for container CPU usage at this time. CPU is lower but many pages crash with this error
|
Hello @OrKoN I work with @mostafa-hisham.
We though about that initially, but in #11944, it seems you found precisely the version update that introduce the issue. In our case, we see the issue when going from 20.8.3 to 20.9 so it seems different. |
Thanks for the details, could you reproduce the issue outside of the server? Because I won't be able to accurately measure cpu usage increase without the actual workload and the server configuration (which CPUs, how many cores, anything else running there). Could you please update the example to measure the time spent similar to #11944? Also, it would be great to understand if you see the cpu increase in the node process or in the chrome process. |
So I finally got a chance to run it. I have reduced the script a bit:
I do not see a difference in time spent. Can you try the reduced script, do you still see the issue with? If yes, do you see a different time spent on the task or only the CPU usage? Note that I removed custom args as the support level for them is varying and to rule out that they are not the cause of the issue. UPD: same results with the same args |
In the latest version, my average time is 1014 but it is likely the other issue. |
Thanks for the update and looking into it.
We'll get back to you with that. In the meantime, is there a way for us to run Puppeteer v20.9 with a browser version from Puppeteer v20.8? It would help us see if the issue comes from the puppeteer library or the browser itself? |
@MathieuLamiot yes, you can specify the path to the browser you want to run via |
Did you have a chance to investigate where the CPU usage coming from and create a locally reproducible script? |
Hello, sorry not yet. The last few days have been crazy here ; but that's for sure still on the todo. Beginning with trying a different browser version |
@OrKoN We tested with Puppeteer v20.9 with chrome/linux-114.0.5735.133 (which is used in 20.8.3) and the issue does not appear. It would mean the browser is at the origin of the issue I suppose? |
@MathieuLamiot it would be helpful to figure out what process of the browser causes high usage or have a minimal example that reproduces the increased cpu usage. In the notes, I see that behavior of coverage has changed in 115 as well as the lazy frames behavior #10584 For coverage, I see that the browser produces more accurate ranges so if you do a lot of coverage reporting, maybe more detailed coverage results in more cpu used. |
@OrKoN
using the history command
here are the results I currently have {"values":[
{"puppeteer":"20.8.3","duration":1497.0737290000543,"browser":"HeadlessChrome/114.0.5735.133"},
{"puppeteer":"20.9.0","duration":2788.871739999857,"browser":"HeadlessChrome/115.0.5790.98"},
{"puppeteer":"20.9.0-114-chrome","duration":1468.5795260001905,"browser":"HeadlessChrome/114.0.5735.133"},
{"puppeteer":"22.12.0","duration":2801.1059679999016,"browser":"HeadlessChrome/126.0.6478.63"}
]} {"values":[
{"puppeteer":"20.8.3","duration":267.59014699980617,"browser":"HeadlessChrome/114.0.5735.133"},
{"puppeteer":"20.9.0","duration":274.9572280002758,"browser":"HeadlessChrome/115.0.5790.98"},
{"puppeteer":"20.9.0-114-chrome","duration":187.95026499964297,"browser":"HeadlessChrome/114.0.5735.133"},
{"puppeteer":"22.12.0","duration":409.4865039996803,"browser":"HeadlessChrome/126.0.6478.63"}
]} |
@mostafa-hisham so it looks like coverage in Chrome started to take more time? it is probably related to it being more detailed. Also, for the latest versions we should use |
Indeed, it looks like the root cause could be the more detailed coverage. It's too bad there is not a way to keep the "simple" version for performance when the advanced stuff is not needed. Anyway, I guess there is nothing puppeteer can do about it. We are looking into getting rid of uses of coverage for our application. Thanks |
Minimal, reproducible example
Error string
No error
Bug behavior
Background
Puppeteer is used to do a task involving query elements on the page, run CSS and JS coverage, and request interception similar to the code example above.
We use one browser instance and open multiple pages then close the page after the task is done, we don't create a new browser for each task.
Problem
After updating Puppeteer to v22.10.0 we noticed CPU usage has around x1.5 increase
The version we originally used was pretty old so we tried to track back when the CPU usage issue started
Test
We changed the puppeteer version and tested it on two servers with similar specs and did the same task on the same page URLS
The following screenshots have a graph for CPU usage on both servers, the only difference between the servers during the test is the Puppeteer version
if we used the same puppeteer version we always have them with CPU usage equal (up to 1 : 2%)
both 15.5.0 (both around 40% CPU usage)
![image](https://private-user-images.githubusercontent.com/29744252/336006028-e37b9327-b6fd-4fa8-b2f8-32b1a67e0d61.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MzIxOTksIm5iZiI6MTcyMTUzMTg5OSwicGF0aCI6Ii8yOTc0NDI1Mi8zMzYwMDYwMjgtZTM3YjkzMjctYjZmZC00ZmE4LWIyZjgtMzJiMWE2N2UwZDYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDAzMTgxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE4OTNhMDg2MWIzNDBlY2JjMWVmOTQ1YzkxMzllZjY5NGMzMTY4NDBiNGY2ZmM2OWVlYmZkOWFmMmFiYjYxMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9NiMb0UV1BQ5zZgqxTiCAzzTcLXgiaNxCk0BtIozTEM)
Green (mirror) -> v22.10.0 (mirror is higher 60% CPU usage)
![image](https://private-user-images.githubusercontent.com/29744252/335992028-acc85f9e-2e38-4f20-a6cb-0ea79c689952.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MzIxOTksIm5iZiI6MTcyMTUzMTg5OSwicGF0aCI6Ii8yOTc0NDI1Mi8zMzU5OTIwMjgtYWNjODVmOWUtMmUzOC00ZjIwLWE2Y2ItMGVhNzljNjg5OTUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDAzMTgxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhNTY4NzhkNTZjZjIxZjQwZWVlNjA3Y2I3Njk0NjM3NWUwMjQxZDY0MmVmODNkM2FkZDIzMmVlZTEwNzBiNmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OUKrlck7qmy_8n9555j6MpoKRVYnKl4EXQFCdoJGV3k)
Green (mirror) -> v22.10.0 with more pages opened in the browser, (mirror is higher around 70% CPU usage)
![image](https://private-user-images.githubusercontent.com/29744252/336009817-5c8168c7-eb4b-40c5-9cd0-112a5fcfbf04.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MzIxOTksIm5iZiI6MTcyMTUzMTg5OSwicGF0aCI6Ii8yOTc0NDI1Mi8zMzYwMDk4MTctNWM4MTY4YzctZWI0Yi00MGM1LTljZDAtMTEyYTVmY2ZiZjA0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDAzMTgxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYxODMwZWExZmY3YjZhNzM0Y2Q5MmIwZTI1Mjg3ZTA3OWNmYjYzODUxMjliYzU4MDYxZTM0NjIxMTQzMTk1YjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kwCaNnWpvXrrxxw3C2Wl2psSa-3I8Sdp7vOMg7oyxvI)
Green (mirror) -> v20.9.0 (mirror is higher 60% CPU usage)
![image](https://private-user-images.githubusercontent.com/29744252/336012770-91d545a8-16a2-4ad6-8674-9b6f43049773.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MzIxOTksIm5iZiI6MTcyMTUzMTg5OSwicGF0aCI6Ii8yOTc0NDI1Mi8zMzYwMTI3NzAtOTFkNTQ1YTgtMTZhMi00YWQ2LTg2NzQtOWI2ZjQzMDQ5NzczLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDAzMTgxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3ZDkyYTM0ZDQ3N2Y4OWVmMWUzYjc2Y2Y3NTdlODhhNzI5NDA0OTJlMTZkMzAyMDYwZWZmZDhmZTkxZjUxNjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.XLj2sdW2vgP1ZyKt_ZeozFL5K_OKthoFTezWGCAp7is)
Green (mirror) -> v20.8.3 (both around 40% CPU usage)
![image](https://private-user-images.githubusercontent.com/29744252/336006529-7624ab2e-c94d-4969-856d-677f103e8177.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MzIxOTksIm5iZiI6MTcyMTUzMTg5OSwicGF0aCI6Ii8yOTc0NDI1Mi8zMzYwMDY1MjktNzYyNGFiMmUtYzk0ZC00OTY5LTg1NmQtNjc3ZjEwM2U4MTc3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIxVDAzMTgxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBlYTJmYWUzMmU1YmQyZDM0MDE5NTk5NDgwYzk4ZjEyMmJiOTQxMjVhOTJjZDY3MWZlZWFhYzllMTA4Njc5MWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kJ53n4pLotCG69HRFFlhembufJCD81j1WeUnKOS1hCY)
Conclusion
The x1/.5 CPU usage increase started since Puppeteer v20.9.0 with browser version
HeadlessChrome/115.0.5790.98
and we still have this CPU usage increase in v22.10.0 with browser versionHeadlessChrome/125.0.6422.78
similar issue
#11944
Expectation
no CPU usage increase
Reality
CPU usage has around x1.5 increase
Puppeteer configuration file (if used)
Puppeteer version
22.10.0
Node version
18.0.0
Package manager
npm
Package manager version
8.6.0
Operating system
Linux
The text was updated successfully, but these errors were encountered: