From 704ec25a63ed24f210a1036216a192b9c7f4cc80 Mon Sep 17 00:00:00 2001 From: Patrick Meenan Date: Tue, 21 Nov 2023 13:08:07 -0500 Subject: [PATCH 1/3] Use a fast 4G profile when running desktop lighthouse tests --- internal/traffic_shaping.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/internal/traffic_shaping.py b/internal/traffic_shaping.py index 8c40e76ee..5e085a64e 100644 --- a/internal/traffic_shaping.py +++ b/internal/traffic_shaping.py @@ -18,6 +18,7 @@ def __init__(self, options, root_path): shaper_name = options.shaper self.support_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "support") self.shaper = None + self.options = options plat = platform.system() if shaper_name is None and plat == "Linux": shaper_name = 'netem' @@ -98,13 +99,20 @@ def configure(self, job, task): if 'shaperLimit' in job: shaperLimit = self._to_int(job['shaperLimit']) if self.shaper is not None: - # If a lighthouse test is running, force the Lighthouse 3G profile: + # If a lighthouse test is running, force the Lighthouse 3G profile for mobile + # or 4G for desktop: # https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md - # 1.6Mbps down, 750Kbps up, 150ms RTT if task['running_lighthouse'] and not job['lighthouse_throttle']: - rtt = 150 - in_bps = 1600000 - out_bps = 750000 + if self.options.android or ('mobile' in job and job['mobile']): + # 1.6Mbps down, 750Kbps up, 150ms RTT + rtt = 150 + in_bps = 1600000 + out_bps = 750000 + else: + # 10Mbps, 40ms RTT + rtt = 40 + in_bps = 10240000 + out_bps = 10240000 plr = .0 shaperLimit = 0 logging.debug('Configuring traffic shaping: %d/%d - %d ms, %0.2f%% plr, %d tc-qdisc limit', From f8dff57ae7f67b0e791bba06a69820e3793c8cb6 Mon Sep 17 00:00:00 2001 From: Patrick Meenan Date: Tue, 21 Nov 2023 13:38:43 -0500 Subject: [PATCH 2/3] Use 4G desktop config when dtshaper is enabled --- internal/devtools_browser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/devtools_browser.py b/internal/devtools_browser.py index 0049b53c2..03ae04d04 100644 --- a/internal/devtools_browser.py +++ b/internal/devtools_browser.py @@ -854,7 +854,12 @@ def run_lighthouse_test(self, task): else: cpu_throttle = '{:.3f}'.format(self.job['throttle_cpu']) if 'throttle_cpu' in self.job else '1' if self.job['dtShaper']: - command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '150', '--throttling.downloadThroughputKbps', '1600', '--throttling.uploadThroughputKbps', '768', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) + if self.options.android or ('mobile' in self.job and self.job['mobile']): + # 1.6Mbps down, 750Kbps up, 150ms RTT + command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '150', '--throttling.downloadThroughputKbps', '1600', '--throttling.uploadThroughputKbps', '768', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) + else: + # 10Mbps, 40ms RTT + command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '40', '--throttling.downloadThroughputKbps', '1024', '--throttling.uploadThroughputKbps', '1024', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) elif 'throttle_cpu_requested' in self.job and self.job['throttle_cpu_requested'] > 1: command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '0', '--throttling.downloadThroughputKbps', '0', '--throttling.uploadThroughputKbps', '0', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) else: From f904e5578eaccc1a9a9093f45b7778056c15a5ce Mon Sep 17 00:00:00 2001 From: Patrick Meenan Date: Wed, 22 Nov 2023 10:13:01 -0500 Subject: [PATCH 3/3] Fixed devtools throttle speeds --- internal/devtools_browser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/devtools_browser.py b/internal/devtools_browser.py index 03ae04d04..949bc4d7d 100644 --- a/internal/devtools_browser.py +++ b/internal/devtools_browser.py @@ -856,10 +856,10 @@ def run_lighthouse_test(self, task): if self.job['dtShaper']: if self.options.android or ('mobile' in self.job and self.job['mobile']): # 1.6Mbps down, 750Kbps up, 150ms RTT - command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '150', '--throttling.downloadThroughputKbps', '1600', '--throttling.uploadThroughputKbps', '768', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) + command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '150', '--throttling.downloadThroughputKbps', '1600', '--throttling.uploadThroughputKbps', '750', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) else: # 10Mbps, 40ms RTT - command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '40', '--throttling.downloadThroughputKbps', '1024', '--throttling.uploadThroughputKbps', '1024', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) + command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '40', '--throttling.downloadThroughputKbps', '10240', '--throttling.uploadThroughputKbps', '10240', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) elif 'throttle_cpu_requested' in self.job and self.job['throttle_cpu_requested'] > 1: command.extend(['--throttling-method', 'devtools', '--throttling.requestLatencyMs', '0', '--throttling.downloadThroughputKbps', '0', '--throttling.uploadThroughputKbps', '0', '--throttling.cpuSlowdownMultiplier', cpu_throttle]) else: