Improve README.md
[pstop.git] / README.md
1 ## pstop
2
3 pstop - a top-like program for MySQL
4
5 pstop is a program which collects information from MySQL 5.6+'s
6 performance_schema database and uses this information to display
7 server load in real-time. Data is shown by table or filename and
8 the metrics also show how this is split between select, insert,
9 update or delete activity.  User activity is now shown showing the
10 number of different hosts that connect with the same username and
11 the actiity of those users.
12
13 ### Installation
14
15 Install and update this go package with `go get -u github.com/sjmudd/pstop`
16
17 ### Configuration
18
19 Access to MySQL is currently via a defaults-file which is assumed
20 to be `~/.my.cnf`.  Alternatively you can now provide
21 -defaults-file=/path/to/.my.cnf if needed.
22
23 ### Grants
24
25 `pstop` needs `SELECT` access to `performance_schema` tables. It
26 will not run if access to the required tables is not available.
27
28 ### Screens
29
30 pstop has 5 different screens which get updated by default every second.
31 * Latency mode: order table activity by the time waiting to perform operations on them.
32 * Ops (operations) mode: order table activity by the number of operations MySQL performs on them.
33 * I/O mode: show where MySQL is spending it's time in file I/O.
34 * Locks mode: show order based on table locks
35 * User mode: show ordering based on how long users are running
36 queries, or the number of connections they have to MySQL. This is
37 really missing a feature in MySQL (see: http://bugs.mysql.com/75156)
38 to provide higher resolution query times than seconds. It gives
39 some info but if the queries are very short then the integer runtime
40 in seconds makes the output far less interesting.
41
42 You can change the polling interval and switch between modes (see below).
43
44 ### Keys
45
46 The following keys allow you to navigate around the different pstop displays or to change it's behaviour.
47
48 * h - gives you a help screen.
49 * - - reduce the poll interval by 1 second (minimum 1 second)
50 * + - increase the poll interval by 1 second
51 * q - quit
52 * t - toggle between showing the statistics since resetting pstop started or you explicitly reset them (with 'z') [REL] or showing the statistics as collected from MySQL [ABS].
53 * z - reset statistics. That is counters you see are relative to when you "reset" statistics.
54 * <tab> - change display modes between: latency, ops, file I/O, lock modes and user modes.
55 * left arrow - change to previous screen
56 * right arrow - change to next screen
57
58 ### See also
59
60 See also:
61 * [BUGS](https://github.com/sjmudd/pstop/blob/master/BUGS) currently known issues
62 * [NEW_FEATURES](https://github.com/sjmudd/pstop/blob/master/NEW_FEATURES) which describe things that probably need looking at
63 * [screen_samples.txt](https://github.com/sjmudd/pstop/blob/master/screen_samples.txt) provides some sample output from my own system.
64
65 ### Contributing
66
67 This program was started as a simple project to allow me (Simon) to learn
68 go, which I'd been following for a while, but hadn't used in earnest.
69 This probably shows in the code so suggestions on improvement are
70 most welcome.
71
72 You may find "Contributing to Open Source Git Repositories in Go"
73 by Katrina Owen to be useful:
74 https://blog.splice.com/contributing-open-source-git-repositories-go/
75
76 ### Licensing
77
78 BSD 2-Clause License
79
80 ### Feedback
81
82 Feedback and patches welcome. I am especially interested in hearing
83 from you if you are using pstop, or if you have ideas of how I can
84 better use other information from the performance_schema tables to
85 provide a more complete vision of what MySQL is doing or where it's
86 busy.
87
88 Simon J Mudd
89 <sjmudd@pobox.com>
90
91 ### Code Documenton
92 [godoc.org/github.com/sjmudd/pstop](http://godoc.org/github.com/sjmudd/pstop)