Book Image

Serverless computing in Azure with .NET

Book Image

Serverless computing in Azure with .NET

Overview of this book

Serverless architecture allows you to build and run applications and services without having to manage the infrastructure. Many companies have started adopting serverless architecture for their applications to save cost and improve scalability. This book will be your companion in designing Serverless architecture for your applications using the .NET runtime, with Microsoft Azure as the cloud service provider. You will begin by understanding the concepts of Serverless architecture, its advantages and disadvantages. You will then set up the Azure environment and build a basic application using a sample text sentiment evaluation function. From here, you will be shown how to run services in a Serverless environment. We will cover the integration with other Azure and 3rd party services such as Azure Service Bus, as well as configuring dependencies on NuGet libraries, among other topics. After this, you will learn about debugging and testing your Azure functions, and then automating deployment from source control. Securing your application and monitoring its health will follow from there, and then in the final part of the book, you will learn how to Design for High Availability, Disaster Recovery and Scale, as well as how to take advantage of the cloud pay-as-you-go model to design cost-effective services. We will finish off with explaining how azure functions scale up against AWS Lambda, Azure Web Jobs, and Azure Batch compare to other types of compute-on-demand services. Whether you’ve been working with Azure for a while, or you’re just getting started, by the end of the book you will have all the information you need to set up and deploy applications to the Azure Serverless Computing environment.
Table of Contents (23 chapters)
Title Page
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Foreword

Push it down the stack.

Abstract it away to a third-party.

Focus on what's unique to my application.

This book is about the next important step in our never-ending journey to build more sophisticated and scalable applications with less effort and fewer lines of code. If there has been a unifying thread to my career, it's been the relentless pursuit of not worrying about as many aspects of my applications as possible. 

To put serverless computing in perspective, consider how your own interaction with the stack has changed over the years. Has it moved in the upward direction?

Did you ever have to worry about an actual data center? That got abstracted into colocation services. What about the physical servers in those managed racks? They went the way of cloud-based VMs. How about configuring, patching, and networking those VMs? On Azure, that got pushed down into cloud services so we could just publish our code and scale at will. But then even the application frameworks got encapsulated into specialized services for mobile backends, websites, asynchronous job processing, and more.

So at this point in the journey, we have a nicely dialed-in platform where we have VMs, but they are so preconfigured and loaded up with useful frameworks that you don't need to think about them that much. However, you may still be creating fairly elaborate projects with more plumbing code than what feels quite right.

Serverless computing is a jump forward from that. The big idea is that you can just write a collection of useful functions (or methods or microservices) with no application container whatsoever. They become available in the cloud at an infinite scale (and low cost) to be invoked at will. The potential to cull and simplify mid-tier code is significant.

I happened to work with this model recently, and it was an eye-opener. My company has an elaborate application implemented on Azure Cloud Services. We had a need to integrate with an external authentication provider whose API was most conveniently accessed via a Node.js library. Having C#.NET skills in house, we were not looking forward to spinning up a new service application to do the Node work. Then we found Azure Functions.

We were able to write a series of 10-line routines that did what we needed, expose them via a RESTful endpoint, and call them from our existing application in a day. We did this without thinking about building a new service or deploying new VMs or considering how it would scale out.

This is just a tip of the iceberg scenario, but it got me thinking about how to architect our services as functions going forward. This will certainly help us spend less time and effort building things, but the elastic properties of how this scales and is paid for are really interesting. Scalability is provided at the function level. There are no underlying VMs in

your account that you need to ramp up or down. Your functions simply run when invoked and you pay for the execution thereof. It's a much more cost-effective model as there are literally no idle resources from your point of view.

Serverless is clearly an exciting new tool for forward thinking architects and developers alike.

All this backstory brings us to your author, Sasha Rosenbaum. I'd like to tell you why I think she's an important voice on the topic at hand. We met at a consultancy specializing in custom software development for the Azure platform. Shortly after she joined, it became clear that she could fearlessly take on any new technology, figure it out quickly, and apply it for customers with all the attention to detail and pride in the work that you could ever want. So I, somewhat selfishly, made sure that she worked on all my projects because I knew the chance of success was going to be 100%.

I personally witnessed her grok and apply tools as diverse as Azure Cloud Services, App Services, and SQL Databases; .NET MVC, Web API, and Entity Framework; hybrid native application development for iOS and Android, Python running on IoT devices, and interactive video. All these over a two-year period! Then a short year after I left the company, she had added DevOps expertise to the list and was booking speaking engagements on the topic.

I mention this because Azure Functions are nascent, with limited real-world examples to draw experience from. You want your guide to not only have really dug into the details, but also to have a breadth of experience from which to put the new technology into perspective. You need help figuring out where it might (or might not) add value to your situation.

I can assure you that Sasha is the right person for the job. She has just the right mix of inquisitive, theoretical, and pragmatic to bring actionable insight to the serverless computing conversation.

I hope you find this book as useful for your work as I have, and I hope that you appreciate the mountain of work and dedication that Sasha put into creating it.

 

Steve Harshbarger

President and CTO of Monj