Skip to content

Commit 5c51b1d

Browse files
committed
initial commit for mysql perf analyzer open source
0 parents  commit 5c51b1d

File tree

247 files changed

+62151
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+62151
-0
lines changed

LICENSE

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
4+
http://www.apache.org/licenses/
5+
6+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
8+
1. Definitions.
9+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
10+
Sections 1 through 9 of this document.
11+
12+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting
13+
the License.
14+
15+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are
16+
controlled by, or are under common control with that entity. For the purposes of this definition,
17+
"control" means (i) the power, direct or indirect, to cause the direction or management of such entity,
18+
whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding
19+
shares, or (iii) beneficial ownership of such entity.
20+
21+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
22+
23+
"Source" form shall mean the preferred form for making modifications, including but not limited to software
24+
source code, documentation source, and configuration files.
25+
26+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form,
27+
including but not limited to compiled object code, generated documentation, and conversions to other media types.
28+
29+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License,
30+
as indicated by a copyright notice that is included in or attached to the work (an example is provided in
31+
the Appendix below).
32+
33+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from)
34+
the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent,
35+
as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not
36+
include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work
37+
and Derivative Works thereof.
38+
39+
"Contribution" shall mean any work of authorship, including the original version of the Work and any
40+
modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to
41+
Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to
42+
submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
43+
electronic, verbal, or written communication sent to the Licensor or its representatives, including but not
44+
limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
45+
that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but
46+
excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner
47+
as "Not a Contribution."
48+
49+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been
50+
received by Licensor and subsequently incorporated within the Work.
51+
52+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby
53+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license
54+
to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute
55+
the Work and such Derivative Works in Source or Object form.
56+
57+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby
58+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated
59+
in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer
60+
the Work, where such license applies only to those patent claims licensable by such Contributor that are
61+
necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work
62+
to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including
63+
a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the
64+
Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under
65+
this License for that Work shall terminate as of the date such litigation is filed.
66+
67+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any
68+
medium, with or without modifications, and in Source or Object form, provided that You meet the following
69+
conditions:
70+
71+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
72+
You must cause any modified files to carry prominent notices stating that You changed the files; and
73+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent,
74+
trademark, and attribution notices from the Source form of the Work, excluding those notices that do not
75+
pertain to any part of the Derivative Works; and
76+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You
77+
distribute must include a readable copy of the attribution notices contained within such NOTICE file,
78+
excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the
79+
following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source
80+
form or documentation, if provided along with the Derivative Works; or, within a display generated by the
81+
Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file
82+
are for informational purposes only and do not modify the License. You may add Your own attribution notices
83+
within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work,
84+
provided that such additional attribution notices cannot be construed as modifying the License.
85+
86+
You may add Your own copyright statement to Your modifications and may provide additional or different
87+
license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such
88+
Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise
89+
complies with the conditions stated in this License.
90+
91+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally
92+
submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this
93+
License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall
94+
supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding
95+
such Contributions.
96+
97+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or
98+
product names of the Licensor, except as required for reasonable and customary use in describing the origin
99+
of the Work and reproducing the content of the NOTICE file.
100+
101+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the
102+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
103+
OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE,
104+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
105+
determining the appropriateness of using or redistributing the Work and assume any risks associated with Your
106+
exercise of permissions under this License.
107+
108+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence),
109+
contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts)
110+
or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect,
111+
special, incidental, or consequential damages of any character arising as a result of this License or out
112+
of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work
113+
stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such
114+
Contributor has been advised of the possibility of such damages.
115+
116+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof,
117+
You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other
118+
liability obligations and/or rights consistent with this License. However, in accepting such obligations,
119+
You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor,
120+
and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred
121+
by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional
122+
liability.
123+
124+
END OF TERMS AND CONDITIONS

README.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
MySQL Performance Analyzer
2+
======
3+
4+
MySQL Performance Analyzer is an open source project for MySQL performance monitoring and analysis.
5+
This repository includes two sub projects:
6+
Java web application project myperf
7+
Java web server jetty wrapper
8+
9+
Build
10+
------
11+
MySQL Performance Analyzer is a Java Maven project.
12+
JDK and Maven 3.0 or later are required to build it.
13+
14+
Although JDK 8 is specified in pom.xml, this project does not use Java 8 specific features, so the user can modify pom.xml files of the two sub projects to use different JDK version.
15+
16+
The build will create a zip file named as myperfserver-server.zip under directory perfJettyServer/target. To build it, at top level, run
17+
```
18+
mvn clean package
19+
```
20+
21+
Installation and Usage Instructions
22+
------
23+
1. Requirement: Java JDK 8, or the one specified by in pom.xml if changed during build time.
24+
25+
2. Unzip myperfserver-server.zip to desired installation directory. If intend to install on Windows host, please review two shell scripts and create Windows equivalent.
26+
27+
3. For more formal installation, it is recommended to have a MySQL database server to store the metrics.
28+
Otherwise, use built in derby db.
29+
a. Create a database, for example, named as metrics, with the MySQL database server.
30+
b. Create a MySQL user (for example, 'metrics'@'my_host', here my_host is the machine to install this MySQL perf analyzer) with all privileges on above schema.
31+
c. Above information will be required when first login to the analyzer to setup metrics gathering.
32+
33+
4. Review script start_myperf.sh to see if you need modify any command line settings. Usually, port number is the only one you need change
34+
-j: jetteyHome, leave as it is
35+
-p: http port to be used, 9092 by default
36+
-w: war (web archive) file, has to be myperf.war
37+
-k: working directory, if not specified, it will use ./work
38+
-c: url context, default to /myperf, leave it as is.
39+
40+
Modify java command path inside start_myperf.sh, if needed.
41+
42+
5. Start up:
43+
./start_myperf.sh
44+
Check nohup.out and logs directory for any error logs.
45+
46+
6. Shutdown:
47+
./stop_myperf.sh
48+
49+
7. Fisrt login and setup
50+
After startup, point your bwoser to http://your_host:9002/myperf (or the port number you changed).
51+
The initial login user and credential are myperf/change.
52+
After login, you will be directed to setup page:
53+
You can add notification email. The email uses OS "mailx" command.
54+
Configure the metrics storage database, using the one created earlier.
55+
1 minute or 5 minutes metrics scan interval is good enough.
56+
If use builtin derbydb, choose short retention days.
57+
After configuration is done, you need start the scanner (the "Start Scanner" button on the page top).
58+
Everytime you change the configuration, you need restart the scanner.
59+
If the scanner does not work as expected, restart the analyzer (./stop_myperf.sh, then ./start_myperf.sh)
60+
61+
8. For each database server to monitor, you need create a MySQL user with the following privileges
62+
a. process
63+
b. replication client
64+
c. show databases
65+
d. show view
66+
e. select on all (if you want to use it to check data dictionary or run explain plan)
67+
68+
9. The analyzer relies on Linux SNMP to gather OS level data. Check snmpd service status.
69+
70+
Known Limitations
71+
------
72+
1. snmpd is based on Linux specification.
73+
2. Email notification uses Linux "mailx" command.
74+
75+
License
76+
------
77+
Code licensed under the Apache license. See LICENSE file for terms.

myperf/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Source code of MySQL Perf Analyzer

myperf/pom.xml

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
<!--
2+
Copyright 2015, Yahoo Inc.
3+
Copyrights licensed under the Apache License.
4+
See the accompanying LICENSE file for terms.
5+
-->
6+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
8+
<modelVersion>4.0.0</modelVersion>
9+
<parent>
10+
<artifactId>myperf-project</artifactId>
11+
<groupId>com.yahoo.dba.perf</groupId>
12+
<version>2.0.0-SNAPSHOT</version>
13+
<relativePath>../project/pom.xml</relativePath>
14+
</parent>
15+
<artifactId>myperf</artifactId>
16+
<packaging>war</packaging>
17+
<name>MySQL Database Performance Tool</name>
18+
<url>http://maven.apache.org</url>
19+
<dependencies>
20+
<dependency>
21+
<groupId>javax.servlet</groupId>
22+
<artifactId>jstl</artifactId>
23+
<version>1.2</version>
24+
<scope>compile</scope>
25+
</dependency>
26+
<dependency>
27+
<groupId>javax.servlet</groupId>
28+
<artifactId>javax.servlet-api</artifactId>
29+
<version>3.1.0</version>
30+
<scope>provided</scope>
31+
</dependency>
32+
<dependency>
33+
<groupId>taglibs</groupId>
34+
<artifactId>standard</artifactId>
35+
<version>1.1.2</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>opensymphony</groupId>
39+
<artifactId>sitemesh</artifactId>
40+
<version>2.4.2</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.springframework</groupId>
44+
<artifactId>spring-core</artifactId>
45+
<version>3.2.9.RELEASE</version>
46+
</dependency>
47+
48+
<dependency>
49+
<groupId>org.springframework</groupId>
50+
<artifactId>spring-webmvc</artifactId>
51+
<version>3.2.9.RELEASE</version>
52+
</dependency>
53+
54+
<dependency>
55+
<groupId>org.springframework</groupId>
56+
<artifactId>spring-mock</artifactId>
57+
<scope>test</scope>
58+
<version>2.0.8</version>
59+
</dependency>
60+
<dependency>
61+
<groupId>org.apache.derby</groupId>
62+
<artifactId>derby</artifactId>
63+
<version>10.8.1.2</version>
64+
<!-- version>10.5.3.0_1</version -->
65+
</dependency>
66+
<dependency>
67+
<groupId>org.snmp4j</groupId>
68+
<artifactId>snmp4j</artifactId>
69+
<version>1.10.1</version>
70+
</dependency>
71+
<dependency>
72+
<groupId>junit</groupId>
73+
<artifactId>junit</artifactId>
74+
<version>3.8.1</version>
75+
<scope>test</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>javax.json</groupId>
79+
<artifactId>javax.json-api</artifactId>
80+
<version>1.0</version>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.glassfish</groupId>
84+
<artifactId>javax.json</artifactId>
85+
<version>1.0.4</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.eclipse.jetty</groupId>
89+
<artifactId>jetty-servlets</artifactId>
90+
<version>9.2.7.v20150116</version>
91+
</dependency>
92+
<dependency>
93+
<groupId>mysql</groupId>
94+
<artifactId>mysql-connector-java</artifactId>
95+
<version>5.1.34</version>
96+
</dependency>
97+
</dependencies>
98+
<repositories>
99+
<repository>
100+
<id>thirdparty-releases</id>
101+
<name>JBoss Thirdparty Releases</name>
102+
<url>https://repository.jboss.org/nexus/content/repositories/thirdparty-releases</url>
103+
</repository>
104+
<repository>
105+
<id>maven2-repository.dev.java.net</id>
106+
<name>Java.net Maven 2 Repository</name>
107+
<url>http://download.java.net/maven/2/</url>
108+
</repository>
109+
<repository>
110+
<id>jboss-repository.maven2</id>
111+
<name>JBoss Maven 2 Repository</name>
112+
<url>http://repository.jboss.com/maven2/</url>
113+
</repository>
114+
</repositories>
115+
<build>
116+
<finalName>myperf</finalName>
117+
<plugins>
118+
<plugin>
119+
<artifactId>maven-compiler-plugin</artifactId>
120+
<version>3.0</version>
121+
<configuration>
122+
<source>1.8</source>
123+
<target>1.8</target>
124+
<debug>true</debug>
125+
<verbose>true</verbose>
126+
<fork>true</fork>
127+
<executable>${maven.compiler.executable}</executable>
128+
<compilerVersion>1.6</compilerVersion>
129+
</configuration>
130+
</plugin>
131+
<plugin>
132+
<artifactId>maven-source-plugin</artifactId>
133+
<executions>
134+
<execution>
135+
<id>source-jar</id>
136+
<phase>deploy</phase>
137+
<goals>
138+
<goal>jar</goal>
139+
</goals>
140+
</execution>
141+
</executions>
142+
<configuration>
143+
<attach>true</attach>
144+
</configuration>
145+
</plugin>
146+
</plugins>
147+
</build>
148+
</project>

0 commit comments

Comments
 (0)