Dev

8 min read

November 14, 2022

Serverless computing is a computing paradigm that relies on servers to handle the lifecycle, instead of managing them manually. The same thing can be achieved by using other services such as AWS Lambda and Google Cloud Functions. Which one should I choose? Let's find out in our article!

AWS Lambda vs Google Cloud Functions - What Should You Choose?

The concept of "serverless computing" has been around for over a decade now, and its popularity is growing fast thanks to the services such as AWS Lambda, Google Cloud Functions, and Azure Functions, with more platforms probably coming soon. After several years in the IT industry - serverless computing has reached an incredible dynamic. Therefore, we can feel confident to already call the serverless option a proven and quite mature solution.

What is serverless computing?

Serverless computing offers companies to run their code, manage data, and integrate their applications without managing physical servers or traditional servers at all. This is a very practical work model, where the cloud provider is the one to allot machine resources on demand.Thanks to that a client does not have to buy and maintain an actual server and the serverless provider is the party responsible for taking care of the online servers and their maintenance on behalf of their customers. This structure works with the “pay-as-you-go” model, providing a significant cost reduction.To draw a comparison, imagine the traditional server model as a building and maintaining the well to provide water, with serverless computing as obtaining water from the public supply, where you pay only for what you use and when you use it - on previously agreed rates.

Additionally, serverless technologies feature automatic scaling and built-in high availability. All of this increases agility and optimizes customers’ costs. You will see that the serverless providers do allow their users to write and deploy their code online with no worries about providing the underlying infrastructure. In the case of serverless solutions, it is already pre-prepared. This also applies in the case of applications.Instead of hiring the whole team to manage your app infrastructure, you can simply write your application in the serverless architecture. And this is precisely where services such as Lambda AWS or Google Cloud Functions can help you.

AWS Lambda - what is it?

AWS Lambda is a serverless function as a service akaFunction as a Service (FaaS). One which is event-driven and a very popular one. AWS Lambda allows you to create and deploy your code, as well as create and manage applications in the cloud, for example using the very popular ZIP deployment method.

AWS Lambda is being managed by Amazon Web Services - including its infrastructure itself. While using it you should remember the limits, for example how much code in GB can be stored in each cloud region. In the case of the European region, it is 75 GB.

Now let's move on to another subject inevitably related to the cloud character of the service - scalability. AWS Lambda, like obviously any other service, has its limits. One of them is the limit of active instances per region. For the European region of Amazon Web Services, this limit is set on 1000 active instances, and this applies to all the Lambda functions available per account in that region. To ensure that the minimum number of instances is always run when needed, you can pre-book a certain number of instances per function in the Lambda configuration. Additionally, it is worth mentioning that each Lambda instance has access to the internal memory (/tmp) and its capacity reaches the sum of 512 MB and will not be deleted unless the instance is deleted.

Lambda can be used in conjunction with other similar services on AWS, for example: Serverless Application Model (SAM) — an open-source framework for building serverless applications, and Serverless Application Repository — a managed repository for serverless applications. Cloud9 — a great integrated development environment (IDE) for writing, running, and debugging your code.

Google Cloud Functions

One of the biggest competitors for Lambda AWS is another American product, this time from Google - Google Cloud Functions. It is as well a serverless runtime environment made for building and connecting cloud services. With Cloud Functions, you can easily write simple, single-tasking functions that are tied to events generated by infrastructure and cloud services. This function you can create is called “when the observed event occurs”. What is important your code is also executed in a fully managed environment.

Functions in Google Cloud Functions can be created in various programming languages, such as Node.js, Python, and Go. What is more, all functions are also performed in language-specific runtimes. If you decide to go with the custom functions in Cloud Functions, those can be also run in any standard Node.js runtime. This will provide you with easy portability and local testing.

Moreover, with Cloud Functions, you obviously benefit from all the serverless computing perks, such as no need to manage servers, configure software, update platforms, or patch operating systems. Both software and infrastructure are fully managed by Google, so your only job is to add the code you have written. Additionally, resource sharing occurs automatically in response to events. This means that a function can scale from just a few to millions of calls per day with no effort on your part.

What are their practical applications?

Lambda can be used together with many other-like services on AWS such as Serverless Application Model (SAM) — an open-source framework created to build serverless applications. Serverless ApplicationRepository — a managed repository created for serverless applications. Lastly Cloud9 — is an integrated development environment (IDE) for writing, running, and debugging your code.

On the other hand, in the Cloud Functions Hands-on Lab, you can among others earn basic tenets of serverless architecture, create functions from the GCP console, and check out your skills against a subject matter expert’s real-world task. It is worth mentioning that Google is also a part of a larger family of serverless offerings which include: CloudFunctions created for serverless code, App Engine a serverless application development platform, and Cloud Run — a fully managed platform that automatically scales containers.

Supported languages

Serverless applications are written in many languages, therefore the language adaptability in the case of both: AWS Lamba and Google Cloud Functions need to be very diverse. Many languages are used in API service development. We have compared both platforms and the results are favorable for AWS Lambda. So what languages are supported?

AWS Lambda supports Java, Go, PowerShell, Node.js, C#, Python, PowerShell and Ruby code, and a Runtime API which allows you to use any additional programming languages to author your functions.  

Google CloudFunctions supports two languages: Python and Go. Unfortunately, there is only one fully supported version of Node.js and some beta versions of Node.js andPython on Google Cloud Function.

Deployment models

Ease of deployment is one of the critical factors since it is what determines how fast you will deliver the product to your clients and users. AWS Lambda deploys all its functions in the Lambda environment on servers that run Amazon Linux. Lambda functions can interact with other services on the AWS cloud or elsewhere in numerous ways, but function deployment is only limited to the Lambda service. 

On the other hand, Google Cloud Functions requires functions to be stored in Google's Container Registry and for it to be done using container images. Functions must also be executed as containers.

Also, the number of steps to execute a deployment counts. We have checked that there are a lot of steps to do so in the case ofAWS Lambda, while Google Cloud Function has only one step to deploy any function. But this is due to the fact that the longer way in the case of AWSLambda is caused by the fact that this platform provides many more options allowing the users to configure their functions.

One more thing we did is to count the time both providers use to deploy and update functions. Despite the fact that GoogleCloud Function demands fewer steps than AWS Lambda, it is still Lambda the platform which can deploy and update the function faster than Google CloudFunction.

Maximum delivery time on request

In the case of AWS Lambda, it should be around 300seconds (5 minutes). And in the case of Google Cloud Functions 540 seconds approximately (9 minutes).

Scalability

Scalability is another very important aspect to take into consideration when choosing the serverless services provider. The ability to scale is one of the top things to have in mind because the main purpose of using the cloud provider is to attend to and respond to every request from all of the clients.

Both AWS Lambda and Google Cloud Functions seem to have efficient scalability.

Network Performance and Stability

Another important issue. Choosing your provider, you probably will inquire about the platforms’ network performance and their stability. The average time used to respond is 117.16 ms in the case of AWSLambda and 176.80 ms in the case of the Google Cloud Function. According to this AWS Lambda is slightly faster and more stable than the solution provided by Google.

Memory

You are probably also interested in the platforms’ memory management. We wanted to find out what is the actual maximum memory size that we can allocate on AWS Lambda and Google Cloud Function. Apparently, the memory setting form of AWS Lambda is built in the form, of a slider that provides users to select desired sizes between 128 MB to 3008 MB. On GoogleCloud Function, the memory setting form is just a dropdown selector, which limits the available memory options to 128 MB, 256 MB, 512 MB, 1 GB, and 2 GB.

Pricing

How much does each of the services cost? Which one is cheaper? This is not an easy question and the answer is: it depends. In AWSLambda, you pay for the time you use the function and for the memory used. The billing unit used by AWS is a Gigabyte per second (GB/sec). Additionally, you pay for the number of requests. But it should be mentioned that in the starter pack for a new account (free user) you get 1 million requests every month and400,000 GB/sec, which is honestly quite a lot for free testing of AWS cloud solutions. Then, if this is not enough for you and you have to start paying an additional 1 million requests costs 0,20 $, and 1 GB/sec costs 0.0000166667 $.

Let's suppose we are talking about the app that supports around 500 000 requests per day and needs 512 MB of memory. The total monthly cost is approximately 267 $. This is the only cost we will have to cover since there is no need to pay for maintaining the app’s infrastructure.

In the case of Google Cloud Functions, this solution is being charged according to how long your function runs, how many times it is invoked and how many assets you have planned for the function. If there is an outbound network request from your function, the additional data transfer fees will be charged. Google Cloud Functions includes a constant free tier for invocations. This allows you to experiment with the platform at no cost. Even for free tier usage Google will still require a valid billing account as a guarantee. Function invocations are being charged at a flat fee regardless of the source of the invocation. This includes HTTP function invocations from HTTP requests, events forwarded to the background, CloudEvent functions, and invocations resulting from the API. The pricing is based on the total number of function invocations across all functions associated with a particular GoogleCloud Platform account and billings. Invocations are charged at a per-unit rate of 0.0000004 $ for an invocation (or 0.40 $ for a million). This excludes the first 2 million free invocations of a month, which are free. Charges are acquired no matter the functional outcome or its duration. You are also charged for deploying your functions, even if the number of invocations does not exceed the free tier.

What to choose?

It’s hard to tell, especially since the decision needs to be based on your business-specific needs. One of the major indicators of what will serve you better is obviously the language or the languages your developers code in. Google Cloud Functions does not support as many languages as AWS Lambda, therefore it might not be the right choice for your specific line of business.

Mostly for this reason, at least for now, AWS Lambda seems to be overall a better choice than Google Cloud Function.Nonetheless, choosing the right serverless provider must be aligned accurately with the objectives of your work. AWS Lambda works properly with the users who focus and need more flexibility and freedom to set their own functions. On the other hand, Google Cloud Function works perfectly with users who enjoy simplicity and those who have yet a little experience.

Choosing any of described solutions: AWS Lambda orGoogle Cloud Function will for sure relieve your business’ infrastructure and allow you to optimize the costs. We do recommend proceeding with the analysis, as it may turn out that one of them is almost a tailor-made solution. Of course, each of the tools has its limits or limitations, and it will not always achieve the intended goal. But is worth trying since their benefits exceed eventual drawbacks.

 

We hope that this portion of knowledge at least has sharpened your appetite for more. Please do not hesitate to contact us, by clicking the link below.

Are you considering building custom software applications?

Do you want to work with a partner that will deliver cost-effectively and on time? Contact Score Digital to find out more about our values and development process.

Created by

Karol Ludwikowski

FULL-STACK SOFTWARE ENGINEER

Read more

Dev
10 min read
September 4, 2023

Can you build a web app in Flutter?

Explore the potential of Flutter for web development: its journey from mobile to web, key benefits, challenges, and how it stands against React and Angular. Discover if Flutter's cross-platform capabilities align with your project needs.

Dev
8 min read
May 29, 2023

React Native Mobile App Development: Pros & Cons

Understand the advantages and disadvantages of using React Native for your mobile app development project. Get insights into how this powerful framework can expedite the development process, reduce costs, improve app quality, and more.

Dev
6 min read
May 22, 2023

Advantages of Node.js for Your Next App

Explore why Node.js is rapidly becoming developers' top choice for app development. Discover its versatility with non-relational databases, an ever-growing developer community, expansive tooling, asynchronous programming prowess, handy pre-built NPM packages, and the ease of using JavaScript for full-stack development.

Dev
10 min read
September 4, 2023

Can you build a web app in Flutter?

Explore the potential of Flutter for web development: its journey from mobile to web, key benefits, challenges, and how it stands against React and Angular. Discover if Flutter's cross-platform capabilities align with your project needs.

Dev
8 min read
May 29, 2023

React Native Mobile App Development: Pros & Cons

Understand the advantages and disadvantages of using React Native for your mobile app development project. Get insights into how this powerful framework can expedite the development process, reduce costs, improve app quality, and more.

Dev
6 min read
May 22, 2023

Advantages of Node.js for Your Next App

Explore why Node.js is rapidly becoming developers' top choice for app development. Discover its versatility with non-relational databases, an ever-growing developer community, expansive tooling, asynchronous programming prowess, handy pre-built NPM packages, and the ease of using JavaScript for full-stack development.

Dev
9 min read
May 15, 2023

Why Node.js Is the Best for Creating Functions in the Cloud?

Discover why Node.js is the ultimate choice for creating cloud functions and leveraging the benefits of serverless computing. Learn about the cost-effectiveness, scalability, and simplified development offered by Node.js in building serverless applications on AWS Lambda, Azure Functions, and Google Cloud Functions. Unleash the potential of serverless computing with Score Digital.