Closed Bug 1907364 Opened 1 year ago Closed 11 months ago

ProxyResolution thread can use significant CPU on high request documents

Categories

(Core :: Networking: Proxy, enhancement, P2)

enhancement
Points:
8

Tracking

()

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: acreskey, Assigned: kershaw)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [necko-triaged][necko-priority-queue] )

Attachments

(1 file, 1 obsolete file)

It was observed in Bug 1904284 that we can spend a lot of CPU cycles in the ProxyResolution thread if there are a lot of requests.

Profile: https://share.firefox.dev/4bGMGZk

Kershaw suggest that we could optimize this as we did in bug 1392272 (reverted in bug 1749501):

However, I do see an opportunity here. From the all-thread sample, I notice that the ProxyResolution thread uses ~30% CPU resources. I think it would be beneficial to revisit bug 1392272 (which was reverted in bug 1749501) to avoid reading system proxy settings for every HTTP request.

Blocks: necko-perf
See Also: → 1904284
Severity: -- → N/A
Points: --- → 8
Rank: 2
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priotity-review]
See Also: → 1907701
Blocks: 1904284
Whiteboard: [necko-triaged][necko-priotity-review] → [necko-triaged][necko-priority-review]
Flags: needinfo?(kershaw)
See Also: → 1911450
Whiteboard: [necko-triaged][necko-priority-review] → [necko-triaged][necko-priority-next]
Flags: needinfo?(kershaw)
Whiteboard: [necko-triaged][necko-priority-next] → [necko-triaged][necko-priority-queue]

The initial patch in bug 1392272 was backed out because it didn’t handle the proxy exception list correctly.
The first step would be to add a test to ensure that future changes don’t cause regressions.
I plan to work on this bug soon.

Assignee: nobody → kershaw

Previously, we called the Android system proxy API via JNI for every new request.
With this change, the proxy config is cached, allowing us to reuse the result and avoid repeated JNI calls.

Blocks: perf-android
Attachment #9488718 - Attachment is obsolete: true
Pushed by kjang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7d26bbeb5528 Cache system proxy config on Android, r=necko-reviewers,geckoview-reviewers,valentin,m_kato

I compared this patch again on the newssite-applink-startup applink_startup (without profiling runs) but it did not pick up any improvements.

https://perf.compare/compare-results?baseRev=77ac96ad1ce81db0107b8ab6082b147499eeb01b&newRev=ab24cf5ecd088c311a3f2f14a709d8271822a53a&baseRepo=try&newRepo=try&framework=15

Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 141 Branch
QA Whiteboard: [qa-triage-done-c142/b141]
Depends on: 2028356
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: