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

pfBlockerNG: use asynchronous I/O #1307

Closed
wants to merge 1 commit into from

Conversation

andrebrait
Copy link

  • Delegate file and DB operations to a ThreadPoolExecutor
  • Reduce the minimum latency when blacklisting from ~4ms to ~0ms

Before (repeated the call numerous times, always had around 4ms delay, domain is blacklisted)

[2.7.0-RELEASE][[email protected]]/root: dig AAAA static.prototypes.ru

; <<>> DiG 9.18.14 <<>> AAAA static.prototypes.ru
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26860
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1432
;; QUESTION SECTION:
;static.prototypes.ru.          IN      AAAA

;; ANSWER SECTION:
static.prototypes.ru.   60      IN      AAAA    ::10.10.10.1

;; Query time: 4 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Mon Oct 09 11:25:32 CEST 2023
;; MSG SIZE  rcvd: 77

After (repeated the call numerous times, always had around 1ms delay, all logging is working, domain is blacklisted):

[2.7.0-RELEASE][[email protected]]/root: dig AAAA static.prototypes.ru

; <<>> DiG 9.18.14 <<>> AAAA static.prototypes.ru
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9209
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1432
;; QUESTION SECTION:
;static.prototypes.ru.          IN      AAAA

;; ANSWER SECTION:
static.prototypes.ru.   60      IN      AAAA    ::10.10.10.1

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Mon Oct 09 11:26:53 CEST 2023
;; MSG SIZE  rcvd: 77

* Delegate file and DB operations to a ThreadPoolExecutor
* Reduce the minimum latency when blacklisting from ~4ms to ~0ms
@sarog
Copy link
Contributor

sarog commented Oct 26, 2023

@andrebrait This is nice. You need to request a review from @BBcan177 to get his attention so he can (hopefully) accept the changes. 😀

@andrebrait
Copy link
Author

I'm already in contact with them :)

In fact, this MR was superseded already. I'm leaving it open for documentation/historical purposes, pretty much.

The goal is to have a big one that will encompass all the functionality we want to have in there.

@andrebrait
Copy link
Author

Superseded by #1343

@andrebrait andrebrait closed this Feb 8, 2024
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

Successfully merging this pull request may close these issues.

2 participants