Tutorial
You can use nats-top to monitor in realtime NATS server connections and message statistics.
Prerequisites
1. Install nats-top
You may need to run the following instead:
2. Start the NATS server with monitoring enabled
3. Start nats-top
Result:
4. Run NATS client programs
Run some NATS client programs and exchange messages.
For the best experience, you will want to run multiple subscribers, at least 2 or 3. Refer to the example pub-sub clients.
5. Check nats-top for statistics
6. Sort nats-top statistics
In nats-top, enter the command o
followed by the option, such as bytes_to
. You see that nats-top sorts the BYTES_TO column in ascending order.
7. Use different sort options
Use some different sort options to explore nats-top, such as:
cid
, subs
, pending
, msgs_to
, msgs_from
, bytes_to
, bytes_from
, lang
, version
You can also set the sort option on the command line using the -sort
flag. For example: nats-top -sort bytes_to
.
8. Display the registered subscriptions.
In nats-top, enter the command s
to toggle displaying connection subscriptions. When enabled, you see the subscription subject in nats-top table:
9. Quit nats-top
Use the q
command to quit nats-top.
10. Restart nats-top with a specified query
For example, to query for the connection with largest number of subscriptions:
Result: nats-top displays only the client connection with the largest number of subscriptions:
Last updated