High Performance Server in Windows
To accomplish very high performance in the Windows server side,
1. IOCP
IOCP(Input/Output Completion Port) is good to get the signals asynchronously when the unit in/out operation completes.
2. AcceptEx
To set up socket structure when a huge number of users enter is too late to response, so prepare the enough number of sockets with AcceptEx.
3. Pre-Allocated Memory
Don't use allocator like new or malloc without any caution in server side, it hurts the performance seriously.
Allocate enough memory before you use memory.
4. Avoid Multiple Threads
This is overlapped with the IOCP issue, anyway you avoid to spawn multiple threads except the necessary ones to handle each connection.
Spawning threading itself needs to generate context and to accompany context switching.
5. TCP/IP
TCP/IP ensures the delivery and sequence of the packet. But it doesn't ensure to match the number of reading counts with the number of sending counts, so you need to input the length information in the packet and to check the length of read packet including the length information too.
1. IOCP
IOCP(Input/Output Completion Port) is good to get the signals asynchronously when the unit in/out operation completes.
2. AcceptEx
To set up socket structure when a huge number of users enter is too late to response, so prepare the enough number of sockets with AcceptEx.
3. Pre-Allocated Memory
Don't use allocator like new or malloc without any caution in server side, it hurts the performance seriously.
Allocate enough memory before you use memory.
4. Avoid Multiple Threads
This is overlapped with the IOCP issue, anyway you avoid to spawn multiple threads except the necessary ones to handle each connection.
Spawning threading itself needs to generate context and to accompany context switching.
5. TCP/IP
TCP/IP ensures the delivery and sequence of the packet. But it doesn't ensure to match the number of reading counts with the number of sending counts, so you need to input the length information in the packet and to check the length of read packet including the length information too.