// nsIDNSListener that resolves a Promise when the lookup completes (or fails). class DNSListener {
constructor() { this.promise = new Promise(resolve => { this._resolve = resolve;
});
}
// Fire `count` concurrent native DNS lookups for unique .test hostnames. // Returns { wallMs, results } where results is the array of onLookupComplete // arguments and wallMs is the total elapsed wall-clock time in ms.
async function runBatch(count, runId) { const flags =
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE |
Ci.nsIDNSService.RESOLVE_DEFAULT_FLAGS;
const listeners = []; const t0 = Date.now();
for (let i = 0; i < count; i++) { const listener = new DNSListener();
listeners.push(listener);
Services.dns.asyncResolve(
`dns-stress-${runId}-${i}.test`,
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
flags, null,
listener,
Services.tm.mainThread,
{}
);
}
// Helper to run a batch, verify completion, and log results.
async function runBatchAndVerify(count, runId, label) {
Services.dns.clearCache(true); const batch = await runBatch(count, runId);
info(`[${label} iter=${runId}] ${count} lookups in ${batch.wallMs}ms`); Assert.strictEqual(
batch.results.length,
count,
`All ${label} callbacks fired`
); return batch.wallMs;
}
// Helper to compute average of an array. function average(arr) { return arr.reduce((a, b) => a + b, 0) / arr.length;
}
add_task(async function dns_resolver_contention() { // Shrink the thread pool to make contention predictable.
Services.prefs.setIntPref("network.dns.max_any_priority_threads", 2);
Services.prefs.setIntPref("network.dns.max_high_priority_threads", 0);
/* exported perfMetadata */ var perfMetadata = {
owner: "Network Team",
name: "DNS Benchmark",
description: "Benchmark for DNS resolver lock contention under low and high concurrency.",
longDescription: ` This test measures DNS resolver throughput by comparing baseline resolution
times with low concurrency (within the thread pool) against performance under
high concurrency (far exceeding the thread pool). It validates that the resolver
scales with available threads rather than serializing all requests.
`,
supportedBrowsers: ["Firefox"],
supportedPlatforms: ["Desktop"],
options: { default: { perfherder: true },
},
};
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-10-02)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.