analyzer_首先看一下雅虎MySQL Performance Analyzer

analyzer

When you deploy an app to production servers, you may experience some database problems as your data grows. Some tools can help you debug and solve your problems, like MysqlTuner, Percona, etc. In this article, we’re going to explore the Yahoo MySql performance analyzer and see what the main features are.

将应用程序部署到生产服务器时,随着数据的增长,您可能会遇到一些数据库问题。 一些工具可以帮助您调试和解决问题,例如MysqlTuner, Percona等。在本文中,我们将探索Yahoo MySql性能分析器,并查看主要功能。

Vector illustration of gauge with pointer in the red, indicating speed

安装 (Installation)

The analyzer uses SNMP when available, so it’s a good idea to have it installed on your database server.

分析器在可用时使用SNMP ,因此最好将它安装在数据库服务器上。

Because this is a JAVA application, make sure you have JDK installed before proceeding. It requires version 8 to run, but version 7 is fine since it doesn’t use any of version 8’s features. You can read more in the readme file in the repo.

由于这是一个JAVA应用程序,因此在继续操作之前,请确保已安装JDK。 它需要运行版本8,但是版本7可以使用,因为它不使用版本8的任何功能。 您可以在回购中的自述文件中阅读更多内容。

I have a demo application on my Vagrant box, and I will install the analyzer in the root of my application. Let’s start by logging into our machine using ssh and cloning the repository.

我在Vagrant盒子上有一个演示应用程序,并将分析器安装在应用程序的根目录中。 让我们首先使用ssh登录到我们的计算机并克隆存储库。

vagrant ssh
git clone git@github.com:yahoo/mysql_perf_analyzer.git myperf

To build the application, you need to run the mvn clean package command. After the build process is done, you’ll find a myperfserver-server.zip file under the perfJettyServer/target directory. Move that file to a new directory on your server and extract it. The resulting output contains start_myperf.sh and stop_myperf.sh scripts to manage the server. Let’s use the start script to launch the application. You can read more about the available options in the repo.

要构建该应用程序,您需要运行mvn clean package命令。 构建过程完成后,您将在perfJettyServer/target目录下找到一个myperfserver-server.zip文件。 将该文件移动到服务器上的新目录并解压缩。 结果输出包含用于管理服务器的start_myperf.shstop_myperf.sh脚本。 让我们使用启动脚本启动应用程序。 您可以阅读有关回购中可用选项的更多信息。

管理用户 (Managing Users)

After starting the server, open your browser using your machine hostname and the specified port (vaprobash.dev:9092/myperf). You can log in with the default admin account (username: myperf, password: change).

启动服务器后,使用计算机主机名和指定的端口( vaprobash.dev:9092/myperf )打开浏览器。 您可以使用默认管理员帐户登录(用户名:myperf,密码:change)。

The users management page can be accessed from the top left menu. It allows you to add, edit, delete and confirm users, and you can use it to change the default admin password.

可以从左上方的菜单访问用户管理页面。 它允许您添加,编辑,删除和确认用户,并且可以使用它来更改默认的管理员密码。

User management page

仪表板 (Dashboard)

The main dashboard shows the current status of your databases along with other details like CPU usage, running threads, dead locks, etc.

主仪表板显示数据库的当前状态以及其他详细信息,例如CPU使用率,运行线程,死锁等。

The second tab on the dashboard shows alerts from the last 24 hours. We will talk more about alerts and how to configure them later.

仪表板上的第二个选项卡显示最近24小时内的警报。 我们将在以后讨论更多有关警报以及如何配置它们的信息。

配置数据库组 (Configuring DB Groups)

To monitor a database or a set of databases, you can create a new database group from the top left menu and select DB Info. After filling the inputs you can visit the dashboard to see your databases status. You can restrict the database access to a certain group of users using the Access Control tab.

要监视一个数据库或一组数据库,可以从左上方的菜单创建一个新的数据库组,然后选择DB Info 。 填写完输入后,您可以访问仪表板以查看数据库状态。 您可以使用“ Access Control选项卡将数据库访问限制为特定的用户组。

Add DB Group

监控流程 (Monitoring Processes)

You can do real time monitoring of your system resources by accessing the Top page from the menu. If you ever used the top command on linux, this basically does the same thing for your databases. It shows your memory, CPU usage, DB connections, network transfers, etc. You can start and stop the process at any time using controls at the top of the page.

您可以通过从菜单访问Top来实时监视系统资源。 如果您曾经在linux上使用过top命令,那么这基本上会对您的数据库执行相同的操作。 它显示您的内存,CPU使用率,数据库连接,网络传输等。您可以随时使用页面顶部的控件来启动和停止该过程。

Top page

You can also use the SNMP program when available, but check the box to enable it before starting the process.

您也可以使用SNMP程序(如果可用),但是在开始该过程之前,选中该复选框以启用它。

制图 (Charting)

If you’re a reporting fan and you prefer working with charts to compare your database server performance over time, the charts tab provides a charting tool along with date range selection to help you understand your server performance. You can also compare different server metrics like memory usage, DB connections, etc.

如果您是报告迷,并且希望使用图表来比较一段时间内数据库服务器的性能,那么“图表”选项卡将提供图表工具以及日期范围选择,以帮助您了解服务器性能。 您还可以比较不同的服务器指标,例如内存使用率,数据库连接等。

Charts

探索数据库元数据 (Exploring Database Meta Data)

Although we are used to exploring database meta data from our database management apps like SequelPro, Yahoo performance analyzer provides a simple way to explore database and table meta data, like columns, views, indexes, triggers, etc.

尽管我们习惯于从SequelPro等数据库管理应用程序中探索数据库元数据,但Yahoo Performance Analyzer提供了一种简单的方法来探索数据库和表元数据,如列,视图,索引,触发器等。

DB Meta

解释查询 (Explaining Queries)

Probably the most used feature in performance analysis is Profiling Queries, since it helps a lot in detecting slow queries and explaining them. It also shows data about memory usage, execution time, cache usage, etc.

性能分析中最常用的功能可能是Profiling Queries ,因为它在检测慢速查询和解释它们方面有很大帮助。 它还显示有关内存使用率,执行时间,缓存使用率等的数据。

Explain queries

快讯 (Alerts)

Alerts are an indispensable feature in monitoring your database performance. Basically, you set a rule that defines when your system is (or will be) experiencing problems. From the User Defined Alerts menu at top of the page, you can create an alert using predefined metrics. As an example, I will use the SNMP._.MEMAVAILREAL metric, which defines the available memory and I will set the alert to trigger if it went below 1000KB.

警报是监视数据库性能必不可少的功能。 基本上,您设置了一个规则来定义系统何时(或将要)遇到问题。 在页面顶部的“ User Defined Alerts菜单中,您可以使用预定义的指标创建警报。 作为示例,我将使用SNMP._.MEMAVAILREAL度量标准,该度量标准定义可用内存,并且将警报设置为在1000KB以下时触发。

Alert 1

You can also create alerts based on a database query. We can create an alert to trigger when the list of queued jobs is higher than 100.

您还可以基于数据库查询创建警报。 我们可以创建一个警报,以在排队的作业列表大于100时触发。

Alert 1

After creating your alerts, you need to move to the subscribers tab on the same page and select your DB Group and check alerts that you want to attach.

创建警报后,需要移至同一页面上的“ subscribers选项卡,然后选择数据库组并检查要附加的警报。

Now, if you navigate to the Alerts page, you’ll find a list of errors from the last 24 hours, and you can select a date range to see previously occurred errors.

现在,如果您导航到“ Alerts页面,您将找到过去24小时内的错误列表,并且可以选择日期范围以查看以前发生的错误。

Alerts

结论 (Conclusion)

This article was a brief introduction to the main features of the Yahoo performance analyzer, and there’s still a lot to discover. The project is still being developed – you can contribute on Github.

本文简要介绍了Yahoo性能分析器的主要功能,但仍有很多发现。 该项目仍在开发中-您可以在Github上做出贡献。

A more advanced post covering the analyzer’s usage on a real database is coming soon!

即将发布更高级的文章,内容涉及分析仪在实际数据库中的使用情况!

If you have any question or comments, please post them below.

如果您有任何问题或意见,请在下面发布。

翻译自: https://www.sitepoint.com/first-look-at-yahoos-mysql-performance-analyzer/

analyzer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值