How to speed up cloud service running in windows azure? - azure

I have developed web api and deployed in windows azure. That web api is consumed in android application. That app is slow when fetching data from WEB API.
How to speed up app to fetch data from WEB API?
Thanks.

You first need to figure out why it's slow ?
Is the api method execution slow? Is it calling a database query and the DB is slow? Is it a bandwidth problem between the Android device and their network?
Could be a million and one things without you providing more information but here are a few things you could try.
Profile your database queries and see that they're executing and returning to the service in a timely fashion
Call your WebAPI methods from Chrome with the Dev Tools (F12) turned on. Checkout the network tab, and see how long the round trip time is for the request/response compared with the android call
Find out how many simultaneous calls are hitting your application, it could be that you just need to scale out with more web role processes.

Related

Web API & Azure Mobile App, should I keep them separated?

I'm planning a project in which I have a windows service installed in on premise machines (about one hundred of them) which should keep in sync an online azure SQL db with the on premise ones (MS access, third party). That sync happens by calling a Web API.
I then have to build a mobile app which will be used by ~3k users that will access the synced data with Azure mobile app backend.
As for now I've started building a single mobile app backend project which serves both mobile app requests, and webapi2 requests used to sync data.
Furthermore I'll need to add queue/topic section to send realtime notifications from the app to on premise services.
My concern is if is it good practice to keep both "mobile app" and webapi2 in the same project, or should I separate them.
Any suggestion will be greatly appreciated.
Many thanks in advance!
You should, separate them. Based on your description, you should use the microservices architecture, you can read more about it in the links below.
Azure specific:
https://learn.microsoft.com/en-us/azure/architecture/guide/architecture-styles/microservices
https://learn.microsoft.com/en-us/azure/architecture/microservices/
In general:
https://microservices.io/patterns/microservices.html

Web Apps Azure High Traffic

I am using Azure Web Apps to host my website. The website is loaded from a native apps for iOS and Android. During normal days non peak time , the web is operating as expected. However, from time to time , we are going to push out notification via apns or google gcm and that will drive users back to the apps. From there, content will be loaded from the website which is hosted from the Azure Web Apps.
During this peak times where there are thousands of requests coming in, there will be very high degree of fallout which results in errors.
It is shown in the picture below .
Traffic of the web apps after the push notification blasts
I have make sure that the database will not have any bottleneck during the operation. We are using SQL from Azure as well.
From the new portal, we are using service tier 'S1' for the App Services.
Previously, when the apps are developed, Web Apps and Mobile Services are separate service which are now join to become App Services.
Is there anything I could adjust from the azure backend or there is something which I missed out to handle ? Currently , we are also making the instance to be auto scaling.
As in conclusion, during high concurrent requests rushing in, the web apps seems to stop responding.
I would propose to implement the retry logic if there is no such yet and troubleshoot using the different modes.
UPD:
There is a detailed "analyzing performance" official guidance here - https://azure.microsoft.com/en-us/documentation/articles/app-service-web-troubleshoot-performance-degradation/ .
The most simple way to understand (or just mitigate) if the issue if somehow related to the underlying backend (throttling etc) is to change the mode site is working in. In your case, it can be S or even P.
Next step, if we eliminate the possibility of the throttling/etc, is to implement the diagnostics. My favourite tool is Application Insights, there is New Relic and other great tools as well. There are good guidances i saw and used:
http://www.asp.net/aspnet/overview/developing-apps-with-windows-azure/building-real-world-cloud-apps-with-windows-azure/monitoring-and-telemetry
https://github.com/mspnp/performance-optimization/blob/master/Assessing-System-Performance-Against-KPI.md#insertlink#
So, there is not silver answer about your question - highload is highload :-) Without access to the sources and website, and load tests results it is difficult to say what component of the project behaves itself bad.
If that is the helpful answer, please mark it as a helpful or as the answer. Thanks!

Azure Mobile Service Usage in unpublished Application?

Is there a component in an Azure Mobile service that consumes API calls?
I created an Azure Mobile Service for an application that is still in Development. Its supposed to be an easy way for me to keep an offline sync of my database for a Windows UAP. All I have done so far is import my SQL Database to the mobile service using Visual Studio, haven't even finished implementing the Offline Sync.
My expectation would be to see 0 usage until my app was running, however its constantly showing 50-80 API calls an hour. My only thought is that there is something in Azure consuming API calls and I would like to turn it off.
Is your Mobile Service in the Basic or Standard tier? If so, you can get pings from some automated runners that are checking to make sure your site is working properly. You won't get charged for these API calls, even though they are showing up in the dashboard.

Can I use server side code in Windows Azure Mobile Services

I have noticed when accessing windows mobile service I can schedule tasks to perform at certain times. I also noticed that the script to perform these tasks is only javascript? Is there a way I can use some server side code to perform a mobile service?
I want to be able to connect to an API. Check for a specific update. If that update is present send an email to myself.
Unfortunately this API suffers from the same-origin policy and doesn't offer a solution like JSONP. Therefore I will need to handle this API access server side.
Currently you can only use JavaScript, but support for other languages (like C#) is planned.
I was interested in Widows Azure Mobile Services because of the Scheduler service, as a simpler alternative to jobs running in Worker Roles with Quartz and other alternatives, but I felt the same difficulty you describe in having to work in a JS only environment, which is a problem in my scenario.
Are you aware of Windows Azure Web Site Web Jobs (here and here)? You can configure continuous or scheduled jobs developed in many script languages as well as in .Net.
We moved many smaller tasks from under-utilized and more complex Worker Roles to Web Jobs as simple .Net console apps. Via the Web Jobs SDK you also get a good monitoring environment.

owin Self-hosting web api new relic monitoring

I just moved some of are web api from IIS web role to a worker role in Windows Azure and that is working way betting. What I want to know is how much better so, and before we using New Relic to monitor the web server. I have the agent installed on the worker roles but not getting any of the great analytics.
(What I followed to make this work)
So I was hoping someone could help me get some basic stats on how well my self-hosted web server is performing into new relic. I looking for throughput, response time, and log errors.
I found something that seems to make me think that I could do it but I am not familiar with owin.
If anyone has some ideas on how to get this work that would great!
Edit:
What I am looking for is if someone can help me use the newrelic api ( RecordMetric(), RecordResponseTimeMetric(), IncrementCounter(), etc.) and hook it up in the owin pipeline to record throughput, response time, and log errors?
The New Relic .NET agent gathers most transaction-related metrics within the context of the IIS pipeline. The agent can get some basic metrics for standalone services like Worker Roles (WaWorkerHost.exe). Without any special setup, you can monitor calls per minute, RAM/CPU utilization, database calls and external requests. Beyond this, you'll want to use the .NET agent API:
https://newrelic.com/docs/dotnet/the-net-agent-api
Namely RecordMetric(), RecordResponseTimeMetric() and IncrementCounter() are available for Azure Worker Roles and other non-IIS applications. Other methods in the API require proper HttpContext instances.

Resources