Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

First call to web service is slow; consumed by compact framework win app

i have a .net 2.0 web service running on IIS 7.0.

i consume this service from a compact framework written application (CF 2.0). The first call takes 13 seconds, all subsequent calls are super fast (under 1 sec). No data is cached.

Any ideas how to solve this?

like image 621
sarsnake Avatar asked Feb 28 '23 08:02

sarsnake


1 Answers

The first call under a CF application is when all of the proxy objects on the device are created. So even if the objects, etc on the server are already spun up, the first call from each device is going to be substantially slower than any subsequent call.

A common workaround for this is to have your service expose some stub method (it can do absolutely nothing if you want) and when your application starts up, spawn a worker thread that calls this stub. This will create the service proxy objects in the background for you so when your app actually makes a call out to the service, everything is ready.

like image 146
ctacke Avatar answered Mar 05 '23 15:03

ctacke