Serverless Architecture AWS Lambda: 2 Comprehensive Criteria

on Engineering, Faas, Strategy • September 6th, 2021 • Write for Hevo

Serverless Architecture is a type of architecture where we rely to a smaller extent than usual, on running our own server-side systems as part of our applications. We do this through two techniques – Backend as a Service (BaaS), where we tightly integrate the third-party remote application services directly into the front-end of our apps, and Functions as a Service (FaaS), which moves server-side code from long-running components to ephemeral function instances.

Earlier, the definition of Serverless Architecture was bounded to applications dependent on third-party services in the cloud that manage the server-side logic and state. Now it is defined by stateless compute containers and designed for an event-driven solution. In a microservice architecture, monolithic applications are broken down into smaller services so you can develop, manage and scale them independently. And FaaS takes that step further by breaking applications to the level of functions and events.

This article AWS Lambda which is a Serverless Architecture base computation platform. The article will first introduce AWS Lambda and then will discuss the advantages and disadvantages of using this application. Read along to learn more about AWS Lambda and analyze its Pros and Cons.

Table of Contents

What is Serverless Architecture

Serverless Architecture AWS Lambda Logo
Image Source

AWS Lambda is the perfect example of a Serverless Architecture – a computing execution layer in the cloud where providers manage the resources.  It employs the Function as a Service (“FaaS”) model of cloud computing. This allows you to build and run applications and services without managing infrastructure

AWS Lambda lets you run an application without rigging or managing servers. It is an event-driven computing platform. The code is executed in Lambda upon configured event trigger.

A simple use case could be that when an image is uploaded into Amazon Simple Storage Service (S3), a Lambda function could automatically resize the image for Mobile, Tablet, and Desktop. The event that triggers the Lambda function is the file being uploaded to S3. Lambda then executes the function of resizing the image.

To learn more about AWS Lambda, visit here.

Let’s look at the benefits and drawbacks of Serverless Architecture, specifically AWS Lambda.

Simplify your Data Analytics with Hevo Data

Hevo Data is a simple to use Data Pipeline Platform that helps you load data from 100+ sources to any destination like Databases, Data Warehouses, BI Tools, or any other destination of your choice in real-time without having to write a single line of code.

Get Started with Hevo for Free

Hevo provides you a hassle-free data transfer experience. Here are some more reasons why Hevo is the right choice for you: 

  • Minimal Setup Time: Hevo has a point-and-click visual interface that lets you connect your data source and destination in a jiffy. No ETL scripts, cron jobs, or technical knowledge is needed to get started. Your data will be moved to the destination in minutes, in real-time.  
  • Automatic Schema Mapping: Once you have connected your data source, Hevo automatically detects the schema of the incoming data and maps it to the destination tables. With its AI-powered algorithm, it automatically takes care of data type mapping and adjustments – even when the schema changes at a later point.
  • Mature Data Transformation Capability: Hevo allows you to enrich, transform and clean the data on the fly using an easy Python interface. What’s more – Hevo also comes with an environment where you can test the transformation on a sample data set before loading to the destination.
  • Secure and Reliable Data Integration: Hevo has a fault-tolerant architecture that ensures that the data is moved from the data source to destination in a secure, consistent and dependable manner with zero data loss. 
  • Unlimited Integrations: Hevo has a large integration list for Databases, Data Warehouses, SDKs & Streaming, Cloud Storage, Cloud Applications, Analytics, Marketing, and BI tools. This, in turn, makes Hevo the right partner for the ETL needs of your growing organization.
Sign up here for a 14-Day Free Trial!

Benefits of a Serverless Architecture

You are not running your app 24/7 anymore, and you’ll be charged against the time that your functions were running. Such architectures remove the need for the traditional ‘always on’ server system sitting behind an application, significantly reducing operational cost and complexity.

If you build and manage your own FaaS infrastructure, it’s all about optimization of resources (From an IT/ops perspective) which translates to reduced cost – a major reason to go serverless.

Following are the major benefits of using Serverless Architecture like AWS Lambda:

1) Faster Development

Software Development Image
Image Source

Product engineers can innovate rapidly as Serverless Architecture has alleviated the problems of system engineering. Thus you will now, spend less time on operational issues – makes DevOps life easier.

The technology stack can be updated flexibly. Identity management, storage are some examples of the concerns of internet applications that are exposed to FaaS or handled by Middleware. Engineers can concentrate on the actual business logic of the application.

2) Easier Operational Management

AWS Scaling Feature Image
Image Source

The Automatic Scaling functionality of FaaS not only reduces computational cost but also reduces operational management overheads.

A Serverless Architecture-based platform provides a clear separation between infrastructure services and applications running on top of the platform.

System Engineers can focus on managing the core services such as Databases and Load Balancers while product engineers manage the functions running on top of the platform.

Bundling and deploying the FaaS Architecture is pretty straightforward when compared to deploying an entire server. Continuous integration, Continuous delivery, or Containerization tools are not required. Developers can write the code directly in the vendor console.

Thus a completely Serverless Architecture solution like AWS Lambda will not require system administration.

3) Scaling Benefits of FaaS

Given an influx of events, AWS scales up Lambda events to take all incoming traffic. On the upside, it works as a great cron job service.

Lambda Scales the batches with SQS jobs, Picks them off the queue, Processes work and then Shuts them all the way off again when it is done. No EC2 spin-up is required.

Since scaling is taken care of by the vendor, with FaaS hosted apps you don’t have to consider the number of concurrent requests you can handle before running out of memory. This is done for each request/event. A significant increase in load in downstream databases and non-FaaS components will have to be handled.

4) Low Operational Costs

The basic advantage of this Serverless Architecture-based technology is that you only pay for the time your function executes and the resources it needs to execute.

AWS Lambda bills you only for the time when the FaaS function is called. It means you are charged 95% less compared to running a server for an entire month. It allows operational cost reduction.

Drawbacks of Serverless Architecture

Few things can’t be achieved with this kind of architecture, like keeping a web-socket connection open for a bot. There can be Vendor control issues, Multi-tenancy problems, Vendor lock-in, and Security concerns, due to third-party API systems.

Following are the major disadvantages of giving up system control to platform vendors while using a Serverless Architecture like AWS Lambda:

1) State Restrictions

The in-process or host-created state will not be available to subsequent invocations. FaaS functions have significant restrictions when it comes to the local state. Stateful backing service, typically a Database (e.g. S3, Redis) is required to store any data that needs to persist.

2) DoS (Denial of Service)

AWS Lambda, currently, limits you to 1000 concurrent executions you can be running of all your lambdas. Your whole AWS account has this limit, and If you try to load test while using the same AWS account for both production and test, you will accidentally cause DOS on your production.

3) Limited Execution Duration

Image showing Limited Time
Image Source

AWS Lambda functions are aborted if they run for longer than 5 minutes. Some tasks run for more than the given limit, like converting a video file format.

4) Startup Latency Issue

It may take a while for a FaaS function to respond, specially JVM-implemented functions on AWS. It may take more than 10 seconds to start up. API/micro-service will almost always be able to respond faster since it can keep connections to Databases and other things open and ready.

5) Testing Obstacles

Image of Integration Testing
Image Source

Unit testing Serverless Apps is simple for multiple reasons. There aren’t a lot of custom libraries or interfaces to implement. You just have to code. Integration testing is rather hard for Serverless Apps. At present most of the vendors do not provide a local implementation that you can use so you’re forced to use the regular production implementation.

This means for all your integration/acceptance tests in a Serverless Architecture, you would be deploying remotely and testing using remote systems. Less configuration, cross-account execution limits impact how you test.

6) Execution Challenges

Currently, the feature of bundling up a set of functions into an application is lacking. Since you would need to deploy a FaaS artifact separately for every function in your entire logical application. Deploying 20 FaaS functions on JVM means deploying your JAR 20 times. You can’t atomically deploy a group of functions. You have to turn off the event source that is triggering the functions, deploy the whole group, and then turn the event source back on.

Zero-downtime applications cannot afford this. There is no means to atomically roll back the applications as they are not versioned.

7) Monitoring and Debugging Limitations

At present, you are stuck on the monitoring and debugging side with whatever the vendor provides. It is very basic with AWS Lambda, which suits some cases but what we really need in this area are open APIs and the ability for third-party services to help out.

Pros of Serverless Architecture

1) Reduced Cost of Execution

One of the most appealing features of AWS Lambda functions is their low execution cost. You must pay for the server utilization in a standard web application with code hosted on – and accessible through – an EC2 instance in AWS, regardless of whether or not your API is really in use. Depending on the specifics of the instance you’re working with, the cost of idle time can be quite high.

You only pay for the computing costs that your code uses with AWS Lambda functions. Instead of a set cost depending on usage, AWS Lambda functions are invoiced by milliseconds of CPU time. You don’t have to worry about scaling your instance (most of the time – AWS does ask that you notify them of any significant changes in scale), nor do you have to worry about setting up an instance or web server. All of this is taken care of by AWS.

If your code is only active for an hour, you just pay for that hour, drastically lowering your execution costs. In addition, the first million (yes, one million) queries every month are free. You’ll never have to pay a dime if you never surpass a million requests (with certain transfer limits)!

2) Improved Application Resiliency

Another advantage of AWS Lambda is that your code can now be more resilient when running under stress and in less-than-ideal conditions. AWS stipulates that Lambda functions should be stateless, and you can make each call idempotent with some careful architecture. This allows you to delegate your application’s tasks to any number of handlers, each of which can utilize Lambda to perform your logic.

Because your app isn’t housed on a single server, you don’t have to rely on a single machine to handle all of the chores of providing your app and executing your code – if one goes down, AWS handles the swapping out seamlessly, and your code doesn’t miss a beat.

Cons of Serverless Architecture

1) No Control Over Environment

However, in exchange for this simplicity of execution and cost savings, you must relinquish control of your environment. While AWS Lambda functions run on Amazon Machine Instances (AMIs) and so use industry-standard tools for web and general development, you cannot customize the execution environment by installing custom packages or software. If your code has special operating system requirements, it may need to be changed — or hosted somewhere else entirely!

Furthermore, while AWS provides some important tools for maintaining consistency in the execution environment, you cannot expect the same environment for each execution. In other words, even if you are able to access the operating system, all of your changes may be lost when your function is run again.

Finally, you don’t have any say in how the instance is managed. Many Lambda functions, like containers, operate in a hot-cold mode. After a long time of inactivity, the first call to a function causes a slight delay while AWS spins up a machine instance for your function — this is known as a “cold function.” While this instance is retained for around 10 minutes after your code is executed (making the function a “hot function,” meaning it is immediately available without spinning up), your function will be subjected to the warmup period once again after that 10th minute. While there are some techniques to keep your functions “warm”, the spin-up costs cannot be avoided entirely.

2) More Complex Call Patterns

While increased resiliency and cost savings are substantial advantages, AWS Lambda’s design has the potential to increase the cost of your application’s design time. AWS Lambda functions are timed, with a three-second default timeout (it is configurable up to five minutes). This implies you’ll have to devote extra time to orchestrating and arranging your functions so they can work on your data in a distributed manner.

This isn’t a problem if your process is easily chunkable, such as video processing, but other jobs involving big amounts of data will tend to surpass the runtime constraints, requiring significant effort from your developers who will now have to rewrite the code in a different architecture. A conventional server-based application may handle this by creating a new microservice or just giving the object to the operating system, which would then invoke a bespoke tool. In AWS Lambda, these settings aren’t available.

Conclusion

This article provided a thorough discussion regarding the advantages and disadvantages of using a Serverless Architecture like AWS Lambda. Serverless Architecture is not the correct approach for every problem, so be wary of anyone who says it will replace all of our existing architectures. And be even more careful if you take the plunge into serverless systems now, especially in the FaaS realm.

While there are riches (of scaling and saved deployment effort) to be plundered, there exist dragons (of debugging, monitoring) lurking right around the next corner. Those benefits shouldn’t be quickly dismissed however since there are significant positive aspects to Serverless Architecture, including easier Operational management, Reduced Operational and Development costs.

The reduced feedback loop of creating new code components is the most important benefit of all. It is largely because there is a value in serving technology to the end-user as soon as possible to get early feedback. Also, the reduced time-to-market that comes with Serverless fits right with this philosophy.

Visit our Website to Explore Hevo

Now, AWS collection involves a lot of data collection and data transfer work which can be very tiresome and error-prone. Hevo Data, a No-code Data Pipeline can simplify your work as it allows you to transfer data from a source of your choice to any destination in a fully automated and secure manner without having to write code repeatedly. Hevo Data, with its strong integration with 100+ sources & BI tools, allows you to export, load, transform & enrich your data & make it analysis-ready in a jiffy. 

Want to take Hevo for a spin. Sign Up for 14 days free trial and experience the benefits! You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

Share your thoughts on Serverless Architecture and AWS Lambda in the comments section.

No-code Data Pipeline For Your Data Warehouse