[Twisted-Python] Twisted tips for designing highly concurrent twisted REST API

Tom Most twm at freecog.net
Fri Jul 12 23:57:08 MDT 2019


On Thu, Jul 11, 2019, at 1:46 AM, Scott, Barry wrote:
> On Tuesday, 9 July 2019 22:04:11 BST Tom Most wrote:
> 
> ...snip...
> 
> > The reactor's own thread pool is really for DNS resolution.
> 
> Is that still true in the default case? We are use the twisted code that talks 
> to DNS servers as the threaded resolver adds too much latency.

As far as I know, yes. The higher-level APIs use getaddrinfo() at least.

https://twistedmatrix.com/documents/current/api/twisted.internet._resolver.GAIResolver.html
https://github.com/twisted/twisted/blob/c0776850e756adfcdc179a7fd9e4c8f5cbc4838d/src/twisted/internet/base.py#L1007

TCP6ClientEndpoint also invoke getaddrinfo() directly.

twisted.names is certainly more performance but it's missing some system integration features that make it unsuitable as a default:

* No support for the domain or search resolv.conf directives
* No NSS lookups (e.g., systemd integration)

This is all on Linux, YMMV on other platforms.

---Tom




More information about the Twisted-Python mailing list