Compact framework using web services is too slow!
I have an application in a PDA with CF3.5. I also wrote a webservice (WCF) in .NET3.5.
there are two operations:
1) PDA asks the WS for data. WS returns an sdf (sql server CE file) around 500KB. The communication is fine. Around 5-10 secs.
2) PDA goes around collec开发者_如何学Gotion data, and sometime returns to a station and connects to the WiFi. PDA checks if connection with WS exists by running a simple true-false function from the WS to check if there is a communication failure. If not, PDA sends its filled sdf file (700KB) to the WS. The time from invoking the WS function from the PDA, until the function is ran in the WS (which means data has been send to the function as a byte[]) takes about 30-40 seconds!
Why is it such a big differences in sending/receiving? What should I check for misconfiguration?
thanks
It's only a guess, but it's probably the acts of serializing the file into a base64 encoded string that's taking the time. How long is it taking for the call to see if the service is available? If that's not the same 30-40 seconds then you know it's not the actual call to the service that's taking time, but something else and serialization sure seems like it would be the big part here.
How long does it take to manually serialize the file (maybe the wizard-generated code is poor performing here)? I'd probably check that and see how long it takes. I'd also verify (with Fiddler or similar) exactly what is going across the wire and when.
That sounds like a serialization / base64 to me as well. You may want to use System.Diagnostics.Stopwatch to see what portions of the code are taking so long to execute. Since WCF generates the source for the proxies in CF you can instrument those as well. If your bottleneck is indeed serialization you may want to use something different, like protocol buffers (protobuf-net implementation is soo much faster than WCF, it solved a performance problem I had there some time ago). You can also try eqatec profiler, which sadly is not free anymore for CF, but would identify the bottleneck immediately.
OK. It was solved by performing a gzip compression on the byte[] before sending and after sending the file.
thank you all for your answers.
精彩评论