Bad HTTP request performance on Windows Phone 7 device
I'm porting a game from Silverlight to Windows Phone 7 and using polling HTTP requests as my connection to the server. It seems the performance of HTTP requests (either WebClient or HttpWebRequest) on device is extremely bad. Emulator performs ok.开发者_开发问答
I've made a super-simple test program that continuously makes HTTP GET of a simple text/plain content.
Running the program on WP7 emulator gives me dozens of requests per second but on device (HTC HD7) only about 1/sec which is not good enough. I've tried with GPRS and WLAN connection with similar results. Also both WebClient and HttpWebRequest approaches give the same result.
To compare, an Android phone in the same networks performs much, much better.
Are there some known limitations in WP7 Silverlight network performance? Do they differ from device to device? Are there any workarounds?
This is a huge showstopper for my application.
EDIT: When the phone is connected to the PC, requests take ~40ms. When using GPRS/WLAN, requests take 500+ms. As mentioned, Android is super-fast without cable, probably around 50ms.
The problem lies in your network. Depending on the amounts of data and network speed (in your case - GPRS and WLAN), the performance indeed can vary drastically. When the phone is connected through the USB, you are using the local Ethernet connection and that's why the performance is good.
To solve the problem, you need to:
a) make sure that the network is good. Don't try it on your app only. See how other sites load, how other Internet-dependent applications perform.
b) re-model the way you are initiating HTTP requests. Try to reduce the frequency and (if possible) - amounts of transmitted data.
精彩评论