Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Examine AWS X-Ray for app performance management

AWS X-Ray gives developers a more detailed view of distributed and serverless applications. But if they want to use multiple clouds or other services, it's not a good fit.

In a distributed application, it's difficult to not only track and visualize dependencies between the different...

parts of the app but also to debug those apps. AWS X-Ray enables developers to track distributed and serverless applications in AWS and tie front-end metrics into back-end traces, giving them the ability to spot errors and pinpoint performance issues.

AWS X-Ray, which is now in general availability, works with applications that connect to Amazon DynamoDB, Amazon API Gateway, AWS Lambda and other external web services via APIs. The service helps developers spot errors and performance bottlenecks; it also ties into AWS software development kits (SDKs) to identify issues, such as low Amazon DynamoDB capacity for read or write operations. Essentially, the service creates a wrapper around APIs and other libraries that track use and timing metrics when pinging external services. It also tracks run times for specific tasks, functions or user requests.

AWS X-Ray evaluates the duration of Lambda functions that DynamoDB runs, which can be incredibly difficult to track down otherwise. With the service, developers can spot this type of bottleneck and increase DynamoDB capacity for effected tables or change the function code so they don't overload DynamoDB.

AWS X-Ray adds a special HTTP header to track a single transaction throughout multiple AWS tools and services.

AWS X-Ray adds a special HTTP header to track a single transaction throughout multiple AWS tools and services. This enables developers to identify the source of issues and performance bottlenecks. But make sure to pass through this header to connect to multiple endpoints.

AWS X-Ray works with popular web frameworks -- such as Express.js or Java 2 Platform, Enterprise Edition applications -- that run a server-based component to aggregate and deliver metrics. Additionally, the service supports Lambda-based functions, but this functionality is still in early beta.

Analyzing an X-Ray trace

The AWS Management Console displays traces in a visual format. A trace is a single execution of an application from end to end. A trace usually corresponds to a single user action, such as a request for a page load or uploading an image file. Traces span multiple Lambda functions, Elastic Compute Cloud instances or other Amazon services.

Debugging functions

When you add X-Ray tracing to your code, it relays an error if the X-Ray trace context is not fully set up. This can happen, for example, if the X-Ray daemon is not running locally, or if the X-Ray context has not been preconfigured within the application. This means if a developer tests code locally, the code could return an error similar to the following:

Error: Failed to get the current sub/segment from the context.

Set an environment variable to solve this problem. And instruct X-Ray to ignore any environment when it can't connect to the logging daemon:

AWS_XRAY_CONTEXT_MISSING=LOG_ERROR

This causes the system to log an error message and then continue. Without this environment variable, any application configured to use X-Ray will not run unless the service is present. This means that when developers test code locally -- without X-Ray enabled -- the application fails to run. Developers can configure X-Ray only on staging or production environments as a way to avoid this problem. With Node.js, the NODE_ENV environment variable determines this.

AWS' documentation does not describe how to enable X-Ray tracing. And, by default, AWS disables X-Ray tracing on all Lambda functions, which creates this error for each Lambda function with X-Ray code installed:

Segment marked as not sampled. Ignoring.

Select the Enable Active Tracing configuration option in the Advanced Settings section of the Lambda console to trace functions.

If the Lambda function has the X-Ray profiling code installed, developers will see results on the X-Ray console within a few minutes.

Application performance management options

Other vendors, such as New Relic or App Metrics, have similar services. AWS X-Ray, however, is priced lower than alternatives, and most developers likely won't ever pay for it anyway, as X-Ray's free tier of service includes up to 50,000 traces per month. However, AWS X-Ray does have problems -- mostly because it's still in early stages.

AWS X-Ray is designed to work with Amazon's services, so it won't automatically trace other cloud-provider services from Azure or Google. But developers can directly hit the X-Ray API as a workaround.

X-Ray is not tied into other services, such as user analytics or testing frameworks. It's also not very clear how to set up connections to dev/test environments, nor is it easy to quickly identify problems that don't trigger exceptions in code or run across multiple traces. Because the user interface is designed for developers, it can be clunky for other IT professionals to use. And while it's possible to tie in real user monitoring, that feature does not come out of the box, unlike other similar services. AWS X-Ray also requires some code modifications, which can just monitor functionality without modifying serverless code. These code changes further hamper cross-platform compatibility.

However, the X-Ray service does offer a number of benefits. Because it's an Amazon product, it's covered under AWS Support. And it integrates with other AWS tools and services, making it easy to diagnose performance problems, such as a DynamoDB provisioning issue.

The service natively wraps the AWS SDK, so it can trace calls to other services. But developers can also manually trace functions, if needed. And X-Ray offers native support for Lambda.

It's more difficult to use third-party tools -- at least for now. And developers working with Azure or Google Cloud can't easily use X-Ray in serverless functions -- only on server-based applications.

Next Steps

AWS X-Ray among host of native tools that offer better developer control

X-Ray, Lambda support among new AWS features

AWS lock-in risks reduced with third-party monitoring tools

This was last published in June 2017

Dig Deeper on AWS CloudWatch and application performance monitoring

PRO+

Content

Find more PRO+ content and other member only offers, here.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What tools do you use to visually track AWS application performance?
Cancel

-ADS BY GOOGLE

SearchCloudApplications

TheServerSide

SearchSoftwareQuality

SearchCloudComputing

Close