{"value":"[Amazon DevOps Guru for RDS](https://aws.amazon.com/devops-guru/features/devops-guru-for-rds/)is a new capability for [Amazon DevOps Guru](https://aws.amazon.com/devops-guru/) that helps developers using [Amazon Aurora](https://aws.amazon.com/cn/rds/aurora/?trk=cndc-detail) database instances detect, diagnose, and resolve database performance issues fast and at scale. DevOps Guru for RDS uses machine learning (ML) to automatically identify and analyze a wide range of performance-related database issues, such as over-utilization of host resources, database bottlenecks, or misbehavior of SQL queries. When an issue is detected, DevOps Guru for RDS displays the finding on the DevOps Guru console and sends notifications using [Amazon EventBridge or Amazon Simple Notification Service](https://aws.amazon.com/sns/) ([Amazon SNS](https://aws.amazon.com/cn/sns/?trk=cndc-detail)).\n\nThis new feature of DevOps Guru runs on a standalone system that continuously monitors and detects anomalies based on the [database load](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html) (DB load) metric, which is collected by [Amazon RDS Performance Insights](https://aws.amazon.com/rds/performance-insights/). When an anomaly is detected, the system triggers an in-depth analysis on other performance metrics such as database wait events and top database queries in order to provide insightful diagnosis of the issue. Additionally, the system generates useful recommendations to help you resolve the issues that caused the anomaly.\n\nIn this post, we go into details of how DevOps Guru for RDS works, with a specific focus on its scalability, security, and availability.\n\n\n#### **System architecture**\n\n\nLet’s look at the components of the system, as shown in the following diagram. When Performance Insights is enabled on an RDS instance, a lightweight agent continually samples the instance’s performance metrics from the database instance and forwards the encrypted metrics to [Amazon Kinesis Data Streams](https://aws.amazon.com/kinesis/data-streams/). The system relies on [Amazon Kinesis](https://aws.amazon.com/kinesis/) for processing and analyzing real-time, streaming data at large scales. If DevOps Guru is enabled on the database instance, some of the non-sensitive performance metrics are then forwarded to DevOps Guru for processing.\n\n![image.png](https://dev-media.amazoncloud.cn/ebb6d64d26c74c54a60c4319e1068bf6_image.png)\n\nCellular architectures have become a common pattern at Amazon Web Services. The primary objective of a cell-based architecture is to minimize the blast radius of failures. Failures come in many forms, for example, software bugs, infrastructure failures, or operational mistakes. Cell-based architectures help contain failures to a single cell instead of affecting the entire Region. The other objective of cell-based architectures is the ability for the system to horizontally scale out while maintaining maximally sized components that can easily be performance tested. DevOps Guru for RDS divides the system into cells, where each cell is an isolated unit that is responsible for handling only a percentage of database instances in a given Region. As the fleet of DevOps Guru-enabled database instances in a Region grows, a new cell can be added to handle the increase in load.\n\nEach Kinesis data stream in a DevOps Guru for RDS cell is partitioned by a Region-unique, immutable identifier for the database instance, [DBiResourceId](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DBInstance.html),and contains all the metrics that DevOps Guru for RDS needs, sorted by collection timestamp. Because it’s a Region-unique, immutable identifier, DBiResourceId serves as an ideal Kinesis partition key to collect metrics throughout the lifecycle of the database instance. These performance metrics are collected at a per-second granularity, but the DevOps Guru for RDS anomaly detection component prefers per-minute data in order to reduce the cost of performing anomaly detection. Therefore, the system uses an [Amazon Web Services Lambda tumbling window setup](http://aws.amazon.com/lambda) aggregate metrics per minute and forward only the aggregated statistics like the sum, average, and counts to the anomaly detection component.\n\nThe primary metric used to detect anomalies is [database load](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html) (DB load). DB load measures the level of activity in the database, making it a great metric to understand the health of the database instance. If the DB load is above the max vCPU line, this could indicate that the database instance is oversubscribed and having performance issues. However, relational database loads are often periodic, such as high spikes of DB load owing to a weekly batch reporting job. Such spikes of DB load are expected, and therefore are (a lot) less relevant to alarm on. To reduce false positives, the ML algorithm is trained to identify and ignore such regular patterns in the DB load. For example, consider the following sample DB load graph for a database instance. The DB load spikes in yellow are considered periodic and expected, even though some of the spikes are a lot higher (more than three times) than the max vCPU. However, the DB load spikes in red are not expected and therefore are detected by the ML algorithm as anomalous.\n\n![image.png](https://dev-media.amazoncloud.cn/07772f8b21af43bfa16699faac1f918e_image.png)\n\nThe ML algorithm is deployed on Lambda, which is configured to synchronously process batched records from the Kinesis data stream using the native [Lambda and Kinesis integration](https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html). The ML algorithm requires a sliding window of recent DB load history of the database instance as input. This data is cached in [Amazon Simple Storage Service](https://aws.amazon.com/cn/s3/?trk=cndc-detail) ([Amazon S3](https://aws.amazon.com/cn/s3/?trk=cndc-detail)) because the data is large (over 400 KB) and [Amazon S3](https://aws.amazon.com/cn/s3/?trk=cndc-detail) offers a low-latency, low-cost, highly available, and easy-to-use solution.\n\nWhen a DB load anomaly is detected, the system gathers more data to determine the contributing top SQL queries and database wait events. [Wait events](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Reference.html#AuroraMySQL.Reference.Waitevents) describe the exact conditions a particular database session is waiting for. The most common wait event types are waiting for the CPU, waiting for a read or write, or waiting for a locked resource. Examining wait events help identify contention for system or database resources. Data about the anomaly is analyzed based on rules and best practices curated from the collective experience of [Amazon RDS](https://aws.amazon.com/cn/rds/?trk=cndc-detail) database engineers. The result of this analysis are recommendations that help you diagnose and fix the issue.\n\nAfter generating recommendations, all anomaly details are forwarded to DevOps Guru. DevOps Guru further aggregates the anomaly details and groups them with other anomalies in your application (if any) before surfacing the anomalies to you as [reactive insights](https://docs.aws.amazon.com/devops-guru/latest/userguide/working-with-rds.analyzing.insights.html) via the DevOps Guru console and APIs.\n\n![image.png](https://dev-media.amazoncloud.cn/054b2ca54bad4374826f23b5f37f9c72_image.png)\n\n\n\n#### **Conclusion**\n\n\nWe are excited about how DevOps Guru for RDS will help you diagnose and resolve database performance problems. We hope this post helped you understand how our architecture addresses the core requirements of scalability, security, and availability.\n\nFor more information on how to get started with this new capability of DevOps Guru, see[ New – Amazon DevOps Guru for RDS to Detect, Diagnose, and Resolve Amazon Aurora-Related Issues using ML](https://aws.amazon.com/blogs/aws/new-amazon-devops-guru-for-rds-to-detect-diagnose-and-resolve-amazon-aurora-related-issues-using-ml/).\n\n\n\n#### **About the Author**\n\n\n\n![image.png](https://dev-media.amazoncloud.cn/7d6440fa0ef04fcdaac39b0a6313d064_image.png)\n\n**Vikas Lokesh** is a Software Development Engineer in RDS at Amazon Web Services","render":"<p><a href=\\"https://aws.amazon.com/devops-guru/features/devops-guru-for-rds/\\" target=\\"_blank\\">Amazon DevOps Guru for RDS</a>is a new capability for <a href=\\"https://aws.amazon.com/devops-guru/\\" target=\\"_blank\\">Amazon DevOps Guru</a> that helps developers using [Amazon Aurora](https://aws.amazon.com/cn/rds/aurora/?trk=cndc-detail) database instances detect, diagnose, and resolve database performance issues fast and at scale. DevOps Guru for RDS uses machine learning (ML) to automatically identify and analyze a wide range of performance-related database issues, such as over-utilization of host resources, database bottlenecks, or misbehavior of SQL queries. When an issue is detected, DevOps Guru for RDS displays the finding on the DevOps Guru console and sends notifications using <a href=\\"https://aws.amazon.com/sns/\\" target=\\"_blank\\">Amazon EventBridge or Amazon Simple Notification Service</a> ([Amazon SNS](https://aws.amazon.com/cn/sns/?trk=cndc-detail)).</p>\\n<p>This new feature of DevOps Guru runs on a standalone system that continuously monitors and detects anomalies based on the <a href=\\"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html\\" target=\\"_blank\\">database load</a> (DB load) metric, which is collected by <a href=\\"https://aws.amazon.com/rds/performance-insights/\\" target=\\"_blank\\">Amazon RDS Performance Insights</a>. When an anomaly is detected, the system triggers an in-depth analysis on other performance metrics such as database wait events and top database queries in order to provide insightful diagnosis of the issue. Additionally, the system generates useful recommendations to help you resolve the issues that caused the anomaly.</p>\\n<p>In this post, we go into details of how DevOps Guru for RDS works, with a specific focus on its scalability, security, and availability.</p>\n<h4><a id=\\"System_architecture_7\\"></a><strong>System architecture</strong></h4>\\n<p>Let’s look at the components of the system, as shown in the following diagram. When Performance Insights is enabled on an RDS instance, a lightweight agent continually samples the instance’s performance metrics from the database instance and forwards the encrypted metrics to <a href=\\"https://aws.amazon.com/kinesis/data-streams/\\" target=\\"_blank\\">Amazon Kinesis Data Streams</a>. The system relies on <a href=\\"https://aws.amazon.com/kinesis/\\" target=\\"_blank\\">Amazon Kinesis</a> for processing and analyzing real-time, streaming data at large scales. If DevOps Guru is enabled on the database instance, some of the non-sensitive performance metrics are then forwarded to DevOps Guru for processing.</p>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/ebb6d64d26c74c54a60c4319e1068bf6_image.png\\" alt=\\"image.png\\" /></p>\n<p>Cellular architectures have become a common pattern at Amazon Web Services. The primary objective of a cell-based architecture is to minimize the blast radius of failures. Failures come in many forms, for example, software bugs, infrastructure failures, or operational mistakes. Cell-based architectures help contain failures to a single cell instead of affecting the entire Region. The other objective of cell-based architectures is the ability for the system to horizontally scale out while maintaining maximally sized components that can easily be performance tested. DevOps Guru for RDS divides the system into cells, where each cell is an isolated unit that is responsible for handling only a percentage of database instances in a given Region. As the fleet of DevOps Guru-enabled database instances in a Region grows, a new cell can be added to handle the increase in load.</p>\n<p>Each Kinesis data stream in a DevOps Guru for RDS cell is partitioned by a Region-unique, immutable identifier for the database instance, <a href=\\"https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DBInstance.html\\" target=\\"_blank\\">DBiResourceId</a>,and contains all the metrics that DevOps Guru for RDS needs, sorted by collection timestamp. Because it’s a Region-unique, immutable identifier, DBiResourceId serves as an ideal Kinesis partition key to collect metrics throughout the lifecycle of the database instance. These performance metrics are collected at a per-second granularity, but the DevOps Guru for RDS anomaly detection component prefers per-minute data in order to reduce the cost of performing anomaly detection. Therefore, the system uses an <a href=\\"http://aws.amazon.com/lambda\\" target=\\"_blank\\">Amazon Web Services Lambda tumbling window setup</a> aggregate metrics per minute and forward only the aggregated statistics like the sum, average, and counts to the anomaly detection component.</p>\\n<p>The primary metric used to detect anomalies is <a href=\\"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html\\" target=\\"_blank\\">database load</a> (DB load). DB load measures the level of activity in the database, making it a great metric to understand the health of the database instance. If the DB load is above the max vCPU line, this could indicate that the database instance is oversubscribed and having performance issues. However, relational database loads are often periodic, such as high spikes of DB load owing to a weekly batch reporting job. Such spikes of DB load are expected, and therefore are (a lot) less relevant to alarm on. To reduce false positives, the ML algorithm is trained to identify and ignore such regular patterns in the DB load. For example, consider the following sample DB load graph for a database instance. The DB load spikes in yellow are considered periodic and expected, even though some of the spikes are a lot higher (more than three times) than the max vCPU. However, the DB load spikes in red are not expected and therefore are detected by the ML algorithm as anomalous.</p>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/07772f8b21af43bfa16699faac1f918e_image.png\\" alt=\\"image.png\\" /></p>\n<p>The ML algorithm is deployed on Lambda, which is configured to synchronously process batched records from the Kinesis data stream using the native <a href=\\"https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html\\" target=\\"_blank\\">Lambda and Kinesis integration</a>. The ML algorithm requires a sliding window of recent DB load history of the database instance as input. This data is cached in [Amazon Simple Storage Service](https://aws.amazon.com/cn/s3/?trk=cndc-detail) ([Amazon S3](https://aws.amazon.com/cn/s3/?trk=cndc-detail)) because the data is large (over 400 KB) and [Amazon S3](https://aws.amazon.com/cn/s3/?trk=cndc-detail) offers a low-latency, low-cost, highly available, and easy-to-use solution.</p>\\n<p>When a DB load anomaly is detected, the system gathers more data to determine the contributing top SQL queries and database wait events. <a href=\\"https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Reference.html#AuroraMySQL.Reference.Waitevents\\" target=\\"_blank\\">Wait events</a> describe the exact conditions a particular database session is waiting for. The most common wait event types are waiting for the CPU, waiting for a read or write, or waiting for a locked resource. Examining wait events help identify contention for system or database resources. Data about the anomaly is analyzed based on rules and best practices curated from the collective experience of [Amazon RDS](https://aws.amazon.com/cn/rds/?trk=cndc-detail) database engineers. The result of this analysis are recommendations that help you diagnose and fix the issue.</p>\\n<p>After generating recommendations, all anomaly details are forwarded to DevOps Guru. DevOps Guru further aggregates the anomaly details and groups them with other anomalies in your application (if any) before surfacing the anomalies to you as <a href=\\"https://docs.aws.amazon.com/devops-guru/latest/userguide/working-with-rds.analyzing.insights.html\\" target=\\"_blank\\">reactive insights</a> via the DevOps Guru console and APIs.</p>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/054b2ca54bad4374826f23b5f37f9c72_image.png\\" alt=\\"image.png\\" /></p>\n<h4><a id=\\"Conclusion_32\\"></a><strong>Conclusion</strong></h4>\\n<p>We are excited about how DevOps Guru for RDS will help you diagnose and resolve database performance problems. We hope this post helped you understand how our architecture addresses the core requirements of scalability, security, and availability.</p>\n<p>For more information on how to get started with this new capability of DevOps Guru, see<a href=\\"https://aws.amazon.com/blogs/aws/new-amazon-devops-guru-for-rds-to-detect-diagnose-and-resolve-amazon-aurora-related-issues-using-ml/\\" target=\\"_blank\\"> New – Amazon DevOps Guru for RDS to Detect, Diagnose, and Resolve Amazon Aurora-Related Issues using ML</a>.</p>\\n<h4><a id=\\"About_the_Author_41\\"></a><strong>About the Author</strong></h4>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/7d6440fa0ef04fcdaac39b0a6313d064_image.png\\" alt=\\"image.png\\" /></p>\n<p><strong>Vikas Lokesh</strong> is a Software Development Engineer in RDS at Amazon Web Services</p>\n"}