CPU use when Threads = 1 - WeOnlyDo Discussion board

CPU use when Threads = 1 (wodWebServer / wodWebServer.NET)

by mattw55, Saturday, October 29, 2016, 21:20 (989 days ago)


I'm using the DLL version of the WOD WebServer control as a COM control. It's working well, but my environment (VFP 9) seems to only support threading with the Threads value set to 1, where each client is on its own thread, but still coordinated by the main thread. It was fine, but I am noticing that the more clients that connect, the higher my CPU use is. Some of this is to be expected, but I need to find out a way to minimize this effect. Right now I have about 30 clients attached and my CPU use, on a 3 core 2.2 Ghz machine, is around 6-8%. I'm afraid that want scale as well as I will need it to.

In this application, my clients are connecting in a long polling scenario, where the server keeps the connection open for 45 minutes waiting to see if there are any external events that would require responding to the client. If there are events, it responds, disconnects the client, and the client immediately reconnects. It there aren't any events within 45 minutes, the server disconnects the client and the client immediately reconnects.

I think each thread must have a timed process that checks to see if it needs to respond. If I'm correct in that assumption, I would like to know if there is any way that I could increase the interval of that internal timer and thereby reduce the CPU impact of each thread.

Thanks for your advice,

Complete thread: