Couchbase Server statistics
Couchbase Server provides statistics at multiple levels throughout the cluster.
The statistics used for regular monitoring, capacity planning and to identify the performance characteristics of your cluster deployment. The most visible statistics are those in the Web UI, but components such as the REST interface, the proxy and individual nodes have directly accessible statistics interfaces.
REST interface statistics
To interact with statistics provided by REST, use the Couchbase web console. This GUI gathers statistics via REST and displays them to your browser. The REST interface has a set of resources that provide access to the current and historic statistics the cluster gathers and stores.
Couchbase Server node statistics
Detailed stats documentation can be found in the repository.
Along with stats at the REST and UI level, individual nodes can also be queried for statistics either through a client which uses binary protocol or through the cbstats utility.
> cbstats localhost:11210 all auth_cmds: 9 auth_errors: 0 bucket_conns: 10 bytes_read: 246378222 bytes_written: 289715944 cas_badval: 0 cas_hits: 0 cas_misses: 0 cmd_flush: 0 cmd_get: 134250 cmd_set: 115750 …
The most commonly needed statistics are surfaced through the Web Console and have descriptions there and in the associated documentation. Software developers and system administrators wanting lower level information have it available through the stats interface.
There are seven commands available through the stats interface:
stats (referred to as ‘all’)
This displays a large list of statistics related to the Couchbase process including the underlying engine (ep_* stats).
This statistic shows what the dispatcher is currently doing:
dispatcher runtime: 45ms state: dispatcher_running status: running task: Running a flusher loop. nio_dispatcher state: dispatcher_running status: idle
The first entry, dispatcher, monitors the process responsible for disk access. The second entry is a non-IO (non disk) dispatcher. There may also be a ro_dispatcher present if the engine is allowing concurrent reads and writes. When a task is actually running on a given dispatcher, the “runtime” tells you how long the current task has been running. Newer versions will show you a log of recently run dispatcher jobs so you can see what’s been happening.
Changing statistics collection
The default Couchbase Server statistics collection is set to collect every second. The tuning that is available for statistic collection is by collecting statistics less frequently.
To change statistic collection:
- Log in as root or sudo and navigate to the directory where Couchbase is installed. For example: /opt/couchbase/etc/couchbase/static_config
- Edit the static_config file.
- Add the following parameter: grab_stats_every_n_ticks, 10 , where 10 is the number of ticks. In the Couchbase environment one tick is one second (default). It is recommended that the statistics collection be more frequent (and accurate). However, assign an appropriate tick value for you environment.
- Restart the Couchbase service.
After restarting the Couchbase service, the statistics collection rate is changed.
Changing the stats file location
The default stats file location is /opt/couchbase/var/lib/couchbase/stats , however, if you want to change the default stats file location, create a symlink location to the new directory.