Executing web service methods is slow - web-services

I know that first call to web service can take much more time, but next calls takes min. 250ms every time. It is doesn't matter if web service return simple object (string, boolean) or more complex array. (Web service processing time is about 1-5ms for simple object)
Is it normal that calling Webservice take at least 250 ms on Windows Mobile (Motorola MC3190 device)? Is there any way to speed it up?

Related

Web service request times out after app pool recycles

I have a classic web service that is hosted on IIS 7.5 (Windows Server 2008 R2).
After application pool recycles (default 20 minutes idle state), the first request to the web service takes about 5 minutes. When it gets through, every other request to the service takes no time at all.
I read about turning on AlwaysRunning in the IIS 7.5 that is in applicationHost.config. However, I would appreciate if anybody can provide explanation why would it happen and where to search for the cause of the problem.
Thank you in advance.
I avoid a cold start by having a heartbeat execute prior to the app pool recycle interval. However, you still need to let the app pools recycle at some pre-determined interval. See this post on cold starts. Generally, the more dependencies your app consumes and the larger your code base is then the longer it will take to "wake up" on a cold start. The delay is not really noticeable for smaller apps.

Should I use MSMQ or IIS

I have a web site that exposes a web service to all my desktop clients.
Randomly, these clients will invoke the web service which in turn will add a message jpeg in byte array format to the MSMQ.
I have a service application that reads from this queue and performs an enhancement on this jpeg and saves it to the hard drive.
The number of clients uploading at anyone time is unpredictable.
I choose this method because I do not want to put any strain on IIS. The enhancements my service application performs is not much 'erg' but it exists nevertheless.
However, after realizing that my service application had stopped for sometime and required restarting I noticed the RAM leap up to clear the backlog. Whilst I have corrected this and the service is now coded to restart automatically on fail I surmised that a backlog could exists at busy times which again give a higher RAM usage.
Now, should I accept to do the processing all within my web service and then save to the hard drive or am I correct in using a MSMQ?
I am using C# and asp.net

How should I run a webpage every ten minutes?

I am writing an ASP.NET web page which calls an API to update my client's property website using XML data. The data from the API is real-time, so I would like to run the page every 10 minutes.
Clearly I don't want to load my page manually to keep my client's property website up-to-date. There is a lot of help in Stack Overflow and elsewhere on this type of question but I have become a little overwhelmed by the options. I think that one way to go would be:
Windows Task Scheduler to fire every ten minutes (to trigger a VB.Net Service)
VB.Net Service (to run the web page)
My page runs..
That feels like overkill, and I haven't written a Windows Service or used the Task Scheduler and it feels like there should be 2 steps not three.
Now if I do use a VB.Net Service then I think that it might be better to give more work to the VB.Net Service rather than put my script in a web page, but I am used to writing web pages!
I can't help feeling that if I just keep the page open in a browser somewhere I can easily use JavaScript to run the page every 10 minutes, but that means ensuring it's open in a browser. Bad solution I think...
What I need is an overview of my options to make an informed decision and if it means learning then fine. Thanks in advance!
You can use javascript/Jquery to call a page/webmethod continously in timely manner
setInterval(function() {
// call your page or webmethod
}, 1000 * 60 * x); // x is your time interval in mins, in your case x=10
In my opinion the best approach would be to create a windows service and have the service call the web page. The windows service is much more stable than the Task Scheduler because the task scheduler can overlap if the previous Scheduled event did not finish. Also using the windows service gives you more control over error handling and logging
Get started with this link:
http://code.msdn.microsoft.com/windowsdesktop/CSWindowsService-9f2f568e

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?
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.
The first call is loading the .NET Runtime and JITting the web methods called. Many shops which deploy services as such don't really care about the first time, but when they do, they'll have something make a call to it as part of deployment to get that first time out of the way. Another method is to NGEN it.
Is it the first call at all to the IIS after it started, or the server started?The first ever call to IIS is always slower. We used to solve it by having a script that manufactured a dummy call upon restart or IISRESET, to absorb the first call penalty.
Also the first time when the app is called your sql-connections are opened. If there are network problems this could take longer.
After a time when the app is idle the connection could be automatically closed.

why is it said that remoting is faster than web services? Why XMLserializer is slow?

Is remoting faster than web service or vice versa.
Also on what parameters can we differentiate the performance.
web service uses XMLserializer while Remoting uses binary
is xmlserialization a slow process and if yes than why?
By "remoting" I assume you mean RPC/RMI calls.
Yes, comparing one RPC/RMI call to one web service call, then the RPC/RMI one typically comes out favorable in speed (binary is more compact, faster to encode and decode). But the largest time is typically spent on network latency, waiting for the messages to come across.
So in a realistic large complex system, the best choice is the one that minimizes the number of network requests. This has much to do with how language binding and remote service api looks.
The majority of RPC/RMI APIs I have seen promotes lots of remote calls, i.e. first you get the remote object, then you call a few setters leading to remote calls, then you ask the remote object to do something.
Web services are typically based on creating a large "document object" locally, and sending it over in one go. Requiring only one request-response.
is it faster because the size of the binary serialized object is smaller then the same object as an XML representation. And the time needed to transmit it across the wire is shorter
by definition a web service is a stateless process, every time you request data the web service doesn't know what happened last. When you are doing remoting you are using the objects as they would have been locally so there is less overhead.