-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Possibility to throttle bandwidth #493
Comments
I really like to see this feature to be implemented as well |
I would also really like to see this feature in future releases |
+1 👍 |
I'm wondering, what would be the benefit gained from this feature? If the bandwidth is throttled, will it affect the metrics? It would affect the timing metrics (timeToFirstByte, latency), but in a predictable way. If that's the only difference, then it doesn't make sense to slow down the connection just to see a result that the connection was slow. Am I missing something? Can someone go into more detail about the benefit? |
My concerns are:
By throttling the bandwidth (like webpagetest does) you give developers more control over the Window performance metrics results. |
Emulating RTT (Round Trip Time) will be great to test locally hosted app against various network connections and devices (WiFi vs 3G). |
https://chromedevtools.github.io/devtools-protocol/tot/Network#method-emulateNetworkConditions - this is now provided by Chrome DevTools which we will use thanks to #707.
|
Resources
# Copied from
# WebKit/Source/devtools/front_end/network/NetworkConditionsSelector.js
# Units:
# download/upload: byte/s
# latency: ms
NETWORK_CONDITIONS = {
'GPRS': {
'download': 50 * 1024 / 8, 'upload': 20 * 1024 / 8, 'latency': 500},
'Regular2G': {
'download': 250 * 1024 / 8, 'upload': 50 * 1024 / 8, 'latency': 300},
'Good2G': {
'download': 450 * 1024 / 8, 'upload': 150 * 1024 / 8, 'latency': 150},
'Regular3G': {
'download': 750 * 1024 / 8, 'upload': 250 * 1024 / 8, 'latency': 100},
'Good3G': {
'download': 1.5 * 1024 * 1024 / 8, 'upload': 750 * 1024 / 8,
'latency': 40},
'Regular4G': {
'download': 4 * 1024 * 1024 / 8, 'upload': 3 * 1024 * 1024 / 8,
'latency': 20},
'DSL': {
'download': 2 * 1024 * 1024 / 8, 'upload': 1 * 1024 * 1024 / 8,
'latency': 5},
'WiFi': {
'download': 30 * 1024 * 1024 / 8, 'upload': 15 * 1024 * 1024 / 8,
'latency': 2}
} |
See puppeteer/puppeteer#6759 (in phantomas since #857) -> use const puppeteer = require('puppeteer');
const slow3G = puppeteer.networkConditions['Slow 3G'];
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.emulateNetworkConditions(slow3G);
await page.goto('https://www.google.com');
// other actions...
await browser.close();
})(); |
The latest Puppeteer brings puppeteer/puppeteer#7343 - CPU throttling emulation. page.emulateCPUThrottling(factor)
const puppeteer = require('puppeteer');
const slow3G = puppeteer.networkConditions['Slow 3G'];
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.emulateCPUThrottling(2);
await page.goto('https://www.google.com');
// other actions...
await browser.close();
})(); |
Throttling bandwidth would be nice to simulate mobile connection speed.
The text was updated successfully, but these errors were encountered: