As you all know Mojolicious uses non-blocking IO for network operations. This allows
Mojo::Server::* to process many requests simultaneously, make many http requests with
Mojo::UserAgent in parallel and other cool things.
But there is one hickey which may block whole non-blocking app with Mojolicious. It is known as host name resolution. For now Mojolicious uses blocking host name resolution provided by
IO::Socket::* backend. This is
IO::Socket::IP. This is not the problem if you write web application which will just handle requests and will not produce any requests to internet itself. But if your application actively uses
Mojo::IOLoop::Client, for example, and your DNS server is not so fast, whole application may suffer and even misbehave. You may think that this is not the problem because your DNS server is fast enough: it resolves
google.com to ip in 0.001 sec. But in fact your DNS server may return result for one domain in 0.001 sec and in 30 sec for other. No any warranty here. And all 30 sec your application will be blocked.
But why till now no one has written non-blocking DNS resolver for Mojolicious? In fact Mojolicious had non-blocking resolver since v0.999931 till v2.27. But as sri said this resolver sucked. This is why it was removed. And the only available alternative, as sri said, is to use
getaddrinfo(3) from separate thread. This is how i started Net::DNS::Native few weeks ago.