Bet on Serverless
You can't look sideways without seeing "Serverless" it's a silly term, but I need to start with a definition by Serverless experts on "Serverless"
- Use a compute service to execute code on demand
- Write single-purpose stateless functions
- Design push-based event-driven pipelines
- Create thicker front-ends
- Embrace third-party services
I started on this path in 2016 and I can't look back. Being able to run your code, anytime in the cloud is a life changing experience for many of us - it abstracts the operations part of hosting code in the cloud, and lets us get back quickly into code.
Applications for this technique are far and wide. From simple services to augment the endless front-end applications we were building in 2016, to finally having a great way to handle remote events or permission escalation. And look beyond to the bot-framework. A little blog post I wrote in 2016 about Serverless site provisioning is now officially best practice in SharePoint's Site Design - I'm a little glad it was useful :-) At times it feels like I just hack and cobble things together and behold, wow people do like this.
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview#pnp-provisioning-and-customization-using-microsoft-flow
So, what's next?
Serverless Orchestration
Invest into Serverless orchestration. Azure Functions are not the right place to do our orchestration. Yes, Durable Functions will help this a lot. But the product we should be looking at is Azure Logic Apps / Microsoft Flow.
As far as I'm concerned - these are the same products, the differences boils down to:
Logic Apps
- UX, with JSON editor is targetted for developers
- Consumption based pricing - per actions used, perfect for multiple small requests
- So we end up compressing multiple actions into unreadable mess to save costs
- Integration Services (biztalk scenarios)
- Better for multi-tenant solutions.
Microsoft Flow
- UX tries really hard to remain Power User friendly and hide JSON complexity
- Per Flow execution pricing, with free buckets per tier
- So we end up putting way too many steps inside a single Flow to save costs
- Premium connectors as part of higher tier plans
- Free licenses as part of Office 365 / Dynamic 365 plans making this cheaper for single-tenant solutions.
What can you do with Logic Apps/Flow?
- Leverage connectors - (remember Embrace third-party services is a Serverless principle), these are hundreds of connectors implemented by the various product teams themselves directly. So they know what they are doing* (most of the time)
- You can do delay and wait easily in Flow
- You can do loops easily in Flow (in Functions it's tricky without potentially hitting timeout).
- You can do for-each loops in Flow and easily turn it into parallel execution (fan-out) with fan-in just part of the package
- You can define repeat/retry policies with gradual fall back in Flow
- You can define follow next token in Flow HTTP Request for REST paging
- You can handle fallback behaviour as a scoped set, so if any actions fail you can orchestrate that
- You can include human workflows with human approvals and send nice templated emails with attachments from Flow
- Function shouldn't do more than one thing. Use Flow to chain them.
Serverless API end points
As we build out a constellation (I stole this word from https://www.slideshare.net/HeitorLessa1/serverless-best-practices-plus-design-principles-20m-version) of functions. We need to clean up all the microservices APIs with a unified API front. There are two products for this:
Azure Functions Proxy
- Simpler - can transform query/post messages
Azure API Management Service
- More extensive - can transform REST to XML
- Better Open API definitions
Serverless Websites / thicker Front-Ends
A serverless website is basically a CDN plus FaaS. You don't scale Azure VM or even Azure WebJobs. Build your entire website with your favourite JavaScript library (I like and recommend Angular - but you should use what your team uses), then bundle with Webpack into a couple of minified JS file for CDN.
Do your compute in the client. And do your server compute with Azure Functions.
I'll even add here that a low-code solution such as PowerApps is extremely good at getting a proof of concept up and running quickly. PowerApps supports offline capabilities and will happily call your Serverless APIs via a Swagger/OpenAPI file and treats them all as first class functions.
Wish
As part of the Azure services upgrade email (what a peculiar way to announce new features), the upgrade to the latest Windows Server means that Azure Functions, as part of Azure App Services, will gain ability to work with HTTP/2.
It means - we can get our entire HTTP website in one HTTP Get request, with our Function (or possibly our LogicApp/Flow) sending multiple resources in one response.
Serverless Database
Let me first define what is a Serverless Database. Essentially, you have a database in the cloud.
- You want to pay for storage.
- You want to pay for compute. On consumption based plans
- Pay nothing if it's not doing anything, automatically scale as necessary
- The problem we are trying to fix is simple. We want to start an application, pick a database, and have it scale with us. We don't want to put SQL Azure on the cheapest free VM and have it run like crap.
This is an area where Azure is somewhat lacking. My choices are:
- Azure Storage Table
- SharePoint Lists (only because I'm a Office 365 person and I've got office 365 tenants everywhere I look)
Wish
I predict boldly that Azure will bring out a Serverless CosmosDB solution in 2018 and it will be what everyone in the Microsoft ecosystem uses from there onwards.
Otherwise, look towards the competition:
- Google Cloud Platform has Firebase - event driven, consumption based database, linked to Google Cloud Functions
- Amazone Web Services has Aurora Serverless - in late 2017, AWS announced they've separated Aurora's cost model down to Compute and Storage.
Serverless Event Aggregator
The Azure Event Grid is a very interesting service. I see the possibility that we'll see a unified way to manage all events in a system.
This is best explained with a parallel analogy. In browser applications, we catch and handle events in the DOM all the time.
In the beginning, we do: