Skip to content
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

Use a fast 4G profile when running desktop lighthouse tests #645

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/devtools_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '750', '--throttling.cpuSlowdownMultiplier', cpu_throttle])
else:
# 10Mbps, 40ms RTT
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:
Expand Down
18 changes: 13 additions & 5 deletions internal/traffic_shaping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
plr = .0
shaperLimit = 0
logging.debug('Configuring traffic shaping: %d/%d - %d ms, %0.2f%% plr, %d tc-qdisc limit',
Expand Down