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

Hostname resolution cache for upload plugins #973

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

taclane
Copy link
Contributor

@taclane taclane commented Sep 13, 2024

The curl library does not utilize the host's DNS cache, and relies on an internal mechanism to determine when to resolve a hostname query.

However, the curl easy handles and multi handles found in uploader plugins are not reused, nor do they exist long enough to benefit from this internal mechanism. Every curl-based upload currently must start with a DNS lookup, no matter how recently the last one occurred. Trunk Recorder users with a home DNS server likely noticed that the top domains may be api.openmhz.com or api.broadcastify.com by several orders of magnitude.

This patch implements a shared curl cache within each of the three main uploaders (OpenMHz, Broadcastify, Rdio Scanner). These resolved hostnames will persist between uploads, and use a standard 300 second TTL to determine when to refresh the address.

The result of implementing this could reduce millions of unnecessary DNS lookups, and speed up uploads ~100 ms by maintaining a per-plugin hostname cache.

@robotastic
Copy link
Owner

This is great work!!

@robotastic robotastic merged commit 84f579a into robotastic:master Sep 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants