-
Notifications
You must be signed in to change notification settings - Fork 921
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
dnsdist: add multi-stream dnstap sockets #14861
Comments
The recursor opens a dnstap or protobuf logging stream per thread. Each thread logs to its associated socket. |
At the moment DNSdist creates one |
More notes on this: When we had >60kqps flowing through a single TCP session to Vector, I was seeing what I would describe as high fluctuations in bandwidth between the transmitting server and the Vector instance. Meaning: for a few milliseconds, there would be many (20? I don't recall the number) megabits of throughput, which would then drop for a few milliseconds to 5 megabits of throughput, and then jump back to 20. This was observed via packet dumps with tshark. Sorry that I don't have the exact figures here; I was hunting a different problem and that behavior was a "Huh... interesting." moment, but I did not document it. I suspect this is a behavior that is made worse by the single-socket model in use. The same packet dump looking at data coming from pdns-rec (with less than 60kqps, admittedly) was extremely smooth - there were no fluctuations in the packet throughput between Vector and the recursive resolver on the dnstap data stream. Is this the "fault" of dnsdist? Not necessarily, but the single-socket model may make things worse than they need to be. |
I am starting to work on this and my initial thought was to just add an additional option and open multiple connections inside of Not sure how to name it, but idea would be to manually build a number of loggers (or maybe provide a function that would do it based on a provided number parameter, or by number of available threads) and then just select a different one for each message. This would open up the possibility to easily providing different strategies, to achieve different goals, like passing same messages to all the different loggers or implementing the idea from this issue by selecting a different logger for each new message. Does an approach like this make sense @rgacogne @omoerbeek ? I wanted to check before I head into implementation. |
Yes, it would make a lot of sense to me to have a new |
Please also consider a strategy where we have a thread local object per thread and a very simple strategy: select the current thread local object. So far this has worked well in the recursor. |
Would using a thread local pool work for the recursor? If the abstraction is well-designed you can use a pool of one |
unless I'm mighty confused, Recursor already uses thread local loggers, each Recursor thread gets it's own. |
Yes, looking at the code, it seems that recursor has a pool of loggers for each thread (each of the configured servers has a logger for each thread). I will try to implement something similar, to have a strategy for that in this pool, but I am not sure if I will be able to. I am a bit confused by the fact that these can be created at any time, and in recursor they are created when threads get initialized. Either way, I will at least try to design it in a way that it could later be added as an additional strategy. Also, I think that logger per thread might work better as an additional option for existing |
I guess I'm confused, so let me try to clarify what I mean. Otto, my understanding is that, right now, you can configure a list of DNStap servers in the recursor via ( |
Indeed recursor used single logging object per destination per thread, whcih has worked well in what we've seen. I was under the impression that dnsdist uses a global single logging object and suggesting that moving to a per-thread logging object would already have a real impact. I might be mistaken though. Does dnsdist have per-thread logging objects or global ones? |
OK, so let's not touch the recursor then, that's fine by me.
dnsdist uses a single
|
OK, i understand better now why a single thread local logging object (per thread) is likely not enough. |
This adds a new kind of `RemoteLoggerInterface`: `RemoteLoggerPool`. It can take multiple other `RemoteLoggerInterface`s and pass data to them in round-robin order by default. This also adds additional option to `newRemoteLogger`, `newFrameStreamTcpLogger` and `newFrameStreamUnixLogger`: `connectionCount`, which can be used to generate a pool with multiple connections. Closes: PowerDNS#14861
Short description
Adding multiple streams of dnstap data emitted from dnsdist would allow better scaling for dnstap consumers.
Usecase
We're using Vector to consume dnstap streams from dnsdist. There apparently are bottlenecks with single-socket models of dnstap data transmission. This I'm sure would be exacerbated by slower latency on the LAN and larger traffic volumes - the ACK traffic will start to cause pileups with a single socket. Spreading the data load out across many dnstap sockets like pdns-rec does would make sense. There is discussion of this here: vectordotdev/vector#20744 (see comment from james-stevens)
Description
Having dnsdist open multiple simultaneous dnstap sockets to any named endpoint would be useful. The number of sockets could be configurable, or it could be based on threading, or dynamic based on number of messages - no opinion on that. How does pdns-rec do it?
The text was updated successfully, but these errors were encountered: