Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Serverless Microservices - by example of Azure Functions (and a bit of deep dive into the platform)

Serverless Microservices - by example of Azure Functions (and a bit of deep dive into the platform)

Why does it have to be Serverless versus Microservices? Couldn’t it be rather Microservices with Serverless? Based on some of the well-accepted principles of Microservices, we can use Serverless architectures and technologies to build highly focused Microservices – which we might call Nanoservices.
Christian Weyer will show you a pragmatic approach on how to build Nanoservices with Azure Functions, Azure Service Bus, Azure Storage and friends. Join him to see Serverless Azure in action, with .NET Core, JavaScript and Java – beyond the typical Functions-as-a-Service examples.

Christian Weyer

February 22, 2019
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. Serverless Microservices - by example of Azure Functions (and a

    bit of deep dive into the platform) Christian Weyer @christianweyer [email protected] CTO #ServerlessWebinar
  2. 2 § Microservices, Nanoservices? § Serverless Compute with Azure Functions

    (FaaS) § Serverless messaging with Azure Service Bus (MaaS) § Add your own data sources & sinks with Azure Functions extensibility Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Topics
  3. How large is small? Microservices (and a bit of deep

    dive into the platform) Serverless Microservices – by example of Azure Functions 3
  4. Single Responsibility § Focused around business domain § ‘Small’ unit

    Isolation § Choice of technology § Well-defined technology- agnostic API (event-triggered) § Mobility Autonomy § Exclusive state (data storage) Decoupling § Asynchronous communication (Really, always?) Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) (Some) Principles of Microservices 4
  5. 5 § Microservice: unit of independent deployment for a business

    domain-specific service § Nanoservice: like Microservice, but more focused & lightweight; can be coded, deployed & replaced easier § Functions as the mental model § Make things easier, get productive earlier Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Microservices – or rather: Nanoservices?
  6. A different approach Serverless (and a bit of deep dive

    into the platform) Serverless Microservices – by example of Azure Functions 6
  7. Serverless Compute Azure Functions (and a bit of deep dive

    into the platform) Serverless Microservices – by example of Azure Functions 7
  8. 8 § Azure Functions is code being triggered by an

    event § Basic principles enable powerful use cases § Events ➔ Triggers § Bindings § V2 Runtime built on .NET Core – completely OSS § Available for e.g. self-hosting § Local tooling & runtime § Multiple language bindings supported: C#, JavaScript/TypeScript, Java, Python Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Azure Functions: Functions-as-a-Service
  9. 9 § Incoming event triggers function § Input bindings enable

    easy access to data from various data sources § Output bindings offer easy access to outbound data sinks Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Functions Triggers & Bindings Your code logic Runtime Azure Function HTTP Trigger Storage Input Binding Push Notification Output Binding Database Output Binding Email Output Binding Example
  10. Serverless Messaging Azure Service Bus (and a bit of deep

    dive into the platform) Serverless Microservices – by example of Azure Functions 10
  11. 11 § Decoupling your Microservices § Queues & Topics §

    Reliable asynchronous communication § Rich features for temporal control § Routing and filtering § Transactions § Convoys & Sessions (related messages with state) § AMQP 1.0-compatible § Bindings for Azure Functions available Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Service Bus: Messaging-as-a-Service
  12. 12 Sender § Sender sends message to queue § Queue

    ACKs receipt § Receiver connects to queue & retrieves message § Receiver ACKs complete (or other action) Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Service Bus Queues Receiver
  13. 13 § Sender only knows about Topic § Receivers only

    know about Subscriptions § Filters and Actions exist on Subscriptions Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Service Bus Topics & Subscriptions Type == ‘order‘ Sender type=quote type=order Topic Type == ‘quote‘ Filter Filter Subscrip- tion 1 Subscrip- tion 2
  14. Azure Functions Extensibility Custom Bindings (and a bit of deep

    dive into the platform) Serverless Microservices – by example of Azure Functions 14
  15. 15 § Connecting your own data sources and data sinks

    to Azure Functions § Beyond available bindings & triggers § We can implement custom bindings § Input § Output § Triggers (with limitations) § E.g. build input binding for your own ERP system § E.g. provide output binding for Web Push protocol (used in PWAs) Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) Azure Functions Custom Bindings & Triggers
  16. Single Responsibility § Focused around business domain § ‘Small’ unit

    ➡ Dedicated Azure Functions App Isolation § Choice of technology ➡ .NET, Java, node.js, Python supported § Well-defined technology-agnostic API (event-triggered) ➡ HTTPS, AMQP, MQTT, custom § Mobility ➡ Portable runtime ➡ Can use Docker with Functions Autonomy § Exclusive state (data storage) ➡ Use separate Azure Storage, Azure SQL, Azure CosmosDB instances Decoupling § Asynchronous communication (Really, always?) ➡ Azure Service Bus with queues or topics & subscriptions Serverless Microservices – by example of Azure Functions (and a bit of deep dive into the platform) (Some) Principles of Microservices – with Serverless Azure 16