What's new

AdGuardHome Where is the DNS cache file for AdGuard Home located?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

johndoe85

Senior Member
As the title reads, where is the DNS cache file for AdGuard Home located?
 
As the title reads, where is the DNS cache file for AdGuard Home located?
The location of the DNS cache file for AdGuard Home can vary depending on the operating system and installation method you're using. By default, AdGuard Home stores its cache in a file called "querylog.db" within its data directory.
Here are the default locations for the AdGuard Home data directory on different operating systems:
  • Linux: /opt/adguardhome/data/
  • Windows: C:\ProgramData\AdGuardHome\data\
  • macOS: /Applications/AdGuardHome/AdGuardHome.app/Contents/data/
Please note that these paths may vary if you have customized the installation or if you're using a different operating system.
Within the data directory, you should find the "querylog.db" file, which contains the DNS cache information.

For the asuswrt-merlin addon, the location would be /opt/etc/AdGuardHome/data/querylog.db

HTH

*Edit*
Some additional clarification about how AdGuardHome Cache responses. The DNS cache itself is stored in memory instead of actually being saved to a file. For you this means that there is no physical location the response is actually stored. The cache mechanics of AdGuardHome utilize program's memory space for storing cache responses. This allows it to store DNS responses for a certain specified duration of time. This cache is dynamically managed by AdGuardHome itself. AdGuardHome utilizes the LRU (Least Recently Used) caching algorithm, where older or less frequently accessed DNS responses are gradually evicted from the cache as new entries are added. This keeps the cache responses current. Upon restarting AdGuardHome, the cache is completely cleared. Also, cached entries cannot be manipulated outside of the AdGuardHome memory space since AdGuardHome manages the storing of cached entries in its memory. /opt/etc/AdGuardHome/data/querylog.db Keeps a record of all requests made and not just the specified requests in the query log. Actually disabling the cache does not disable the query log since both features are dynamically different.
 
Last edited:
The location of the DNS cache file for AdGuard Home can vary depending on the operating system and installation method you're using. By default, AdGuard Home stores its cache in a file called "querylog.db" within its data directory.
Here are the default locations for the AdGuard Home data directory on different operating systems:
  • Linux: /opt/adguardhome/data/
  • Windows: C:\ProgramData\AdGuardHome\data\
  • macOS: /Applications/AdGuardHome/AdGuardHome.app/Contents/data/
Please note that these paths may vary if you have customized the installation or if you're using a different operating system.
Within the data directory, you should find the "querylog.db" file, which contains the DNS cache information.

For the asuswrt-merlin addon, the location would be /opt/etc/AdGuardHome/data/querylog.db

HTH
Ahaa ok. Yeah i have seen that file around, but i thought it was for.. query logs! :D
 
The location of the DNS cache file for AdGuard Home can vary depending on the operating system and installation method you're using. By default, AdGuard Home stores its cache in a file called "querylog.db" within its data directory.
Here are the default locations for the AdGuard Home data directory on different operating systems:
  • Linux: /opt/adguardhome/data/
  • Windows: C:\ProgramData\AdGuardHome\data\
  • macOS: /Applications/AdGuardHome/AdGuardHome.app/Contents/data/
Please note that these paths may vary if you have customized the installation or if you're using a different operating system.
Within the data directory, you should find the "querylog.db" file, which contains the DNS cache information.
This sounds like an answer from ChatGPT 🙃

For the asuswrt-merlin addon, the location would be /opt/etc/AdGuardHome/data/querylog.db
That's a useful human answer 🙂
 
So if querylogging is disabled (including querylog: file_enabled option) caching is disabled too?
 
So if querylogging is disabled (including querylog: file_enabled option) caching is disabled too?
The query logging feature and caching feature are independent of each other. Disabling query logging does not mean disable caching, and vice versa. The query logging feature in AdGuardHome allows you to log DNS queries made by clients, and you can choose to save the logs to a file or view them through the web interface. This feature provides you with visibility into the DNS traffic and can be helpful for troubleshooting or monitoring purposes. Disabling query logging means that AdGuardHome will no longer keep a record of the DNS queries. On the other hand, the caching feature in AdGuardHome is responsible for storing DNS responses for a certain period of time. When a client makes a DNS query, if the response is cached, AdGuardHome can serve the response from the cache instead of forwarding the request to the upstream DNS server. This caching mechanism helps improve performance by reducing the response time for frequently accessed DNS records. In the grand scheme of things, disabling query logging does not have any directly impact on the caching functionality of AdGuardHome. You can choose to enable or disable caching independently of query logging, or vice versa. As you probably already noticed, the cache config options, such as the cache size and duration separate settings in AdGuardHome's config than query logging. It just so happens, that both features share the same data querylog.db where they both take up storage and consume more resources as they grow in size.

For answers to more questions about AdGuardHome, please take the time to cruise over to AdGuardHomes wiki and github where there is top notch resources and subject matter experts available to give you the rundown on AdGuardHome.

https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration
 
Why would they cache to disk, especially a potentially slow USB drive? Aren’t caches supposed to be in RAM?
What you are saying is correct. From my understanding the actual immediate cached response is not stored here, but a record of the cache responses is kept here for leveraging cache_optimistic mode and logging purposes, but I actually encourage the users with all these questions to visit the AdGuardHome for questioning the actual experts on the product as none of its experts are here answering questions on this forum (atleast none that openly announce themselves).

I provided some additional clarity in my post above.
*Edit*
Some additional clarification about how AdGuardHome Cache responses. The DNS cache itself is stored in memory instead of actually being saved to a file. For you this means that there is no physical location the response is actually stored. The cache mechanics of AdGuardHome utilize program's memory space for storing cache responses. This allows it to store DNS responses for a certain specified duration of time. This cache is dynamically managed by AdGuardHome itself. AdGuardHome utilizes the LRU (Least Recently Used) caching algorithm, where older or less frequently accessed DNS responses are gradually evicted from the cache as new entries are added. This keeps the cache responses current. Upon restarting AdGuardHome, the cache is completely cleared. Also, cached entries cannot be manipulated outside of the AdGuardHome memory space since AdGuardHome manages the storing of cached entries in its memory. /opt/etc/AdGuardHome/data/querylog.db Keeps a record of all requests made and not just the specified requests in the query log. Actually disabling the cache does not disable the query log since both features are dynamically different.
 
Last edited:
As the title reads, where is the DNS cache file for AdGuard Home located?
Here is a general breakdown of how AdGuardHome allocates its memory resources to give you the overall picture.

  1. Memory Allocation: AdGuardHome dynamically allocates memory as needed to store data and perform its operations. It utilizes memory allocation mechanisms specified by its programming language (e.g. Go). AdGuardHome is able to adapt its memory usage based on the workload demands.
  2. Caching: AdGuardHome employs an in-memory cache to store DNS responses, as well as other frequently accessed data, such as blacklists, whitelists, and filtering rules. The cache is typically designed to be efficient and optimized for fast lookup and retrieval. AdGuardHome manages the cache size and evicts older or less frequently used entries to make room for new ones.
  3. Memory Efficiency: AdGuardHome leverages memory efficiently by optimizing data structures and minimizing unnecessary memory consumption. This includes techniques like using compact representations for data, avoiding duplication, and optimizing memory layout.
  4. Garbage Collection: AdGuardHome is built using a programming language that employs garbage collection (e.g. Go) which relies on the garbage collector to automatically reclaim memory that is no longer in use. The garbage collector identifies and frees memory that is no longer reachable by the program, thereby ensuring efficient memory utilization.
  5. Configuration Options: AdGuardHome often provides configuration options to adjust memory-related settings. This may include options to control cache size, TTL (time-to-live) for cached entries, and other memory-related parameters. These options allow users to fine-tune memory usage based on the available resources and specific requirements of their setup.
 
Last edited:
Here is a general breakdown of how AdGuardHome allocates its memory resources to give you the overall picture.

  1. Memory Allocation: AdGuardHome dynamically allocates memory as needed to store data and perform its operations. It utilizes memory allocation mechanisms specified by its programming language (e.g. Go). AdGuardHome is able to adapt its memory usage based on the workload demands.
  2. Caching: AdGuardHome employs an in-memory cache to store DNS responses, as well as other frequently accessed data, such as blacklists, whitelists, and filtering rules. The cache is typically designed to be efficient and optimized for fast lookup and retrieval. AdGuardHome manages the cache size and evicts older or less frequently used entries to make room for new ones.
  3. Memory Efficiency: AdGuardHome leverages memory efficiently by optimizing data structures and minimizing unnecessary memory consumption. This includes techniques like using compact representations for data, avoiding duplication, and optimizing memory layout.
  4. Garbage Collection: AdGuardHome is built using a programming language that employs garbage collection (e.g. Go) which relies on the garbage collector to automatically reclaim memory that is no longer in use. The garbage collector identifies and frees memory that is no longer reachable by the program, thereby ensuring efficient memory utilization.
  5. Configuration Options: AdGuardHome often provides configuration options to adjust memory-related settings. This may include options to control cache size, TTL (time-to-live) for cached entries, and other memory-related parameters. These options allow users to fine-tune memory usage based on the available resources and specific requirements of their setup.
Ok nice! What are considered good TTL values? Especially for the kind of routers we use?
 
Ok nice! What are considered good TTL values? Especially for the kind of routers we use?
It is talking about the ttl of the dns request. The min ttl and max ttl option is adjustable on the adguardhome dns settings page right next to the optimistic caching option.

I think some rather sane values are

Min:3600
Max:14400
 
Ok nice!

Regarding the cache file, since it stores data in this .db file, it takes time to open this file on boot. Does it closes this file during normal operations? I assume it keeps it up in the ram during normal operations with writes to the .db file from time to time?

What is a sane value for cache size without getting a slow system? Both in cache being to small and adguard gotta fetch data from the outside world. And the cache size being to big to handle.

For me im using RT-AX86U with a usb connected ssd drive.
 
Ok nice!

Regarding the cache file, since it stores data in this .db file, it takes time to open this file on boot. Does it closes this file during normal operations? I assume it keeps it up in the ram during normal operations with writes to the .db file from time to time?

What is a sane value for cache size without getting a slow system? Both in cache being to small and adguard gotta fetch data from the outside world. And the cache size being to big to handle.

For me im using RT-AX86U with a usb connected ssd drive.
Take the default number and divide it by four, that is as low as I would go without expecting compromise in performance.
 
Thats like 1mb? :D
Mine is set to 50mb atm
That is okay. I set mine at 1mb. A typical cache doesn't need to more than 2 to 3 at most. Adguardhome just gives 4 as the default, but it can operate well at less. I operate at a lower value to reduce the amount of memory foot print.
 
Last edited:
That is okay. I set mine at 1mb. A typical cache doesn't need to more than 2 to 3 at most. Adguardhome just gives 4 as the default, but it can operate well at less. I operate at a lower value to reduce the amount of memory foot print.
Ah ok.
Well this is why i asked about the file location for the DNS cache to begin with. I wanted to see how big it actually was. :p
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top