views:

69

answers:

1

I have made a test project that makes HTTP POST requests in silverlight (using the HttpWebRequest and WebClient classes). I consistently get a performance of approximately 20 calls/s, which I think is very slow. The only data I send and receive are small strings (some 20 characters). What surprised me was that WCF (SOAP over HTTP) showed a similar performance. However, when I did the same test, but made sure all program logic ran in the main thread, performance went up considerably, up to some 150 calls/s.

Can anyone explain what could cause this effect? I mean, multithreading cannot cause such a slowness by itself.

Note: all my tests are using a localhost connection.

Update: after extensive research, I conclude that the performance problem is inherent to Silverlight v3.

+1  A: 

When you do your WCF calls without starting up a separate thread, they are executed on the UI thread, and they are not executed immediately, they are instead executed when the UI thread has enough time to do it.

Check this blog post, it may be just what you are after. Contrary to what you found, he finds that WCF calls on a background thread are faster - obviously because the thread is not required to do any other work.

slugster
This is indeed the *exact* opposite of the results of my own measurements. Anyway, thanks for the response!
Dimitri C.