ObjFW  View Ticket

Ticket UUID: 316edadc2411d1b5e5597c32da432c72056ca771
Title: Add a cache in OFDNSResolver
Status: Fixed Type: Feature Request
Severity: Important Priority: Medium
Subsystem: Resolution: Fixed
Last Modified: 2024-05-22 20:13:26
Version Found In: Milestone: 1.1
User Comments:
js added on 2022-11-27 17:45:29:

Currently, OFHostAddressResolver queries the DNS server every time. However, this means no caching is performed when performing multiple connections to the same host. Look at the returned TTL and keep it in a cache for that long.


js added on 2022-11-28 22:15:17:

Actually, it probably makes more sense to add the cache in OFDNSResolver, as there is very little reason for any kind of DNS query to be repeated if the TTL hasn't expired yet.

This cache probably makes most sense to be per-instance, even though that means there is no reuse between threads. But the added locking on every lookup is probably worse than just doing one lookup per thread.


js added on 2023-07-15 14:39:00:

This is not causing any problems and purely a performance optimization, so really shouldn't block 1.0.


js added on 2023-12-29 16:30:06:

Implemented by 252f11c431578d91 and 219aa9cf659c2a6d.