Serverless Part 2 – Azure, AWS and Google Cloud
Serverless Part 2 – Azure, AWS and Google Cloud
Going serverless, which one is the right choice?
The correct answer is, what cloud platform are you? Our first decision must be based on strategy, multi cloud or single cloud. If you have ever looked at serverless before, it’s always been AWS Lamda. They were first to market and still running the most workloads, and its continuously growing. Azure Functions came in second, the platform is solid, but the usage is still far off the numbers running on Lamda. Google Cloud Functions came in third but should not be taken lightly. The rise in usage is growing due to app developers using the Firebase platform.
For Firebase developers, Cloud Functions for Firebase provides a way to extend the behavior of Firebase and integrate Firebase features through the addition of server-side code.
Firebase has become an extremely popular platform for app developers. Even though AWS Lambda has the biggest market share for serverless, they don’t have a platform such as Firebase. Microsoft’s closest product App Center is comparative but doesn’t cater for serverless integration with Functions. But Microsoft has the ability to integrate Functions with the Visual Studio IDE, allowing project deployments directly to Azure all through the IDE. AWS falls short here as they don’t have an IDE, but they still have Cloud9, a cloud based IDE, not as feature rich and requires internet. Startups have been trying cloud IDE development for a while now, but no platform has ever taken off.
There are pros and cons for each platform, first lets have a look at some of the highlighted features for each platform.
The Seattle Times uses AWS Lambda to resize images for viewing on different devices such as desktop computers, tablets, and smartphones.
One of the things we love about Lambda is Blueprints. It makes it easy for new developers to understand the serverless concept with examples that can be spun up quickly. Blueprints provides templates for pre configured Lambda deployments. Microsoft and Google do not have this feature for Functions.
Another great ability with Lambda is the quick and ease to attach triggers to a workflow.
Why is this so powerful?
It’s basically combining features from Functions and Logic Apps on Azure in one service. Giving a developer the ability to code and trigger in the same workflow. Azure has broken this up into seperate services meaning we would require a Functions app and Logic app together to do the same.
Cloud9 is a cloud based IDE for integrated app development. Through the online tool we can code and debug our Lambda applications. It includes a code editor, debugger and terminal. The biggest disadvantage is we have to be connected to use the code editor. Microsoft is ahead of both Google and AWS here as Visual Studio supports offline development for Functions. Even though Google and AWS have terminal compilers that will build and run local versions, they have no code editor.
Serverless with AWS – Youtube Walkthrough
Example: S3 Event Trigger
Let’s look at a serverless setup with an S3 bucket event trigger. When a photo is uploaded to the S3 bucket, our Lambda workflow is triggered to run code for resizing the image into multiple sizes. We may then pass these resized images into another data store and kick off another workflow. This is called ‘chaining’, calling a Lambda Function from another Lambda Function.
Fujifilm is one of many large enterprise customers building serverless applications with Azure Functions.
Visual Studio & Visual Studio Code
If you want the best development experience for any serverless application, it’s Microsoft’s tooling. We can use the powerful and feature rich code editor of Visual studio to build and deploy Functions applications, both off and online. We can also use Visual Studio Code for Functions dev, less feature rich rich than Visual Studio as a code editor but more lightweight. Both IDEs are cross platform across MAC and Windows.
Visual Studio for MAC was originally Xamarin Studio re-skinned (post acquisition of Xamarin), it’s still very new as opposed to Windows Visual Studio, but it supports development of Functions.
Parallel Execution with Durable Functions
This is where serverless is mind blowing. If we want our workflows to chain (as mentioned above) or even expand to complete large running tasks faster, why not expand our Function into multiple, chunk a task into multiple parallel processes.
Ever heard of Map Reduce?
Map Reduce is a model for processing big data sets across a distributed network in parallel. When we spread the processing across multiple nodes, each node must do a map to filter/sort the data, then a reduce process to perform a summary operation. Once all tasks are finished in parallel, all data comes together in a final aggregate phase.
In Functions the Fan in/out approach works in a similar way, we distribute a large task into multiple functions and complete in parallel. Once the entire task is complete, the Functions that were spun up in the ‘fan out’ phase will now be shut down in the ‘fan in’ phase, exactly like autoscaling.
Example: Web application backend
All serverless services have the ability to host a backend for your application. In the case below, orders purchased online are passed to a queue. Following a FIFO approach, each request at the front of the queue will process the order and send output to a Cosmos DB instance. Triggers can be attached to many event driven services like the example below. The trigger here is when a message is received by the Service Bus queue.
Nord-Lock Bolt Systems is one of many large customers building serverless applications with Logic Apps.
Don’t like to code? No problem. Logic Apps serverless architecture is built upon another cloud-based tool Microsoft Flow.
Microsoft Flow is a cloud-based software tool that allows employees to create and automate workflows across multiple applications and services without the need for developer help.
Logic Apps works the same way, we add steps from services all over Azure through GUI.
What about integrating to external platforms?
Logic Apps works off connectors to connect to third party services. There are many connectors that allow your workflow to trigger steps to Sales Force, SAP, Twilio (SMS), plus much more – see more info here.
Serverless with Functions and Logic Apps – Youtube Walkthrough
Google Cloud Functions
Meetup moved applications and development into a multi-cloud environment including Google Cloud Functions.
The biggest advantage over all other platforms is Google Firebase integration with Cloud Functions. App developers have the ability to build, maintain and monitor app specific functions through the Firebase platform.
In early 2018, one Google director mentioned that over 1 million app developers are using the Firebase platform. Can you imagine the scale of applications moving to serverless on Google? One of the reasons why Cloud Functions on Google should not be ignored. One disadvantage with Google is Language support, Cloud Functions only supports Node.js and Python. They say other language support is coming, but for now, these are the only runtimes available.
Example: Cloud Functions Event Trigger
Examples like the trigger architecture above, Cloud Functions on Google looks very similar. When an image is uploaded from the mobile app to storage, a serverless function will run a workflow to convert the image to a thumbnail and write to another database. Then the mobile app will be able to retrieve this thumbnail when requested over HTTP.
Overall, all serverless platforms are great. From the examples above we can see that every platform is capable of running serverless backends for any application. We have pointed out a few highlights from each platform, in our next article we will go a step deeper into running times, cold start up speeds, example setups and more.Posted in Blog, Learn