IOCP Server
Windows I/O Completion Ports acceptor for high concurrency. Switch the sgcWebSockets server to the IOCP IOHandler and serve thousands of connections from a small, fixed thread pool instead of one thread per connection.
Windows I/O Completion Ports acceptor for high concurrency. Switch the sgcWebSockets server to the IOCP IOHandler and serve thousands of connections from a small, fixed thread pool instead of one thread per connection.
A Windows-only I/O Completion Ports mode for the standard sgcWebSockets servers. Enable it through IOHandlerOptions to scale far beyond the default Indy thread-per-connection model.
TsgcWebSocketServer / TsgcWebSocketHTTPServer — enabled via IOHandlerOptions.
Windows I/O Completion Ports (Windows only).
Windows
Enterprise
Go to the IOHandlerOptions property and select iohIOCP as the IOHandler Type. Leave the thread counts at zero to auto-size from the CPU count.
Server.IOHandlerOptions.IOHandlerType := iohIOCP;
Server.IOHandlerOptions.IOCP.IOCPThreads := 0;
Server.IOHandlerOptions.IOCP.WorkOpThreads := 0;
Server->IOHandlerOptions->IOHandlerType = iohIOCP;
Server->IOHandlerOptions->IOCP->IOCPThreads = 0;
Server->IOHandlerOptions->IOCP->WorkOpThreads = 0;
Server.IOHandlerOptions.IOHandlerType = iohIOCP;
Server.IOHandlerOptions.IOCP.IOCPThreads = 0;
Server.IOHandlerOptions.IOCP.WorkOpThreads = 0;
How the IOCP IOHandler behaves and how to tune it.
Handle thousands of connections from a limited pool of threads instead of one thread per connection, the way Indy works by default.
Threads used for IOCP asynchronous (overlapped) requests. 0 auto-sizes from the processor count. On Delphi 7 and 2007 the default is 32, because cpucount is not available.
Pin a connection to the same thread when you need it. Requests are normally spread across the pool, so each request for a connection may run on a different thread. Set a value greater than zero only if you require this. It is a performance trade-off.
Recommended when you need to handle thousands of connections. If your server tops out around 100 concurrent connections, the default Indy thread model is fine.
IOCP detects a dead socket only on write. Enable CleanDisconnect on TsgcWebSocketClient or a server-side heartbeat so the server learns of the drop and OnDisconnect fires.
Authoritative sources for the mechanism this mode is built on.
Deep-link to the feature reference, grab the ready-to-run demo project, and download the trial.
| Online Help — IOCP Feature reference for enabling Windows I/O Completion Ports on the sgcWebSockets server. | Open | |
| Demo Project — Demos\Server Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |