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

Cache DNS requests #103

Closed
makew0rld opened this issue Dec 17, 2024 · 2 comments
Closed

Cache DNS requests #103

makew0rld opened this issue Dec 17, 2024 · 2 comments

Comments

@makew0rld
Copy link

makew0rld commented Dec 17, 2024

I'm using this library in a database that timestamps data entries. When inserting data asynchronously, this means many OTS requests happen at once. One of the problems with this is an explosion of DNS requests, which slows things down and also puts load on the DNS server. In my case I actually hit my Pi-Hole rate limit.

Here are some screenshots from my DNS server (Pi-hole) showing the issue:

image
image
image

I will be rate-limiting my code to reduce load on the calendar servers too, but I just wanted to flag that if there's a way to do DNS caching that would be helpful.

Notably many of the requests were for AAAA ots.btc.catallaxy.com, which (1) doesn't exist and (2) isn't relevant because I am on an IPv4-only network.

@lvaccaro
Copy link
Member

Hi @makew0rld , do you use the library on your local npm project or in a web page?

You could reduce the number of requests by passing to the stamp() function the list of calendars you want to use; with a list of calendars you could avoid to use ots.btc.catallaxy.com (if you don't need it) and avoid too make 3/4 requests with 3 proofs for each stamp.

A Native DNS caching for lookups discussion is available at nodejs/node#5893 .
Moreover the dns.promises.Resolver could be replaced by using DNS over HTTPS ("DoH"), as: https://www.npmjs.com/package/tangerine , https://www.npmjs.com/package/dns-over-http-resolver

@makew0rld
Copy link
Author

I'm using Node. I see now that not caching is a stdlib default and out of your control. Thanks for the links!

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

No branches or pull requests

2 participants