You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default the nworkers attribute of Udp_server_opts is initialized with the value 30, from variable _DEFAULT_NWORKERS. It comes that during the Udp_server initialization, it spawns 30 senders and 30 receivers, each of them represented by a respective Thread (started in the constructor).
The only reason I could find for spawning these threads is due the synchronous name resolution performed by 'socket.getaddrinfo'.
A more modern approach is to delegate the name resolution to an appropriate asynchronous resolver, such as the one available on tornado, or on pycares. Of course, adequate profiling is desirable to demonstrate any optimization gain, but this latter approach would use less memory and would cause less overhead when processing bursts of incoming messages. Anyway, it will make the code far simpler and easier to maintain.
The text was updated successfully, but these errors were encountered:
By default the nworkers attribute of Udp_server_opts is initialized with the value 30, from variable _DEFAULT_NWORKERS. It comes that during the Udp_server initialization, it spawns 30 senders and 30 receivers, each of them represented by a respective Thread (started in the constructor).
The only reason I could find for spawning these threads is due the synchronous name resolution performed by 'socket.getaddrinfo'.
A more modern approach is to delegate the name resolution to an appropriate asynchronous resolver, such as the one available on tornado, or on pycares. Of course, adequate profiling is desirable to demonstrate any optimization gain, but this latter approach would use less memory and would cause less overhead when processing bursts of incoming messages. Anyway, it will make the code far simpler and easier to maintain.
The text was updated successfully, but these errors were encountered: