Brian Jackson - Fotolia


AWS Lambda architecture presents cost savings, tradeoffs

AWS Lambda can reduce infrastructure and cloud costs if implemented properly, but that means accepting some drawbacks of the serverless computing service.

AWS Lambda opened up new architectural patterns for enterprises to explore, enabling more efficiency with leaner code bases. The serverless service promises to reduce administration overhead, streamline application configuration and provide cost savings for a variety of use cases, according to experts at the O'Reilly Software Architecture Conference in San Francisco.

In some ways, Lambda is part of the overall evolution of cloud architectures. Developers can focus on code while AWS handles the triggers, provisioning servers and application scaling.

Lambda also touts several business benefits, as serverless computing requires less maintenance, reduces costs, provides unlimited parallelism and minimizes administrative overhead. Developers can use AWS Lambda functions to schedule and scale batch jobs. Commonly, a batch job reads a large amount of data and then processes each row serially. An AWS Lambda architecture makes it possible to spin up a different function for each item to quickly complete the job. An enterprise can even build apps with an AWS Lambda architecture that handles one billion events per day.

Enterprises can reduce labors costs by eliminating many of the steps in traditional application deployment. Serverless functions don't require an OS management; developers no longer have to think about using Ansible, Puppet or Chef. But while serverless requires less effort, that doesn't mean technical operations work vanishes entirely. There still ops -- it's just not SysAdmin. A serverless architecture scales effortlessly. In traditional systems with Elastic Compute Cloud, enterprises can use Auto Scaling, but that requires setup work.

A serverless architecture promises shorter lead times for simple applications. In a traditional architecture, developers create the project, code the HTTP handler and application logic, provision a server, set up the server OS, set up security and networking, and then deploy the app. With an AWS Lambda architecture, developers only need to code the application logic, configure the API gateway and deploy the code; this can all happen in a few minutes. 

Improved cost structure for many apps

For small cases with hundreds of servers kicking around, an enterprise might get a 99% cost reduction with Lambda.
Derek Ashmoremanaging partner, Break the Monolith

An AWS Lambda architecture offers a cost advantage, said Derek Ashmore, managing partner at Break the Monolith, an IT consultancy, and author of Microservices for Java EE Architects. Amazon's introductory pricing schedule encourages adoption, as AWS currently offers a free tier with 1 million executions allowed per month.

Some common use cases, according to Ashmore, include image processing or batch processing to update records. It's well-suited for low-volume websites. "If you have a low-volume website, you might want higher volumes some day and functionality that is infrequently executed in Lambda is a much cheaper way to host it," Ashmore added.

AWS Lambda functions are billed in 100-ms increments. Roberts estimates that an app with one 200-ms request per minute would cost about $1.75 per year, compared to $245 for an m1.small instance at reserved pricing. It could even be free, depending on the cost tier.

Mike Roberts, co-founder of Acanthus, an IT consultancy specializing in microservices, knows of some startups that have reduced their Lambda bills to zero. "This is a deliberately small case, but for small cases with hundreds of servers kicking around, an enterprise might get a 99% cost reduction with Lambda," he said.

AWS Lambda functions can allow enterprises to get higher utilization out of consumer-facing web servers. For example, if an enterprise had a server with a peak load of 75%, it might spend about $841 per year on an M3 instance at reserved pricing. With Lambda, it might be looking at about $557 per year for the same rate of transactions.

Mind Lambda limitations

In many cases, it is a benefit not to have to define a VM. But some developers want to be able to tune the OS to improve performance. State-dependent optimizations are not easy on Lambda, and there are memory and time limits on Lambda function execution.

In addition, Lambda doesn't support connection pooling, sessions or caching. One good practice to address these issues is to separate Lambda code from business logic. It's a good practice to invoke other Lambda functions through the Amazon API Gateway. Developers can use request ID to associate specific messages with specific actions, making it easier to debug applications.

But despite its benefits, few enterprises want to move their entire application infrastructures to an AWS Lambda architecture. It's merely one tool that's suited for specific use cases. Developers may prototype a serverless architecture and then decide later if they need to move parts of the service onto a platform as a service or into containers.

Next Steps

At re:Invent, AWS unveils new developer tools

Here's how early adopters are navigating AWS Lambda cost management challenges 

With Lambda, developers take the good with the bad

Dig Deeper on AWS Lambda