### 23.5.29 ndb\_top — View CPU usage information for NDB threads

[]()

[**ndb\_top**](mysql-cluster-programs-ndb-top.html) displays running information in the terminal about CPU usage by NDB threads on an NDB Cluster data node. Each thread is represented by two rows in the output, the first showing system statistics, the second showing the measured statistics for the thread.

[**ndb\_top**](mysql-cluster-programs-ndb-top.html) is available beginning with MySQL NDB Cluster 7.6.3.

#### Usage

```
ndb_top [-h hostname] [-t port] [-u user] [-p pass] [-n node_id]
```

[**ndb\_top**](mysql-cluster-programs-ndb-top.html) connects to a MySQL Server running as an SQL node of the cluster. By default, it attempts to connect to a [**mysqld**](mysqld.html) running on `localhost` and port 3306, as the MySQL `root` user with no password specified. You can override the default host and port using, respectively, [`--host`](mysql-cluster-programs-ndb-top.html#option_ndb_top_host) (`-h`) and [`--port`](mysql-cluster-programs-ndb-top.html#option_ndb_top_port) (`-t`). To specify a MySQL user and password, use the [`--user`](mysql-cluster-programs-ndb-top.html#option_ndb_top_user) (`-u`) and [`--passwd`](https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-programs-ndb-top.html#option_ndb_top_passwd) (`-p`) options. This user must be able to read tables in the [`ndbinfo`](mysql-cluster-ndbinfo.html) database ([**ndb\_top**](mysql-cluster-programs-ndb-top.html) uses information from [`ndbinfo.cpustat`](mysql-cluster-ndbinfo-cpustat.html) and related tables).

 For more information about MySQL user accounts and passwords, see [Section 6.2, “Access Control and Account Management”](access-control.html).

 Output is available as plain text or an ASCII graph; you can specify this using the [`--text`](mysql-cluster-programs-ndb-top.html#option_ndb_top_text) (`-x`) and [`--graph`](mysql-cluster-programs-ndb-top.html#option_ndb_top_graph) (`-g`) options, respectively. These two display modes provide the same information; they can be used concurrently. At least one display mode must be in use.

 Color display of the graph is supported and enabled by default ([`--color`](mysql-cluster-programs-ndb-top.html#option_ndb_top_color) or `-c` option). With color support enabled, the graph display shows OS user time in blue, OS system time in green, and idle time as blank. For measured load, blue is used for execution time, yellow for send time, red for time spent in send buffer full waits, and blank spaces for idle time. The percentage shown in the graph display is the sum of percentages for all threads which are not idle. Colors are not currently configurable; you can use grayscale instead by using `--skip-color`.

 The sorted view ([`--sort`](mysql-cluster-programs-ndb-top.html#option_ndb_top_sort), `-r`) is based on the maximum of the measured load and the load reported by the OS. Display of these can be enabled and disabled using the [`--measured-load`](mysql-cluster-programs-ndb-top.html#option_ndb_top_measured-load) (`-m`) and [`--os-load`](mysql-cluster-programs-ndb-top.html#option_ndb_top_os-load) (`-o`) options. Display of at least one of these loads must be enabled.

 The program tries to obtain statistics from a data node having the node ID given by the [`--node-id`](mysql-cluster-programs-ndb-top.html#option_ndb_top_node-id) (`-n`) option; if unspecified, this is 1. [**ndb\_top**](mysql-cluster-programs-ndb-top.html) cannot provide information about other types of nodes.

 The view adjusts itself to the height and width of the terminal window; the minimum supported width is 76 characters.

 Once started, [**ndb\_top**](mysql-cluster-programs-ndb-top.html) runs continuously until forced to exit; you can quit the program using `Ctrl-C`. The display updates once per second; to set a different delay interval, use [`--sleep-time`](mysql-cluster-programs-ndb-top.html#option_ndb_top_sleep-time) (`-s`).

Note

[**ndb\_top**](mysql-cluster-programs-ndb-top.html) is available on macOS, Linux, and Solaris. It is not currently supported on Windows platforms.

 The following table includes all options that are specific to the NDB Cluster program [**ndb\_top**](mysql-cluster-programs-ndb-top.html). Additional descriptions follow the table.

[]()

**Table 23.49 Command-line options used with the program ndb\_top**

|                                                                                   Format                                                                                    |                             Description                              |           Added, Deprecated, or Removed           |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|---------------------------------------------------|
|             `[--color](mysql-cluster-programs-ndb-top.html#option_ndb_top_color)`,<br/><br/>` [-c](mysql-cluster-programs-ndb-top.html#option_ndb_top_color) `              |       Show ASCII graphs in color; use --skip-colors to disable       | (Supported in all NDB releases based on MySQL 8.0)|
|                                  ` [--defaults-extra-file=path](mysql-cluster-programs-ndb-top.html#option_ndb_top_defaults-extra-file) `                                   |             Read given file after global files are read              | (Supported in all NDB releases based on MySQL 8.0)|
|                                        ` [--defaults-file=path](mysql-cluster-programs-ndb-top.html#option_ndb_top_defaults-file) `                                         |              Read default options from given file only               | (Supported in all NDB releases based on MySQL 8.0)|
|                               ` [--defaults-group-suffix=string](mysql-cluster-programs-ndb-top.html#option_ndb_top_defaults-group-suffix) `                                |             Also read groups with concat(group, suffix)              | (Supported in all NDB releases based on MySQL 8.0)|
|             `[--graph](mysql-cluster-programs-ndb-top.html#option_ndb_top_graph)`,<br/><br/>` [-g](mysql-cluster-programs-ndb-top.html#option_ndb_top_graph) `              |       Display data using graphs; use --skip-graphs to disable        | (Supported in all NDB releases based on MySQL 8.0)|
|                                                    ` [--help](mysql-cluster-programs-ndb-top.html#option_ndb_top_help) `                                                    |                    Show program usage information                    | (Supported in all NDB releases based on MySQL 8.0)|
|        `[--host=string](mysql-cluster-programs-ndb-top.html#option_ndb_top_host)`,<br/><br/>` [-h string](mysql-cluster-programs-ndb-top.html#option_ndb_top_host) `        |        Host name or IP address of MySQL Server to connect to         | (Supported in all NDB releases based on MySQL 8.0)|
|                                           ` [--login-path=path](mysql-cluster-programs-ndb-top.html#option_ndb_top_login-path) `                                            |                   Read given path from login file                    | (Supported in all NDB releases based on MySQL 8.0)|
| `[--measured-load](mysql-cluster-programs-ndb-top.html#option_ndb_top_measured-load)`,<br/><br/>` [-m](mysql-cluster-programs-ndb-top.html#option_ndb_top_measured-load) `  |                     Show measured load by thread                     | (Supported in all NDB releases based on MySQL 8.0)|
|                                             ` [--no-defaults](mysql-cluster-programs-ndb-top.html#option_ndb_top_no-defaults) `                                             |Do not read default options from any option file other than login file| (Supported in all NDB releases based on MySQL 8.0)|
|        `[--node-id=#](mysql-cluster-programs-ndb-top.html#option_ndb_top_node-id)`,<br/><br/>` [-n #](mysql-cluster-programs-ndb-top.html#option_ndb_top_node-id) `         |                    Watch node having this node ID                    | (Supported in all NDB releases based on MySQL 8.0)|
|          `[--os-load](mysql-cluster-programs-ndb-top.html#option_ndb_top_os-load)`,<br/><br/>` [-o](mysql-cluster-programs-ndb-top.html#option_ndb_top_os-load) `           |                Show load measured by operating system                | (Supported in all NDB releases based on MySQL 8.0)|
|`[--password=password](mysql-cluster-programs-ndb-top.html#option_ndb_top_password)`,<br/><br/>` [-p password](mysql-cluster-programs-ndb-top.html#option_ndb_top_password) `|                     Connect using this password                      | (Supported in all NDB releases based on MySQL 8.0)|
|        `[--port=#](mysql-cluster-programs-ndb-top.html#option_ndb_top_port)`,<br/><br/>`[-P #](mysql-cluster-programs-ndb-top.html#option_ndb_top_port)` (\>=7.6.6)         |          Port number to use when connecting to MySQL Server          | (Supported in all NDB releases based on MySQL 8.0)|
|                                          ` [--print-defaults](mysql-cluster-programs-ndb-top.html#option_ndb_top_print-defaults) `                                          |                 Print program argument list and exit                 | (Supported in all NDB releases based on MySQL 8.0)|
|    `[--sleep-time=#](mysql-cluster-programs-ndb-top.html#option_ndb_top_sleep-time)`,<br/><br/>` [-s #](mysql-cluster-programs-ndb-top.html#option_ndb_top_sleep-time) `    |          Time to wait between display refreshes, in seconds          | (Supported in all NDB releases based on MySQL 8.0)|
|       `[--socket=path](mysql-cluster-programs-ndb-top.html#option_ndb_top_socket)`,<br/><br/>` [-S path](mysql-cluster-programs-ndb-top.html#option_ndb_top_socket) `       |                  Socket file to use for connection                   | (Supported in all NDB releases based on MySQL 8.0)|
|               `[--sort](mysql-cluster-programs-ndb-top.html#option_ndb_top_sort)`,<br/><br/>` [-r](mysql-cluster-programs-ndb-top.html#option_ndb_top_sort) `               |          Sort threads by usage; use --skip-sort to disable           | (Supported in all NDB releases based on MySQL 8.0)|
|          `[--text](mysql-cluster-programs-ndb-top.html#option_ndb_top_text)`,<br/><br/>`[-t](mysql-cluster-programs-ndb-top.html#option_ndb_top_text)` (\>=7.6.6)           |                       Display data using text                        | (Supported in all NDB releases based on MySQL 8.0)|
|                                                   ` [--usage](mysql-cluster-programs-ndb-top.html#option_ndb_top_usage) `                                                   |            Show program usage information; same as --help            | (Supported in all NDB releases based on MySQL 8.0)|
|          `[--user=name](mysql-cluster-programs-ndb-top.html#option_ndb_top_user)`,<br/><br/>` [-u name](mysql-cluster-programs-ndb-top.html#option_ndb_top_user) `          |                      Connect as this MySQL user                      | (Supported in all NDB releases based on MySQL 8.0)|

#### Additional Options

* []() `--color`, `-c`

  []()[]()

  |Command-Line Format|`--color`|
  |-------------------|---------|

   Show ASCII graphs in color; use `--skip-colors` to disable.

* []() `--defaults-extra-file`

  []()[]()

  |Command-Line Format|`--defaults-extra-file=path`|
  |-------------------|----------------------------|
  |       Type        |           String           |
  |   Default Value   |          `[none]`          |

   Read given file after global files are read.

* []() `--defaults-file`

  []()[]()

  |Command-Line Format|`--defaults-file=path`|
  |-------------------|----------------------|
  |       Type        |        String        |
  |   Default Value   |       `[none]`       |

   Read default options from given file only.

* []() `--defaults-group-suffix`

  []()[]()

  |Command-Line Format|`--defaults-group-suffix=string`|
  |-------------------|--------------------------------|
  |       Type        |             String             |
  |   Default Value   |            `[none]`            |

   Also read groups with concat(group, suffix).

* []() `--graph`, `-g`

  []()[]()

  |Command-Line Format|`--graph`|
  |-------------------|---------|

   Display data using graphs; use `--skip-graphs` to disable. This option or [`--text`](mysql-cluster-programs-ndb-top.html#option_ndb_top_text) must be true; both options may be true.

* []() `--help`, `-?`

  []()[]()

  |Command-Line Format|`--help`|
  |-------------------|--------|

   Show program usage information.

* []() `--host[`=*`name]`*, `-h`

  []()[]()

  |Command-Line Format|`--host=string`|
  |-------------------|---------------|
  |       Type        |    String     |
  |   Default Value   |  `localhost`  |

   Host name or IP address of MySQL Server to connect to.

* []() `--login-path`

  []()[]()

  |Command-Line Format|`--login-path=path`|
  |-------------------|-------------------|
  |       Type        |      String       |
  |   Default Value   |     `[none]`      |

   Read given path from login file.

* []() `--measured-load`, `-m`

  []()[]()

  |Command-Line Format|`--measured-load`|
  |-------------------|-----------------|

   Show measured load by thread. This option or [`--os-load`](mysql-cluster-programs-ndb-top.html#option_ndb_top_os-load) must be true; both options may be true.

* []() `--no-defaults`

  []()[]()

  |Command-Line Format|`--no-defaults`|
  |-------------------|---------------|

   Do not read default options from any option file other than login file.

* []() `--node-id[`=*`#]`*, `-n`

  []()[]()

  |Command-Line Format|`--node-id=#`|
  |-------------------|-------------|
  |       Type        |   Integer   |
  |   Default Value   |     `1`     |

   Watch the data node having this node ID.

* []() `--os-load`, `-o`

  []()[]()

  |Command-Line Format|`--os-load`|
  |-------------------|-----------|

   Show load measured by operating system. This option or [`--measured-load`](mysql-cluster-programs-ndb-top.html#option_ndb_top_measured-load) must be true; both options may be true.

* []() `--password[`=*`password]`*, `-p`

  []()[]()

  |Command-Line Format|`--password=password`|
  |-------------------|---------------------|
  |       Type        |       String        |
  |   Default Value   |       `NULL`        |

   Connect to a MySQL Server using this password and the MySQL user specified by [`--user`](mysql-cluster-programs-ndb-top.html#option_ndb_top_user).

   This password is associated with a MySQL user account only, and is not related in any way to the password used with encrypted `NDB` backups.

* []() `--port[`=*`#]`*, `-P`

  []()[]()

  |Command-Line Format|`--port=#`|
  |-------------------|----------|
  |       Type        | Integer  |
  |   Default Value   |  `3306`  |

   Port number to use when connecting to MySQL Server.

   (Formerly, the short form for this option was `-t`, which was repurposed as the short form of [`--text`](mysql-cluster-programs-ndb-top.html#option_ndb_top_text).)

* []() `--print-defaults`

  []()[]()

  |Command-Line Format|`--print-defaults`|
  |-------------------|------------------|

   Print program argument list and exit.

* []() `--sleep-time[`=*`seconds]`*, `-s`

  []()[]()

  |Command-Line Format|`--sleep-time=#`|
  |-------------------|----------------|
  |       Type        |    Integer     |
  |   Default Value   |      `1`       |

   Time to wait between display refreshes, in seconds.

* []() `--socket=*`path/to/file`*`, *`-S`*

  []()[]()

  |Command-Line Format|`--socket=path`|
  |-------------------|---------------|
  |       Type        |   Path name   |
  |   Default Value   |   `[none]`    |

   Use the specified socket file for the connection.

* []() `--sort`, `-r`

  []()[]()

  |Command-Line Format|`--sort`|
  |-------------------|--------|

   Sort threads by usage; use `--skip-sort` to disable.

* []() `--text`, `-t`

  []()[]()

  |Command-Line Format|`--text`|
  |-------------------|--------|

   Display data using text. This option or [`--graph`](mysql-cluster-programs-ndb-top.html#option_ndb_top_graph) must be true; both options may be true.

   (The short form for this option was `-x` in previous versions of NDB Cluster, but this is no longer supported.)

* []() `--usage`

  []()[]()

  |Command-Line Format|`--usage`|
  |-------------------|---------|

   Display help text and exit; same as [`--help`](mysql-cluster-programs-ndb-top.html#option_ndb_top_help).

* []() `--user[`=*`name]`*, `-u`

  []()[]()

  |Command-Line Format|`--user=name`|
  |-------------------|-------------|
  |       Type        |   String    |
  |   Default Value   |   `root`    |

   Connect as this MySQL user. Normally requires a password supplied by the [`--password`](mysql-cluster-programs-ndb-top.html#option_ndb_top_password) option.

**Sample Output.**  The next figure shows [**ndb\_top**](mysql-cluster-programs-ndb-top.html) running in a terminal window on a Linux system with an [**ndbmtd**](mysql-cluster-programs-ndbmtd.html) data node under a moderate load. Here, the program has been invoked using [**ndb\_top**](mysql-cluster-programs-ndb-top.html) [`-n8`](mysql-cluster-programs-ndb-top.html#option_ndb_top_node-id) [`-x`](mysql-cluster-programs-ndb-top.html#option_ndb_top_text) to provide both text and graph output:

[]()

**Figure 23.26 ndb\_top Running in Terminal**

<img alt="Display from ndb_top, running in a terminal window. Shows information for each node, including the utilized resources." src="images/ndb-top-1.png" height="675" width="800" />

 Beginning with NDB 8.0.20, [**ndb\_top**](mysql-cluster-programs-ndb-top.html) also shows spin times for threads, displayed in green.

