Enhancing Lambda Performance and Optimising Costs

Introduction

In the ever-evolving landscape of digital banking, LiveOak Bank, a cloud-based bank serving small business owners across all 50 US states, stands out with its mission to be America’s small business bank. As part of a family of companies under the parent company Live Oak Bancshares (Nasdaq: LOB), they continually strive to redefine banking through a groundbreaking focus on service and technology.

Success Case: Lambda Improvements

Recently, our team at LiveOak conducted a comprehensive review of their Lambda implementations. The majority of their infrastructure is built around Lambda, AWS’s serverless computing service, handling various functions to ensure seamless operations for their clients.

Our team identified areas for improvement and implemented a set of strategic changes, resulting in noteworthy enhancements.

1. Improved Variables Initialisation and Re-use

Recognising the impact of external variables on function handler performance, our team initiated the practice of moving such variables outside of the function handler. Things like the Database initialisation, or libraries loading context can lead into additional time and CPU consumption of the handler. Following the recommended guidelines outlined in the official AWS Lambda documentation on optimising static initialization, the team achieved a significant reduction in time and CPU consumption during execution.

2. Smaller Dependencies for Package Size Reduction

Understanding the importance of minimising the deployable package size, the team employed  different techniques like tree shaking and npm deduplication to get smaller dependencies.
This optimisation strategy is particularly crucial for languages like Python or Node.js, known for their extensive dependency trees. By deploying only the necessary dependencies in the production environment, we achieved a much better performance when loading the Lambda functions.

Lambda Layers for Dependency Sharing

To address the need for shared dependencies across different functions, the team leveraged Lambda layers. This approach involves adding a layer to a function containing libraries with useful functionalities to perform the different tasks. The content is extracted into the /opt directory, which is accessible within the function’s execution environment, improving efficiency and dependency management.

We measured the results and noticed around a 30% improvement for cold starts:

Outcomes & Benefits

The efforts put forth by our LiveOak Bank team resulted in significant positive outcomes and benefits: :

  • Recognition as a Tech Partner by LOB: The Lambda improvements showcased during our team’s first demonstration positioned Parser as a technology partner within the LiveOak Bank family of companies.
  • Average Response Time Reduction: In collaboration with a concurrency fix LiveOak team, we observed a remarkable 58% reduction in the average response time. This directly contributed to an enhanced user experience and operational efficiency.
  • Cost Reduction in AWS Serverless Implementation: Leveraging Lambda’s cost structure based on compute time, the faster response time achieved by our team’s optimisations translated into reduced AWS implementation costs. 

In conclusion, the successful Lambda improvements at LiveOak Bank exemplify Parser’s client commitment to help them stay at the forefront of technology, ensuring optimal performance, and delivering an unparalleled experience for their customers.