This repository contains several tools to monitor the behaviours of a long running MonetDB server.
This script monitors the consumption of several resources of a long running mserver5
process.
The logs generated by this script can help detect the growth of resource consumptions and the potential causes.
The logs are both written to a log file and printed on screen. Currently, the information is logged as follows:
Once per LOG_INTERVAL
seconds, one line of the following information is written to this log file:
ts dbsz rss vmsz maps fds
where
ts
: current time stamp in seconds in ISO 8601 format with local timezone info.dbsz
: total size of the database directory on disk in GBrss
: RSS usage in GBvmsz
: virtual memory usage in GBmaps
: number of memory-mapped filesfds
: number of open file descriptors
Each time the number of memory-mapped files has grown with MMAP_INCREASE
, log the contents of /proc/$(pgrep mserver5)/maps
in this log file.
Each time the number of open file descriptors has grown with FD_INCREASE
, log the FDs in /proc/$(pgrep mserver5)/fd
in this log file.
Once per DBCHK_INTERVAL
seconds, run some checks on the data contained in the database.
Currently, we run a SELECT COUNT(*)
query on each table which has been created by a database user (i.e. sys.tables.system = false
).
--dbname
: If there is only onemserver5
process. Otherwise, one can specify the database to monitor with this option.--logbase
: by default, resource consumption, memory mapped files, open file descriptions and database check are written to the files_<dbname>.log
,_<dbname>.log.maps
,_<dbname>.log.fds
and_<dbname>.log.dbchk
in the current directory. With the--logbase
option, one can specify a prefix to the default log filenames, or specify an absolute or relative path, or both.--log-interval
: specified how often (in number of seconds) the resource consumption should be logged; by default, every 5 seconds.--dbcheck-interval
: specified how often (in number of seconds) the database should be checked; by default, every 1800 seconds.--mmap-increase
: specified how often (in number of memory-mapped files) the memory-mapped files should be logged; by default, every 5000 more.--fd-increase
: specified how often (in number of file descriptors) the open file descriptors should be logged; by default, every 100 more.
This is the script on which monitor.py
is based.
It monitors less information, but plots the monitored data.
Probably works on all Linux systems with bash.
Make sure you have installed matplotlib
and all of its dependencies.
Just run
./plot.py <db_path> <mserver5-pid>
It should pop up a matplotlib display with three graphs:
- virtual memory usage
- resident set size
- database disk footprint.
The script assumes there is a single mserver5
running.
Set <db_path>
to a valid relative or absolute path pointing to the root of the database, i.e. what is passed to the --dbpath
parameter of mserver5
.