Amazon CloudWatch RUM New2021年〜
A real user monitoring service that collects client-side performance and error data from web applications
What It Does
Amazon CloudWatch RUM (Real User Monitoring) collects performance data and error information from real users' browsers as they interact with your web application. It captures metrics like page load times, JavaScript errors, HTTP errors, and Core Web Vitals (LCP, FID, CLS) in real time. It measures the actual performance users experience, which server-side monitoring alone cannot capture.
Use Cases
It is used to pinpoint which pages, browsers, and regions are affected when users report slow page loads. It is also used to monitor whether client-side JavaScript errors increase after deployments, and to continuously track Core Web Vitals scores to assess SEO impact.
Everyday Analogy
Think of it like a mystery shopper at a restaurant. Kitchen surveillance cameras (server-side monitoring) alone can't tell you what the actual dining experience is like. A mystery shopper (RUM) visits as a real customer and reports on wait times from ordering to food arrival, food temperature, and overall comfort - all from the customer's perspective.
What Is CloudWatch RUM?
Amazon CloudWatch RUM is a service for monitoring client-side performance of web applications. Traditional server-side monitoring can measure server response times but cannot capture browser rendering times or JavaScript execution times. RUM embeds a lightweight JavaScript snippet into your web pages and collects performance data directly from real users' browsers.
Data Collected
CloudWatch RUM collects page load performance (load time, TTFB, DOM construction time), JavaScript errors (unhandled exceptions, console errors), HTTP errors (4xx, 5xx responses), and Core Web Vitals (LCP, FID, CLS). This data is recorded along with browser type, OS, device type, and geographic location, enabling you to isolate issues like 'errors are spiking only for Chrome users on iOS.'
Integration with X-Ray
CloudWatch RUM integrates with AWS X-Ray to provide end-to-end tracing from the client side to the server side. You can visualize how a request originating in a user's browser traverses backend services like API Gateway, Lambda, and DynamoDB, and identify where latency occurs - all in a single trace. This enables unified analysis of both frontend and backend issues. For a deeper understanding of X-Ray integration, technical books on Amazon are a useful resource.
Getting Started
To get started with CloudWatch RUM, create an application monitor in the 'RUM' section of the CloudWatch console. Specify your application name and domain, and a JavaScript code snippet will be generated. Simply embed this snippet in the head tag of your web pages to start collecting data. You can configure the sampling rate to control what percentage of sessions are collected.
Things to Watch Out For
- RUM uses pay-per-data-event pricing. Setting the sampling rate to 100% can be costly, so set an appropriate rate based on your traffic volume
- Embedding the JavaScript snippet adds a slight overhead to page loading. The impact is minimal, but verify that the snippet loads asynchronously
- Collected data includes user IP addresses and geographic information, so consider mentioning RUM usage in your privacy policy