Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am involved into development a rich UI project: desktop windows application. Application uses asynchronous invocations and in its turn it should be ready to process external messages (events). The problem is clear: at first time it was built as a simple prototype and it was not stress tested and all was fine. Then application was grown: the number of calls to server and number of events from server are high and performance is low. What is more users noticed that sometimes performance is extremal low. Asynchronous invocations based on thread pool (BeginInvoke, EndInvoke), external events are going from WCF service (.NET 3.5). My goal is synchronization of all tasks and putting priorities to every executions in desktop application. My question is: is there any practice how to reach my goal: patterns, task priority list, others? What should I do at first, second and next times?


share|improve this question
It is almost impossible to understand your architecture from the description you have given. The only thing I can say with this limited information would be to use some kind of front end Load balancer, with your application distributed across multiple servers. – Darknight Jan 12 '11 at 10:26
@Darknight thanks for comment, i meant desktop application issues, server-side is ok – Zzz Jan 12 '11 at 10:44
up vote 2 down vote accepted


As always with performance find the real problems, measure them, fix them and compare with your first results. Just making changes that look good on paper and seeing what happens isn't enough, this will eat up your time

Use a tool like Ants profiler for that

Your problem

If the general steps didn't help you.

In general I would say that any form of prioritizing, ordering or synchronization of your own will give you performance costs so if you don't need them from a functional perspective leave them out. Giving your UI threads a higher priority might give you a better perceived response time but it also might not, what do you do when a long running low priority thread is all ready running ?

If you still want you priorities it becomes more of a code issue (what mechanisms are you using, do you have your own scheduler etc.) and you should post your code and move the question to stackoverflow.

Can't you completely separate the UI threads from the message receiving threads ? Putting the message receiving into a separate windows service ?

General Guidance

Probably to general but it might give you some new perspective on how to solve your problem:

share|improve this answer
+1 great thoughts: to separate the UI threads from the message receiving threads, so do I. At least I will measure this load. Thank you. – Zzz Jan 12 '11 at 12:26

Microsoft WCF RIA has solution for this problem. Since async calls are common in RIA applications.

Microsoft WCF RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.

share|improve this answer
thanks, but question is related to scope of desktop application – Zzz Jan 12 '11 at 12:32
@igor Yes, but the solution may help! Check out samples. – Amir Rezaei Jan 12 '11 at 12:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.