MFC GUI on Windows Server 2003 runs slow like hell
-
Excuse me if I post in the wrong place but I'm having a very wierd problem. I have an application written with MFC. Basically, it has around 10 worker threads doing smth continuously and post message to CMainFrame when done. The MainFrame will process these messages and update some list control on GUI. Simple, isnt' it? Originally, I test and deploy my application on a Windows XP SP2 machine with CPU Celeron 2,4GHz. It runs well although it consumes 40-50% CPU all the time. Now, I have a server with CPU Xeon 3GHz, 1GB RAM, SCSI hard disk with RAID 1 (seems to be an overkill hah). On this server, my application only consumes 5% CPU but it runs LIKE HELL. It takes ages for me to access menu items and do other things on the GUI. In other word, the GUI seems to be frozen regularly. I don't know what's going on !!! I guess that because windows server 2003 has some mechanism to schedule and distribute CPU between applications. I have tried to config Processor scheduling & memory usage to best performance for program, it helps improves a bit, but still far from what's shown on the old Celeron computer !!! Setting process priority into "real time" in task manager also doesn't help. I'm clueless now, any one please help me :((
-
Excuse me if I post in the wrong place but I'm having a very wierd problem. I have an application written with MFC. Basically, it has around 10 worker threads doing smth continuously and post message to CMainFrame when done. The MainFrame will process these messages and update some list control on GUI. Simple, isnt' it? Originally, I test and deploy my application on a Windows XP SP2 machine with CPU Celeron 2,4GHz. It runs well although it consumes 40-50% CPU all the time. Now, I have a server with CPU Xeon 3GHz, 1GB RAM, SCSI hard disk with RAID 1 (seems to be an overkill hah). On this server, my application only consumes 5% CPU but it runs LIKE HELL. It takes ages for me to access menu items and do other things on the GUI. In other word, the GUI seems to be frozen regularly. I don't know what's going on !!! I guess that because windows server 2003 has some mechanism to schedule and distribute CPU between applications. I have tried to config Processor scheduling & memory usage to best performance for program, it helps improves a bit, but still far from what's shown on the old Celeron computer !!! Setting process priority into "real time" in task manager also doesn't help. I'm clueless now, any one please help me :((
You really need to look at your implementation. I don't know what your threads are doing but you need to make sure the UI thread gets some time to do stuff. If you're posting too many messages to the UI thread from the worker threads then the UI thread can't handle user input/output tasks as effectively. Changing hardware platforms really can expose these problems :) Instead of using the UI message queue, you may want to look into queing messages yourself (in a FIFO list, for example) and handling them during idle times on the UI thread. Mark
"Go that way, really fast. If something gets in your way, turn."
-
You really need to look at your implementation. I don't know what your threads are doing but you need to make sure the UI thread gets some time to do stuff. If you're posting too many messages to the UI thread from the worker threads then the UI thread can't handle user input/output tasks as effectively. Changing hardware platforms really can expose these problems :) Instead of using the UI message queue, you may want to look into queing messages yourself (in a FIFO list, for example) and handling them during idle times on the UI thread. Mark
"Go that way, really fast. If something gets in your way, turn."
thanks, I have checked by installing windows server 2003 on my old Celeron computer and found that the problem was not because of the OS (windows 2003 or XP) but because of changing hardware platform. I shall checked my implementation as your suggestion, thanks for that. But I wonder if there is a way to optimize code compiling for an Intel Xeon server (32 bit). There is an option "Target machine" in project properties but that seems to be not working since changing it cause my project not compilable.
-
thanks, I have checked by installing windows server 2003 on my old Celeron computer and found that the problem was not because of the OS (windows 2003 or XP) but because of changing hardware platform. I shall checked my implementation as your suggestion, thanks for that. But I wonder if there is a way to optimize code compiling for an Intel Xeon server (32 bit). There is an option "Target machine" in project properties but that seems to be not working since changing it cause my project not compilable.
Optimizing for specific hardware is way out of my league. From what I've read, it's best to let the OS handle it unless one really know's what (s)he's doing. Most often, multithread problems are in the implementation. Mark
"Go that way, really fast. If something gets in your way, turn."