mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2026-03-04 00:01:12 -05:00
Slow query log for filters "blocked *" #2687
Labels
No labels
P1: Critical
P2: High
P3: Medium
P4: Low
UI
bug
cannot reproduce
compatibility
dependencies
docker
documentation
duplicate
enhancement
enhancement
external libs
feature request
good first issue
help wanted
infrastructure
invalid
localization
needs investigation
performance
potential-duplicate
question
recurrent
research
snap
waiting for data
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AdGuardHome#2687
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kpoman on GitHub (Apr 27, 2021).
Issue Details
v0.106.0-b.1
Built from source
IoT complementing a home router
Raspberry Pi 3 Model B
ARMv7
Raspbian latest
Expected Behavior
Using query log filters, get the result in couple of seconds while changing them
Actual Behavior
Some filters respond almost instantly showing filtered results, some not (take minutes to respond, takes full CPU usage, making me think of lack of indexation on specific query filters, specifically:
All these bring CPU usage to 100% (even worse, if trying these sequentially, I got >400% cpu usage). There is no timeout, so the box becomes unusable. BTW, box has couple hundred thousands logs. This responded on first days of adguardhome usage, and became progressively unusable. Apparent obvious lack of indexation. Only way out of that hell is rebooting the raspberry.
@ameshkov commented on GitHub (Apr 27, 2021):
COuld you please update to v0.106.0-b.4 and check again?
@kpoman commented on GitHub (Apr 27, 2021):
Yes sure ! Is there a way to update on a running box ? I just did a git pull on the compile/running folder, can I just make it there ? (I ask this because it took quite long tom compile the first time, lol)
@ainar-g commented on GitHub (Apr 27, 2021):
@kpoman, we provide prebuilt binaries on the releases page.
@kpoman commented on GitHub (Apr 27, 2021):
Ok, I was able to recompile without problems, in place, and restart the binary. No problems so far, however, still extremely slow. So I suppose one needs to recreate the local databases ? I saw these 2 files ./data/stats.db and ./data/sessions.db, which I guess are not patched if I upgrade. Any way to patch the database ? Or should I get rid of those and have them somehow recreated ?
@ainar-g commented on GitHub (Apr 27, 2021):
I see, thank you for testing. No, there are no local databases for query logs. Currently, it's just text files with no indexing. See #2290.
My current assumption is that the logs probably have fewer logs with these statuses, and they are much more sparse than the other types, so the search has to scan much more records to find those. We won't be able to fix that until we'll be able to find an appropriate database format for the logs.
@kpoman commented on GitHub (Apr 27, 2021):
Ok thanks for the insights ! My OS is on a SD Card (running raspbian). Do you want me to use some tool to see where the lag comes from (iostat, or whatever) ?
@kpoman commented on GitHub (Apr 27, 2021):
iostat when querying buggy logs. Apparently it comes IO operations, pretty slow (~1MB/s). Am gonna check which perfs I can get from that mmcblk device.
@kpoman commented on GitHub (Apr 27, 2021):
Ok, so for the sdcard perfs, it is able to write at 15MB/s and read at 25MB/s approximately, see below:
I dont know why iostat shows only ~1MB/s but still 100% cpu, so apparently something related to the parsing of that (json???) file with complete logs, some slow parsing there.
@ainar-g commented on GitHub (Apr 28, 2021):
Thanks for investigating. As I've said, it's probably the inefficiencies of the current search implementation. I doubt that it can be solved other than in the issue I've mentioned above.
@kpoman commented on GitHub (Apr 28, 2021):
Thank you ! I am closing it now, will wait for new releases !