Socket Delphi Component

We have a C / S application, everything written in Delphi (client and server or middleware if you want) For the client, we use Indy. For the server we use DXSock.

Since DXSock is dead for a while, we are exploring alternatives for a single part.

I want to hear some comments about the best alternative Server Socket component for Delphi. The current system, as a rule, has dozens of persistent connections, each working in its own thread, but there may be hundreads in the future (this should be improved to a thread pool, if possible)

+4
source share
2 answers

If you want maximum performance, you will have to use sockets in non-blocking mode or using completion ports . IPWorks is implemented in the same way as iocp . As far as I can tell, Indy or Synapse do not implement them (at least officially).

We used completion ports and thread pool in our open SynCrtSock , used in our SQLite3 structure syntax .

Here are some guidelines for this solution, working from Delphi 6 to Delphi XE. I'm not saying that this is the “best component”, but it works and is fast-acting (each request is about 4 KB of JSON data):

  • The HTTP client is saved (i.e., the HTTP / 1.1 client connection is saved during the request process): first, at 7.87 ms, executed at 153.37 ms, i.e. 6520 / s, average 153%
  • Http client multimedia connection (that is, one new HTTP / 1.0 client connection created for each request - this uses completion ports and thread pool): first at 151us, executed in 305.98 ms, i.e. 3268 / s, average 305us

For speed comparison, here are other communication protocols in our system:

  • Access to named pipes: first at 78.67 ms, executed at 187.15 ms, i.e. 5343 / s, on average 187%
  • Local window messages: the first in 148us, executed in 112.90 ms, i.e. 8857 / s, average 112us
  • Direct access to the process: first in 44us, executed in 41.69 ms, i.e. 23981 / s, average 41us

We use HTTP / 1.1 over TCP / IP, because simple TCP / IP has very little overhead, and it is a well-crafted protocol for firewalls, etc., and allows us to use our infrastructure with the AJAX application, while The main goal is to serve Delphi customers.

IMHO there is no “best alternative Server Socket component for Delphi”, it depends on the purpose of your server application. The main bottleneck will be in the core of Windows itself. Perhaps direct access to the kernel-mode HTTP driver (Http.sys) may help.

Consider using a dedicated optimized server instead of a Delphi server, such as lighttpd or Cherokee using FastCGI to process requests through the Free Pascal (or CrossKylix) application for Linux. I think it will be the best performance.

+3
source

I use Indy components for commercial work on the server side, and the set of components is quite durable (9 or 10). My servers have millions of connections per day without any problems.

I used DXSock many moons ago. He always optimized, but never seemed to finish. It seems to have a different version.

If you need commercial support, I would recommend IPWorks from nSoftware.

+2
source

Source: https://habr.com/ru/post/1332278/


All Articles