I have written a Windows Network Service using C# which is designed to run on a Windows 7 machine. It is designed to be able to handle multiple requests in a single millisecond, which it seems to cope with in the most part, with no delay.
Occasionally, after every few thousand milliseconds, the server may experience a long delay of up to 40ms when, during which time the client has sent as many packets but not received a single response. Suddenly the server will wake up and respond to all requests within a couple of milliseconds (processing time for each request is in the region of 0.1ms).
How can I change my code or Windows Service settings to make the server more responsive? It would be better to minimise spikes of long delays (10ms is bearable, <5 is more reasonable, <1ms is the goal), but the regularity of delays is also a concern.
Thanks.
EDIT: The server machine I'm testing everything on is a laptop with a Core 2 Duo processor and SSD storage