Has Chrome a timeout itself for web service calls? - web-services

Before calling a web service from my web app, I set a specific timeout after which if I didnt get any response, the call ends up.
What if I set this timeout to, for instance, 10', is there another timeout after which Chrome does not want to wait for this response?
Thanks

A webservice call is a regular HTTP call, so it's affected by browser settings regarding http.
I suggest you to look these answers :
General purpose answer :
Where can I find the default timeout settings for all browsers?
Chrome focused answer :
https://superuser.com/questions/633648/how-can-i-change-the-default-website-connection-timeout-in-chrome
Unfortunately, AFAIK there is no setting available in Chrome to set the timeout.
Since last answer of the topic, I don't think Google has improved this but you could at least try the registry approach described there :
Create KeepAliveTimeout and ServerInfoTimeout keys in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings with desired value in ms and check if it helps.
Additionally, very long http calls are not a very good design. If it's an option, it could be interesting to rework the server process and communication method to have some kind of "keep alive ping" on it, for example to display the progress in client browser instead of freezing it for 10 minutes.

Related

Creating a Socket Server using Coldfusion

I want to notify my iPhone app of updates using a socket server for real time updates and to prevent the need for polling. My server side language is Coldfusion, and after weeks of searching the web following threads of people attempting to do this the conclusion everyone has come up with is that Coldfusion doesn't support this. Firstly if anyone has any suggestions that no one else has provided as to what is the proper way to do this with Coldfusion then feel free to cut me short and please enlighten me. Anyhow, a solution occurred to me (in my sleep!) and before I invest my time doing this I wanted to ask if it is critically flawed for any reason.
There isn't anything in the adminstrator that supports this, and people rightly point out that you can't instantiate a server socket on the page since it will hang the page waiting for requests, and that then the server will then be destroyed when the page times out.
But what is wrong with the following solution, I create my AppServer.cfc component, which essentially wraps a java ServerSocket. Then to trigger it run this:
<CFSET APPLICATION.servercfm=new AppServer()>
<CFTHREAD timeout="2147483647">
<CFSET APPLICATION.servercfm.start()>
</CFTHREAD>
The server then remains indefinately on the APPLICATION scope, and the page returns instantly. The thread timeout is sets to 60 years, although I'm sure that I'll have more frequent server restarts!
I hope this question isn't flagged as opinionated, my question is: is there ANY means, by which we can provide a service through a socket using Coldfusion whether it be my solution or any suggested by the forum.
Thanks

Architecture Design for API of Cloud Service

Background:
I've a local application that process the user input for 3 second (approximately) and then return an answer (output) to the user.
(I don't want to go into details about my application in purpose of not complicate the question and keep it a pure architectural question)
My Goal:
I want to make my application a service in the cloud and expose API
(for the upcoming website and for clients that will connect the service without install the software locally)
Possible Solutions:
Deploy WCF on the cloud and use my application there, so clients can invoke the service and use my application on the cloud. (RPC style)
Use a Web-API that will insert the request into queue and then a worker role will dequeue requests and post the results to a DB, so the client will send one request for creating a request in the queue, and another request for getting the result (which the Web-API will get from the DB).
The Problems:
If I go with the WCF solution (#1) I cant handle great loads of requests, maybe 10-20 simultaneously.
If I go with the WebAPI-Queue-WorkerRole solution (#2) sometimes the client will need to request the results multiple times its can be a problem.
If I go with the WebAPI-Queue-WorkerRole solution (#2) the process isn't sync, the client will not get the result once the process of his request is done, he need to request the result.
Questions:
In the WebAPI-Queue-WorkerRole solution (#2), can I somehow alert the client once his request has processed and done ? so I can save the client multiple request (for the result).
Asking multiple times for the result isn't old stuff ? I remmemeber that 10 - 15 years ago its was accepted but now ? I know that VirusTotal API use this kind of design.
There is a better solution ? one that will handle great loads and will be sync or async (returning result to the client once it done) ?
Thank you.
If you're using Azure, why not simply fire up more servers and use load balancing to handle more load? In that way, as your load increases, you have more servers to handle the requests.
Microsoft recently made available the Azure Service Fabric, which gives you a lot of control over spinning up and shutting down these services.

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

IIS7/.NET web services - Error when one web service calls another

I need a little help solving an issue regarding .NET web services. I have a desktop application that consumes my main web service. One of the methods gets some report data, but in order to do that, web service (A) calls a method in web service (B). Depending what parameters I pass into "A"s method, it either works or fails. If I pass in a filter, the dataset is pretty small, when I don't pass in a filter obviously the dataset is very large. Additionally, if I run web service "A" in debug mode and point my desktop app to the local version (meanwhile B is on our production server), it works wether I filter the data or not. The error I get is a 502 Bad Gateway on production, and a 502 - Web server received an invalid response while acting as a gateway or proxy server.
We have a web farm with some ARR's, so I went into the web farm's ARR, and found "Proxy" settings and adjusted the timeout to 1200 seconds (whereas my app usually fails within 20-30 seconds) and I'm still receive this error. The HTTP version is in "Pass through" mode with the "keep alive" checkbox checked.
We have no issues using a windows service consuming a web service or anything like that, just when one web service consumes another web service.
Addition,
I'm not using any sessions in my web service methods, and I believe the webmethod I call in web service "B" does have a cacheduration value set of 5 minutes.
I'm scratching my head on this for my lack of knowledge of IIS 7, and many other things. If anyone has any ideas or can point me in the right direction I would certainly appreciate it.
I thought I'd come here and answer this question in case anyone else ran into the same issue. This issue was not server related at all. It was code related. In my code I had a datatable (c#), and was doing a datatable.select(....) where I would pass in a filter with many "OR"'s. Ex. Filter = 'x' OR 'y' OR 'z' etc etc. I had around 100 of these, which caused the datatable.select method to produce a stackoverflow exception. I changed the code to do an "IN (x,y,z)" and it works fine now. Hope this helps someone.

First call to web service each day is slow

While building this web service and the app that calls it, we have noticed that the first call to the web service each day is extremely slow. It even will time out on some days. However, every call after that work great. Can anybody shed light on why this might be and how we can get rid of this pain?
Thanks in advance!
If it's an ASP.NET web service, it may be the CLR initializing and loading and verifying the assemblies for the first time. You may want to consider pre-compilation
Agree with the other answers on caching, initialization, etc. As far as a workaround, one possibility may be to set up some sort of daily task (SQL Server job, Windows service, something else?) to simulate a hit to the service each day, so that your users don't experience this first slow request.
If it is an ASP.NET web service, then you might want to check the settings of the application pool the web service is running in, especially the idle timeout which defaults to 20 minutes in IIS7.
Configuring IIS7 idle-timeout
Even if it is not an ASP.NET web service, other web servers will have equivalent configuration settings you have to tweak to keep your web service alive overnight.
Can you duplicate the same behavior on your database? It could just be the db needing to optimise the query for the first run (Maybe the parameter is today's date?).
Are there a lot of static constructors or set up code in the Global.asax class? Because IIS recycles worker processes periodically, the start up code may be running again.
The rule for optimization is: don't guess. Put in profiling to find out exactly what is slow, and then work to make that faster. Everything already posted provides excellent tips on where to start looking for slowness.