ragibkl / adblock-dns-server

Adblock DNS Server powered by Bancuh DNS and dnsdist-acme
https://bancuh.com/
MIT License
63 stars 14 forks source link

use ablc command #167

Closed ragibkl closed 1 year ago

ragibkl commented 1 year ago

I decided to refactor the adblock_dns/compiler rust codes, into a separate project:

It comes with the following difference:

Everything else is the same.

This PR is to integrate the new ablc compile command into our current adblock_dns server. I also had to make some small changes to the bind part, because some configs are no longer used in newer bind servers.

I'm going to run this on sg-dns1.bancuh.com for a few days.

Expected outcome:

Failed condition:

ragibkl commented 1 year ago

sg-dns1 is up. For now, looks like the size of the blacklist.zone file is almost identical with sg-dns2.

# sg-dns1
$ ls -lh /etc/bind/blacklist.zone 
-rw-r--r--    1 root     root       93.8M Dec 18 14:33 /etc/bind/blacklist.zone

$ wc /etc/bind/blacklist.zone 
  2004753   6014263  98379672 /etc/bind/blacklist.zone

# sg-dns2
$ ls -lh /etc/bind/blacklist.zone 
-rw-r--r--    1 root     root       93.8M Dec 18 13:44 /etc/bind/blacklist.zone

$ wc /etc/bind/blacklist.zone 
  2004431   6013300  98365552 /etc/bind/blacklist.zone
ragibkl commented 1 year ago

sg-dns1 seems to use much less memory: 1.265 GiB vs 2.659 GiB. I might even be able to reduce the server RAM from 4GiB down to just 2GiB!!!

# sg-dns1
$ docker stats
CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
476d24237b0b        0.30%               1.265GiB / 3.859GiB   32.77%              1.69GB / 162MB      4.1kB / 1.84GB      8
9062c6e9bf94        0.68%               39.31MiB / 3.859GiB   0.99%               0B / 0B             6.37MB / 53.3MB     47
0fbf3260b172        0.00%               30.94MiB / 3.859GiB   0.78%               0B / 0B             124MB / 0B          11
1a2fdad08a0f        0.00%               3.535MiB / 3.859GiB   0.09%               258kB / 0B          37.9MB / 0B         9

# sg-dns2
$ docker stats
CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
2b2a32a2f5fb        0.03%               2.659GiB / 3.859GiB   68.91%              146GB / 3.88GB      9.89GB / 86.8GB     10
2f7cfbb84725        0.37%               35.82MiB / 3.859GiB   0.91%               0B / 0B             30.8GB / 34.7MB     47
3eeb974e9b78        0.00%               24.39MiB / 3.859GiB   0.62%               0B / 0B             9.97GB / 0B         11
6ffae0cc613f        0.00%               3.543MiB / 3.859GiB   0.09%               1.67kB / 0B         3.07GB / 0B         10

EDIT: This is a red-herring. Bind seems to accumulate memory over time. I need to time memory use only for the compiler codes.

ragibkl commented 1 year ago

I tested memory usage when running this locally:

I think will just use ablc moving forward.