Top

N|Solid for AWS Lambda

N|Solid for AWS Lambda

N|Solid for AWS Lambda is a new solution for monitoring the performance and behavior of serverless functions running on Amazon Web Services (AWS) Lambda. Developers and DevOps teams working on serverless applications can now deploy NodeSource’s enhanced Node.js runtime to capture and analyze highly precise, in-depth and overhead free performance metrics.

Getting Started

N|Solid for AWS Lambda provides low-impact performance monitoring for Lambda functions. Users who install the N|Solid runtime as a Lambda Layer can choose between versions based on the Node.js 8 (Carbon) and 10 (Dubnium) LTS release lines, and it takes just a few minutes to get up and running. In order to get started, you will need:

  1. A NodeSource Account - if you don’t already have one you can sign up here.
  2. Access to an AWS Accounts
  3. Access to the AWS Lambda Suite
  4. The N|Solid Layer ARN
  1. Log in to your AWS Account

Visit https://aws.amazon.com/ to log in or sign up.

AWS Signup

  1. Navigate to the Lambda Console

AWS Lambda Suite

  1. In your AWS account choose the Create function option.

Select Use custom runtime in function code or layer in the Runtime settings dropdown:

AWS Lambda Custom

After your function is created, in the function's Designer, there is a box labeled Layers. Click the box, then navigate to the section below labeled Referenced layers. Click the Add a layer button, then select the Provide a layer version ARN option.

AWS Lambda Layer

In order to proceed, you'll need to get some information associated with your NodeSource Account.

  1. In a new tab or window, log in to your NodeSource Account

Visit https://accounts.nodesource.com and create a new account or to log in to an existing NodeSource account.

Accounts Sign-in

You may see a prompt to Create Organization at this stage. While you may find this helpful if you want to invite colleagues to the platform, it’s not a requirement, and you’ll have the ability to create an Org at any point in the future. Feel free to choose the Go it alone option.

Accounts Create Org

  1. If you've started a trial, you can proceed with the following steps using either your Personal or Organization workspace.

Accounts Switch Org

  1. Once signed in, you will be redirected to the Download & Setup page.

Accounts Downloads

Select the N|Solid for AWS Lambda installation type.

  1. The install instructions feature a series of selectors, allowing you to choose your preferred AWS region and Node.js version.

Accounts Lambda Instructions

Modifying the selected region or Node.js version will modify the ARN provided to you, so please double-check to ensure you that you’ve chosen the options suitable for you. Copy the provided ARN and return to your Lambda console. Paste the ARN into the Layer version ARN field and click Add layer version.

  1. After your Lambda function has been created successfully, return to your NodeSource Accounts tab to copy your unique N|Solid license key.

Accounts Lambda Instructions

  1. Return to the AWS Lambda console and click your function name in the Designer section. Find the Environment variables section below and create a new custom variable named NSOLID_LICENSE_KEY. Paste in your N|Solid license key as the value for this variable.

Accounts Lambda Instructions

Adding your N|Solid license key as an environment variable connects performance data from your running Lambda functions to your NodeSource Account.

  1. After your newly-created function starts running, navigate to https://app.nodesource.com to confirm that data from your Lambda function is being displayed in the dashboard.

FAQ

Why aren’t my AWS Lambda functions sending data?

A No Functions Connected error likely means that your function was unable to connect to our dashboard, or that it’s connected but the function isn’t currently running. Please revisit the Getting Started instructions above and check your CloudWatch logs for errors. If you’ve verified that your function is running, and you are certain that you followed the steps above, please contact our support team here for further assistance.

Lambda No Functions Connected

I saw Could not verify your NodeSource license key, usage metrics will not be reported. in CloudWatch, what does it mean?

Lambda needs to use a valid NodeSource license key in order to communicate with NodeSource services and report metrics to your dashboard. Ensure that your network policy allows connectivity to our network, and that the NSOLID_LICENSE_KEY environment variable you set in your Lambda function exactly matches the key found in your account or organization profile settings.

Is there any cost to use N|Solid for AWS Lambda?

No. N|Solid for AWS Lambda is a new NodeSource offering, and at time of launch is free to use. We plan to continue improving this product offering, and we may offer paid tiers for access to more advanced features in the future. In the meantime, we hope users take this opportunity to explore our new offering at no cost!

What is this histogram thing, and how do I use it?

The histogram provides a high level overview of your function's invocation performance over time. It represents invocation density for a single function over the most recent period and gives you a visual indicator of its health and usage.

More information on how to interpret Histogram data is available here

Lambda Histogram

What is the expected performance impact of using N|Solid for AWS Lambda?

The N|Solid runtime is built for monitoring applications with a minimal performance impact. Unlike many conventional solutions, the N|Solid agent, which samples performance metrics deep within the runtime itself, reports data via a separate thread. While we constantly evolve our product to decrease overhead, here is what you can expect:

  • 50ms average call time to NodeSource's metrics API. Data reporting takes place outside the Lambda handler, and metrics reported to our API as quickly as possible to reduce execution time. Reporting will not delay the completion of the function from the caller's perspective.

  • Invocations that produce a CPU profile will consume slightly more CPU and memory than ordinary invocations. Your function configuration needs to allow for this additional memory usage, which should render sampled invocation overhead negligible. CPU profiles are generated for the first invocation each minute and 1% of invocations thereafter.

How long do you keep my data?

Data from Lambda functions will be displayed in the N|Solid console for a maximum of 24 hours. Please contact us if your team needs a longer retention window.

Do you offer a version of the N|Solid runtime corresponding to my current Node.js version?

Users who install the N|Solid Runtime as a Lambda Layer can choose between versions based on the Node.js 10 (Dubnium) and 8 (Carbon) LTS release lines.

How do I keep my runtime version up-to-date?

When a new version of the N|Solid runtime is available, your dashboard will alert you to its availability. To update, you can obtain the newest N|Solid ARN from the N|Solid for AWS Lambda Setup page and simply replace your current runtime Layer with the new one using the AWS Lambda console or the command line.

Monitoring Lambda Performance

Monitoring your Lambda Functions

After you’ve completed the setup steps to install the N|Solid runtime as a Layer on AWS Lambda, performance data will be sent to the NodeSource dashboard. Reported metrics include function-specific execution times, cold start and error metrics, and additional indicators to help users identify and debug anomalous behavior.

The Dashboard

The NodeSource Dashboard provides you with a centralized view to monitor the performance of your AWS Lambda functions. Performance data captured from your AWS Lambda functions will be displayed on this screen once you’ve completed the setup and configuration steps.

Lambda Dashboard

Function List

The left side panel lists all of connected Lambda functions, and can be sorted by function name, invocation rate, execution time, or error percentage. Should you have trouble viewing your functions' metrics, please revisit the install instructions above.

The following high-level metrics are presented alongside each function listed in the left side panel:

  • Invk Rate: Number of times the function has been invoked per minute.
  • Average Time: Average execution time in milliseconds.
  • Error Percentage: Average percentage of functions terminating due to an error.

Function Details

Click on a function listed in the left side panel to see detailed invocation metrics, including:

  • A histogram providing insight into your function’s invocation metrics, observed error states, and cold starts
  • A list of each invocation of that function within the selected time period.

Histogram

The histogram provides a high-level overview of your function's invocation performance over time:

Lambda Histogram

The histogram header component provides aggregate performance statistics and indicators, including:

  • Total: Total number of function invocations.
  • Invoke Rate: Number of function invocations per minute.
  • Average Time: Execution time milliseconds averaged over all function invocations.
  • Errors: Number of times a function invocation exited.
  • Cold Starts: Number of cold starts that occured when a Lambda function spun up.

Understanding the Histogram Visualization

The histogram visualization presents information about the performance of your Lambda functions.

Invocation buckets are presented in the histogram as shaded rectangles (cells) of varying color density.

  • The position of a bucket along the X-Axis indicates the time period in which activity took place.
  • The position of a bucket on the Y-Axis indicates the invocation duration in milliseconds.
  • A bucket's color density indicates the relative number of invocations which for a given X,Y position.

Each colored bar represents a tracked function execution within the selected time period.

  • Red bars indicate an Error. Clicking on the bucket containing the error line allows you to filter the invocation list; you can also sort by error type
  • Blue bars indicate a cold start.

Annotated Histogram

Invocations List

You will be shown a list of all invocations that fall into the chosen time period of either 24h, 12h, or 1h, accompanied with extra invocation details. Change the selected time-period at the top of the left-side functions list via the Period selector.

Lambda Invocation List

The Invocations list includes the following columns:

  • Invoked: Time and date the function was invoked.
  • Duration: Duration for which the function ran.
  • Version: This displays the Node.js version the function is running on.
  • Error: Indicator whether an error has occurred or not.
  • Profile: Your N|Solid Runtime Layer which executes your code on AWS Lambda dynamically samples a minimum of 1 invocation / minute and 1% of invocations thereafter.

Items in the Invocations list can be sorted by their respective values for any visible column.

Additionally, you can filter both the invocations list and the histogram visualization for the following attributes:

  • Has CPU profile
  • Has cold starts
  • Has errors

Additional Tips

Click on the Error button to see detailed information, including a stack trace if you return an error object

Lambda Error Details

You can view individual CPU profiles by clicking on the view button contained in a sampled functions profile column. Once clicked you will be redirected to a time-domain graph containing a CPU profile.

CPU profiles are visualized with a time domain graph for easier inspection. Clicking on any horizontal bar in the CPU profile stack will let you observe that components in isolation.

Lambda Domain Graph