惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
C
Check Point Blog
博客园_首页
B
Blog
D
Docker
U
Unit 42
量子位
I
InfoQ
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler
GbyAI
GbyAI
L
LangChain Blog
云风的 BLOG
云风的 BLOG
博客园 - Franky
美团技术团队
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
Vercel News
Vercel News
Recent Announcements
Recent Announcements
雷峰网
雷峰网
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Google DeepMind News
Google DeepMind News

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis
Monitor ProxySQL with Datadog
Jordan Obey · 2020-05-05 · via Datadog | The Monitor blog

ProxySQL is a MySQL/MariaDB protocol–compliant load balancer and reverse proxy with native support for a range of popular backends including ClickHouse, Amazon Aurora, and Amazon RDS. ProxySQL efficiently distributes queries to your database servers and caches results, improving resource management and boosting database performance. You can also configure ProxySQL for high availability to reduce downtime.

Because ProxySQL is the primary gateway for queries to your database, it’s important to monitor it carefully. If ProxySQL performs poorly, you’ll see increased latency and performance degradation across the parts of your stack that depend on it. With Datadog’s integration, you can ensure ProxySQL continues running smoothly by visualizing, monitoring, and alerting on dozens of key metrics like memory usage and query throughput. Those metrics are included in our out-of-the-box ProxySQL dashboard to make it easy to track the performance and resource usage of your proxy.

an out-of-the-box ProxySQL dashboard

Keep track of ProxySQL query cache efficiency

ProxySQL is commonly used as a query cache to expedite transactions between clients and your database servers. You can enable query caching by providing a value (in milliseconds) for the cache_ttl property in ProxySQL’s mysql_query_rules#mysql_query_rules)). ProxySQL will store results of queries for that time period. If it later receives the same query, it can quickly return those cached results instead of retrieving them from the database (which can be time intensive).

Monitoring metrics related to your query cache can help you verify that it is optimizing performance and that ProxySQL is running as expected. Datadog’s ProxySQL integration provides you with the resource and performance metrics you need to ensure the query cache works efficiently.

Correlate cache reads and writes

For any cache, you’ll want to verify that reads from it and writes to it are successful. With Datadog, you can monitor your cache read success rate by graphing the count of cache reads that were successful (proxsql.query_cache.get_ok.count) divided by the total amount of cache reads (proxysql.query_cache.get.count).

proxysql_01v2

You can also correlate incoming writes (proxysql.query_cache.set.count) with the number of entries currently stored in the cache (proxysql.query_cache.entries) to see how effectively data is being written/updated to your cache. If you see a discrepancy (e.g., few entries in your query cache despite a high number of writes), it means data is not being properly written to your query cache and could mean your ProxySQL instances are misconfigured, or indicate a larger problem that needs your attention.

Ensure loads are balanced correctly

Monitoring ProxySQL is important because, as load balancer, it is meant to evenly distribute workloads among backend servers. If a subset of your backend servers become overwhelmed with a higher volume of requests, they can become unstable and fail, which can lead to higher application latency or even downtime. You can use the proxysql.pool.queries metric to track the number of queries routed toward each connected backend server (identified by the tags srv_host and srv_post). You can then use a toplist (shown in the image below) to see if any backends are overtaxed, letting you know when to reconfigure query rules to better route traffic or whether to take other steps to troubleshoot.

proxysql_02

Verify ProxySQL is connected to clients and servers

Because ProxySQL is a gateway between MySQL/MariaDB servers and clients, you will want to make sure it maintains its connections to both. Once you’ve enabled the ProxySQL integration, the Datadog Agent will start collecting both client and server connection metrics like the number of connection creations and failures per second so you can ensure ProxySQL has healthy connections and performs as expected. You can use anomaly detection to alert you to any unexpected drops or spikes in either aborted client or server connections so you can start troubleshooting immediately.

proxysql_03

Monitor the rate of slow queries

One critical metric to pay close attention to as you monitor ProxySQL is its rate of slow queries (proxysql.slow_queries) per second. Slow queries (i.e., a query that takes longer than the ProxySQL global variable mysql-long_query_time to execute) can negatively affect the performance of your database and lead to excessive resource usage because ProxySQL needs more CPU and memory to execute them. You can graph the rate of slow queries in your dashboard and set up an alert to notify you if it exceeds a given threshold. If you are notified of a high rate of slow queries you can investigate, for example, by collecting slow query logs from your MySQL backend to see which queries you need to optimize.

Start monitoring ProxySQL with Datadog

Datadog’s new integration means you can easily monitor the health and performance of your ProxySQL load balancers and ensure that queries to your backend databases are being served efficiently. In addition to the 1,000+ technologies integrated with Datadog, you can monitor ProxySQL alongside your backend database, whether you’re using MySQL or MariaDB, ClickHouse DB, or Amazon RDS.

If you’d like to start using Datadog, you can sign up today for a 14-day free trial.