Dramatically reducing the latency of your initial call to a Windows Communication Foundation Service


Newcomers to the Windows Communication Foundation often observe that, when they are making several calls to a Windows Communication Foundation Service, the first call always takes noticeably longer than the subsequent ones.  The question that naturally follows from that observation is, how do I warm up the service ahead of time to reduce the latency of my initial call?


Well, actually, that noticeable delay is mostly not due to anything on the server's side.  The delay is due to the client's channel stack having to be constructed in order for the first message to be sent on its way.  So, the real question is, how do I warm up my client ahead of time to reduce the latency of my initial call? 


The answer is simply to call Open() on your proxy directly after instantiating it and adding any custom behaviors.  In a simple experiment, calling Open() on my proxy before making my first call to a service reduced the difference in response time between the first call and the subsequent ones by 93.886%. 


Comments (1)

  1. Sam Gentile says:

    Nice! We’re going to try this.

Skip to main content