9.1 调整内存

本节介绍如何调整 MySQL Enterprise Service Manager 安装可用的资源。

调整 Tomcat

如果您遇到 MySQL Enterprise Service Manager 性能问题,增加可用于与 Tomcat 一起安装的 JVM 的 RAM 量可以解决这些问题。JVM 内存设置由 设置 Tomcat 环境变量 JAVA_OPTS的文件行 定义。setenv

表 9.1 Apache Tomcat 环境文件位置(默认)

操作系统 小路

微软Windows

C:\Program Files\MySQL\Enterprise\Monitor\apache-tomcat\bin\setenv.bat

Linux/Unix

/opt/mysql/enterprise/monitor/apache-tomcat/bin/setenv.sh

苹果系统

/Applications/mysql/enterprise/monitor/apache-tomcat/bin/setenv.sh


以下setenv变量由安装类型定义:

表 9.2 安装参数

范围 小的 中等的 大的

Tomcat 堆大小

512MB

768MB

2048MB

Tomcat 的 MaxPermSize

200MB

512MB

1024MB


  • --JvmMs(Windows)/ -Xms (所有其他平台):设置 Tomcat JVM 堆的最小大小。

  • --JvmMx(Windows)/ -Xmx (所有其他平台):设置 Tomcat JVM 堆的最大大小。

    最小和最大堆大小设置为相同的值,以便从启动时将所有可用内存设置为供 Tomcat JVM 单独使用。

  • MaxPermSize: defines the maximum size of the pool containing the data used by Tomcat's JVM.

    Important

    MaxPermSize is not supported in Java 8. This parameter is not present in new installations of MySQL Enterprise Service Manager, but is not removed by the upgrade process. As a result, a log message is generated explaining the deprecation of the parameter.

This can be adjusted depending on the size of your installation, and the free memory on the host that MySQL Enterprise Service Manager is installed upon. For example, if you have installed MySQL Enterprise Service Manager on a well-resourced server with a 64-bit operating system, 64GB of RAM, and are monitoring more than 100 agents, increasing the heap size to 5 or 6GB may be necessary. This depends on the MySQL server load, and amount of data collected by the agents.

Important

If you change these settings, you must restart MySQL Enterprise Service Manager.

The following are examples of medium-sized, default settings, as defined by the medium installation choice:

UNIX, Linux, and Mac

JAVA_OPTS="-Xmx768M -Xms768M -XX:+HeapDumpOnOutOfMemoryError 
  -XX:HeapDumpPath=/opt/mysql/enterprise/monitor/apache-tomcat/temp 
  -XX:+UseParallelOldGC -XX:MaxPermSize=512M"

Microsoft Windows

set JAVA_OPTS=--JvmMs 768 --JvmMx 768 ++JvmOptions="-XX:+UseParallelOldGC" 
  ++JvmOptions="-XX:+HeapDumpOnOutOfMemoryError" 
  ++JvmOptions="-XX:HeapDumpPath=@@BITROCK_TOMCAT_ROOTDIR@@\temp" 
  ++JvmOptions="-XX:MaxPermSize=512M"

If MySQL Enterprise Service Manager is insufficiently resourced, the monitoring agents are also affected. If the agents are unable to communicate with MySQL Enterprise Service Manager, their performance also degrades.

Tuning InnoDB Memory

MySQL Enterprise Monitor repository uses the InnoDB storage engine. The installation process sets a default value for InnoDB based on the installation size. Tuning the InnoDB Buffer Pool can have a significant impact on performance, for both interaction with the Web UI, and overall resource requirements on the host.

The configuration file for the repository can be found in the following locations:

Table 9.3 MySQL Enterprise Service Manager repository configuration file location (default)

Operating System Path

Microsoft Windows

C:\Program Files\MySQL\Enterprise\Monitor\mysql\my.ini

Linux / Unix

home/mysql/enterprise/monitor/mysql/my.cnf

macOS

/Applications/mysql/enterprise/monitor/mysql/my.cnf


It is possible to increase the value of the innodb_buffer_pool_size variable to as high as 80% of the physical memory available on the host machine. It is not recommended to raise it higher.