Indy IOCP Server

Indy servers use one thread for every connection, this means that if your server must handle 1000 concurrent connections, it will create 1000 threads. But if instead of 1000 connections there are 10.000 connections, it creates 10.000 threads and so on... of course, this requires exponential hardware resources and it's not usable for high load servers.

Windows provides an API, called IOCP, which allows to handle with a small pool of threads thousands of connections. 

From sgcWebSockets 4.3.3 IOCP is supported by Indy Servers:

    • TsgcWebSocketServer
    • TsgcWebSocketHTTPServer

Configuration

 IOCP To enable IOCP for Indy Servers, Go to IOHandlerOptions property and select iohIOCP as IOHandler Type.

Server.IOHandlerOptions.IOHandlerType := iohIOCP;
Server.IOHandlerOptions.IOCP.IOCPThreads := 8;
Server.IOHandlerOptions.IOCP.WorkOpThreads := 32;

 

IOCPThreads are the threads used for IOCP asynchronous requests (overlapped operations) and WorkOpThreads are threads used to process these asynchronous requests (read and write bytes). Maximum value of WorkOpThreads is 64, but you must adjust this value accordingly to your number of physical processors * 2, so if you have a cpu with 16 processors, set a WorkOpThreads value of 32. Enabling IOCP for windows servers is recommended when you need handle thousands of connections, if your server is only handling 100 concurrent connections at maximum you can stay with default Indy Thread model. 

×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

sgcWebSockets 4.3.3
Could not load SSL library

Related Posts