Sunday, 27 November 2016

Function as a Service- Azure new feature



Over the last couple of years, new methodologies like Agile, DevOps, Continuous deployment etc. emerged to migrate the application development complexity and delivery process. Function as a Service is a new service provided by Microsoft Azure to provide a new way to build scalable and cost effective applications. It can be very useful to reduce application development complexity as well as in various development methodologies.

FaaS is also known as Server-less computing. It does not mean that there are no servers but rather the underlying infrastructure such as physical and virtual hosts, virtual machines, containers, operating system, is abstracted away from the developer. Applications are run in stateless compute containers that are event triggered (e.g. a user uploading a photo which triggers notifications to his/her followers).



Azure Functions provides a server-less development experience supporting a robust set of event triggers and data bindings. Microsoft Azure is not the only FaaS provider. Others include AWS Functions, Google Cloud Functions, and IBM OpenWhisk.

Basic diagram for azure functions functionality:
















Previously whenever some very small change request arise from customer that we need to implement that change and test whole application and redeployment needed. Some logic need to be changed frequently on the basis of new technology/feature updated. For example, we were creating SAS URL using azure storage explorer. We had implemented this. Sometime later Microsoft provided the feature on azure portal to create SAS. But there is different format of SAS through Azure storage explorer and MS azure portal.

So we need to change the logic, test and redeployment.


So if we implement these types of logics under azure functions. We can modify logic whenever needed without built, testing and redeployment. We only need to test and built that small piece of code that we have written for SAS validations. Below are the basic problem areas that can be resolved using azure functions.

Infrastructure and maintenance 
Rapid Application Development
Scalability
Monitoring
Costing
Deployment iteration


Azure Functions is an event-driven, compute-on-demand experience that extends the existing Azure application platform with capabilities to implement code triggered by events occurring in other Azure services, SaaS products, and on-premises systems.
Each endpoint in your API could be a separate function. These functions are then run on demand, rather than full-time like an app running on a PaaS that reduce your cost on cloud.
To create azure function below are steps


  1. Go to the Azure Functions portal and sign-in with your Azure account.
  2. Go to New -> Compute -> Function App
  3. Fill the required details and create
























  4. Choose your scenario and development language




















  5. Create this Function
  6. A sample example for function given, you can update the code as per your requirement.

















  7. Example to validate SAS URL.



















  8. Test this function in web browser.














  9. Call this function in your application.
  10.  You can call this FaaS as service in c#.




  11. You can edit/add logic to this function as per your requirement without redeploying your application. You can achieve Rapid application development. 

Benefits

Rapid Application Development:
In the current completive environment, customer want rapid application development and request for changes frequently. Server less computing is ideal for companies that need to quickly develop, prototype, and iterate. 
The complete application complexity broken into smaller and manageable chunks as functions and these functions can be built separately so the changes can be pushed through continues delivery pipeline. 

Scalability:
Sometimes we need to scale functions for load balancing. So if a function needs to scale, the infrastructure will make copies of the function to handle the load.

Costing:
Because your functions are running on azure as a service, so you need to pay per usage charges. You did not need to spend money on deployment infrastructure. Azure Functions consumption plan is billed based on resource consumption and executions. For price details visit


Azure Functions is a great solution for building micro services, simple API’s, processing data and integration with systems. Here are some common scenarios for Azure Functions:
Timer-based processing
Azure service event processing
SaaS event processing
Server less web application architectures
Server less mobile backend
Real-time stream processing
Real-time bot messaging


No comments:

Post a Comment