Forum > Linux

DNS "Query" in netdb uses fpSelect

<< < (2/3) > >>

:) Yes its hard to believe that, i didn't believe it either at first but actually its true. If you opened e.g.1200 sockets and issue "polls" you work normally, but just another single "select" on a single socket will crush your program.

P.S I found the problem with DNS resolving when tried to understand why the program crashes from a single HTTP request

I'm not denying your problem, I'm just shedding some doubt on your analysis of it that it is fpselect in the DNS resolver. Unless you have 1200 uncached resolves resulting from your 1200 sockets, like a SMTP bot that has to find SMTP servers for 1200 email addresses.

It is not fpselect, it is the number of connections that a select can handle per thread as was already mentioned. That is an OS setting/limitation, not a limitation of FreePascal. fpselect is just an alias for select, It is a direct alias, which is an OS call on UNIX/POSIX: use threads and make sure you cache even with threads.

A OS server version install may give you more head-room, but you still need to use threads and caches.
(and distribution of available cores)

I believe the lmit is 1024 connections, at least in the past, but also subject to connection load.
You can't expect a single core CPU to deliver the same number of connections as a rack full of 32 core CPU's with each 64 GB of memory per core.

Right now it's exactly the DNS resolver, I spent some time with debugger trying to locate it. Indy uses ResolveName in IdStackUnix. Of course using a resolved IP address directly instead of the Name hides the issue.

No, posts crosses. There is a finite amount of connections per core. Maybe that can be configured, though, but I would not bet on it. It is not the DNS resolver PerSe', because that normally is the front of a server stack and has virtually no load per connection, because it distributes. All about infrastructure. E.g. use the google DNS resolvers that work like that: and Local DNS resolvers can usually not handle big loads, unless the infrastructure is there, like in a proper bank.. :D


[0] Message Index

[#] Next page

[*] Previous page

Go to full version