Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Azure Functions

You're reading from  Learning Azure Functions

Product type Book
Published in Sep 2017
Publisher Packt
ISBN-13 9781787122932
Pages 240 pages
Edition 1st Edition
Languages
Concepts

Chapter 8. Business Considerations

"Do not wait; the time will never be 'just right.' Start where you stand, and work with whatever tools you may have at your command, and better tools will be found as you go along."

- George Herbert

Some considerations that most developers need to take into account when deciding to use functions as the solution are monitoring, pricing/hosting plans, and best practices.

Monitoring is one of the important aspects related to application life cycle management and we need to configure all the available configurations of monitoring in Azure.

Once we are ready with Azure Function Apps, it is very important for us to understand how to monitor the health of functions. Azure Functions have their own kind of monitoring, which are useful but basic.

For an advanced level of monitoring, we can utilize Application Insights. Another important business consideration is to understand the concepts of pricing so that we can make an informed decision based on the anticipated load...

Monitoring of Azure Functions


Monitoring is essential for the quality of the Azure Functions over a specific period of time. Azure Function Apps provide a simple yet understandable monitoring in the Azure portal itself.

Go to Function Apps, select a specific function, and click on the Monitor link.

Here we can see the success count, error count, function invocation log, and other details:

In Azure Portal, click on the function and select Expand to get logs in a large window, as shown in the following figure.

Upload any new image in the Azure Storage container and wait for the function to be executed successfully:

Once the function is executed successfully, go to the Monitor section and find the updated success count:

We can also set the Daily Usage Quota in the Azure Portal for the Function App. We can set the quota as GB per second:

Go to the Platform features of the Function App and navigate to the Properties link to find the available properties for that specific Function App:

In the Monitoring...

Integration of Application Insights and Azure Functions


Application Insights is used to monitor live web applications. Application Insights detects issues. It can therefore be useful in improving the quality and performance of the application. It supports applications based on .NET, Node.js, and J2EE.

Application Insights monitors request rates, dependency rates, response times, failure rates, exceptions, page views, load performance, AJAX calls, user and session counts, performance counters, host diagnostics, diagnostic trace logs, custom events, and metrics.

To integrate Azure Functions with Application Insights perform the following steps:

  1. Here, we will try to use Application Insights for the Azure Function App. We have already created the Function App. Let's create Application Insights and associate it with the Function App.
  2. Go to Application Insights.
  3. Click on Add:
  1. Give a Name.
  2. Select General in Application Type:
  1. Use the existing Resource Group and select Location.
  1. Click on Create:
  1. Once Application...

Pricing/hosting plans


For Azure Functions, the consumption plan and App Service Plan can both be utilized:

  • Consumption plan: In consumption plan hosting, we only pay for the time of execution of the function and not for the entire duration.
  • App Service plan: In App Service plan hosting, we need to pay for all the resources allocated under the App Service plan for the entire time the App Service plan exists:

In earlier chapters, we have utilized the consumption plan for all our functions. Go to App Services and verify the plan:

Go to Function Apps in Azure Portal and verify the App Service plan; it is the same as the consumption plan:

Let's see how to create Azure Functions in the App Service plan:

  1. Create a new Function App.
  2. In the App Service plan, click on Create New.
  3. Provide the App Service plan name, Location, and Pricing tier details.
  1. Click on OK:
  1. Click on Create to create the Function App in the App Service plan:
  1. Now, we have two Function Apps in the Azure dashboard available. One has the consumption...

Best practices


The following are recommended best practices for using Azure Functions:

  • It is desirable to have stateless code to effectively utilize the serverless concept.
  • Keep functions short and simple. Create many short and simple functions rather than one big function.
  • Import dependencies only if they are required. Consider module dependencies as well.
  • Use storage queues, service bus queues, service bus topics, and event hubs for cross-functional communication.
  • Delete functions that you are no longer using, especially if the function is hosted on the App Service plan in the basic, standard, or premium tier.
  • Use the built-in monitoring of Function Apps to view and optimize request latencies or utilize Application Insights.

 

Summary


This is the second to last chapter and we are about to finish our journey. We have covered how to monitor a Functions App using the available monitoring in the Function App itself.

Basic monitoring includes the success and error count of code execution and logs. However, it is important to have detailed analysis as well; thus, we utilized Application Insights to monitor Azure Functions.

We have integrated Azure Functions with Application Insights.

Once we decide on the usage of Azure Functions, it is important to consider pricing also, so we have also discussed the consumption plan and App Service plan to host Azure Functions.

In the next chapter, we will cover basic examples of other languages, such as Python, PHP, and so on.

 

lock icon The rest of the chapter is locked
You have been reading a chapter from
Learning Azure Functions
Published in: Sep 2017 Publisher: Packt ISBN-13: 9781787122932
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}