mirror of https://github.com/apache/cloudstack.git
Merge branch 'scalability-improvements' into scalability-improvements-fixes
This commit is contained in:
commit
0728e9ffdb
|
|
@ -30,9 +30,13 @@ db.cloud.port=3306
|
|||
db.cloud.name=cloud
|
||||
|
||||
# CloudStack database tuning parameters
|
||||
db.cloud.connectionPoolLib=hikaricp
|
||||
db.cloud.maxActive=250
|
||||
db.cloud.maxIdle=30
|
||||
db.cloud.maxWait=600000
|
||||
db.cloud.minIdleConnections=5
|
||||
db.cloud.connectionTimeout=30000
|
||||
db.cloud.keepAliveTime=600000
|
||||
db.cloud.validationQuery=/* ping */ SELECT 1
|
||||
db.cloud.testOnBorrow=true
|
||||
db.cloud.testWhileIdle=true
|
||||
|
|
@ -62,9 +66,13 @@ db.usage.port=3306
|
|||
db.usage.name=cloud_usage
|
||||
|
||||
# usage database tuning parameters
|
||||
db.usage.connectionPoolLib=hikaricp
|
||||
db.usage.maxActive=100
|
||||
db.usage.maxIdle=30
|
||||
db.usage.maxWait=600000
|
||||
db.usage.minIdleConnections=5
|
||||
db.usage.connectionTimeout=30000
|
||||
db.usage.keepAliveTime=600000
|
||||
db.usage.url.params=serverTimezone=UTC
|
||||
|
||||
# Simulator database settings
|
||||
|
|
@ -74,9 +82,13 @@ db.simulator.host=@DBHOST@
|
|||
db.simulator.driver=@DBDRIVER@
|
||||
db.simulator.port=3306
|
||||
db.simulator.name=simulator
|
||||
db.simulator.connectionPoolLib=hikaricp
|
||||
db.simulator.maxActive=250
|
||||
db.simulator.maxIdle=30
|
||||
db.simulator.maxWait=600000
|
||||
db.simulator.minIdleConnections=5
|
||||
db.simulator.connectionTimeout=30000
|
||||
db.simulator.keepAliveTime=600000
|
||||
db.simulator.autoReconnect=true
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@
|
|||
<groupId>org.eclipse.persistence</groupId>
|
||||
<artifactId>javax.persistence</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
|
|
|
|||
|
|
@ -33,14 +33,23 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.commons.dbcp2.ConnectionFactory;
|
||||
import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
|
||||
import org.apache.commons.dbcp2.PoolableConnection;
|
||||
import org.apache.commons.dbcp2.PoolableConnectionFactory;
|
||||
import org.apache.commons.dbcp2.PoolingDataSource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.pool2.ObjectPool;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.mgmt.JmxUtil;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
/**
|
||||
* Transaction abstracts away the Connection object in JDBC. It allows the
|
||||
|
|
@ -88,6 +97,8 @@ public class TransactionLegacy implements Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
private static final String CONNECTION_POOL_LIB_DBCP = "dbcp";
|
||||
|
||||
private final LinkedList<StackElement> _stack;
|
||||
private long _id;
|
||||
|
||||
|
|
@ -1013,6 +1024,21 @@ public class TransactionLegacy implements Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
private static <T extends Number> T parseNumber(String value, Class<T> type) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (type.equals(Long.class)) {
|
||||
return type.cast(Long.parseLong(value));
|
||||
} else {
|
||||
return type.cast(Integer.parseInt(value));
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void initDataSource(Properties dbProps) {
|
||||
try {
|
||||
|
|
@ -1023,9 +1049,12 @@ public class TransactionLegacy implements Closeable {
|
|||
s_logger.info("Is Data Base High Availiability enabled? Ans : " + s_dbHAEnabled);
|
||||
String loadBalanceStrategy = dbProps.getProperty("db.ha.loadBalanceStrategy");
|
||||
// FIXME: If params are missing...default them????
|
||||
final int cloudMaxActive = Integer.parseInt(dbProps.getProperty("db.cloud.maxActive"));
|
||||
final int cloudMaxIdle = Integer.parseInt(dbProps.getProperty("db.cloud.maxIdle"));
|
||||
final long cloudMaxWait = Long.parseLong(dbProps.getProperty("db.cloud.maxWait"));
|
||||
final Integer cloudMaxActive = parseNumber(dbProps.getProperty("db.cloud.maxActive"), Integer.class);
|
||||
final Integer cloudMaxIdle = parseNumber(dbProps.getProperty("db.cloud.maxIdle"), Integer.class);
|
||||
final Long cloudMaxWait = parseNumber(dbProps.getProperty("db.cloud.maxWait"), Long.class);
|
||||
final Integer cloudMinIdleConnections = parseNumber(dbProps.getProperty("db.cloud.minIdleConnections"), Integer.class);
|
||||
final Long cloudConnectionTimeout = parseNumber(dbProps.getProperty("db.cloud.connectionTimeout"), Long.class);
|
||||
final Long cloudKeepAliveTimeout = parseNumber(dbProps.getProperty("db.cloud.keepAliveTime"), Long.class);
|
||||
final String cloudUsername = dbProps.getProperty("db.cloud.username");
|
||||
final String cloudPassword = dbProps.getProperty("db.cloud.password");
|
||||
final String cloudHost = dbProps.getProperty("db.cloud.host");
|
||||
|
|
@ -1080,14 +1109,19 @@ public class TransactionLegacy implements Closeable {
|
|||
DriverLoader.loadDriver(cloudDriver);
|
||||
|
||||
// Default Data Source for CloudStack
|
||||
s_ds = createDataSource(cloudConnectionUri, cloudUsername, cloudPassword, cloudMaxActive, cloudMaxIdle, cloudMaxWait,
|
||||
cloudTimeBtwEvictionRunsMillis, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle, cloudTestOnBorrow,
|
||||
cloudValidationQuery, isolationLevel, "cloud");
|
||||
s_ds = createDataSource(dbProps.getProperty("db.cloud.connectionPoolLib"), cloudConnectionUri,
|
||||
cloudUsername, cloudPassword, cloudMaxActive, cloudMaxIdle, cloudMaxWait,
|
||||
cloudTimeBtwEvictionRunsMillis, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle,
|
||||
cloudTestOnBorrow, cloudValidationQuery, cloudMinIdleConnections, cloudConnectionTimeout,
|
||||
cloudKeepAliveTimeout, isolationLevel, "cloud");
|
||||
|
||||
// Configure the usage db
|
||||
final int usageMaxActive = Integer.parseInt(dbProps.getProperty("db.usage.maxActive"));
|
||||
final int usageMaxIdle = Integer.parseInt(dbProps.getProperty("db.usage.maxIdle"));
|
||||
final long usageMaxWait = Long.parseLong(dbProps.getProperty("db.usage.maxWait"));
|
||||
final Integer usageMaxActive = parseNumber(dbProps.getProperty("db.usage.maxActive"), Integer.class);
|
||||
final Integer usageMaxIdle = parseNumber(dbProps.getProperty("db.usage.maxIdle"), Integer.class);
|
||||
final Long usageMaxWait = parseNumber(dbProps.getProperty("db.usage.maxWait"), Long.class);
|
||||
final Integer usageMinIdleConnections = parseNumber(dbProps.getProperty("db.usage.minIdleConnections"), Integer.class);
|
||||
final Long usageConnectionTimeout = parseNumber(dbProps.getProperty("db.usage.connectionTimeout"), Long.class);
|
||||
final Long usageKeepAliveTimeout = parseNumber(dbProps.getProperty("db.usage.keepAliveTime"), Long.class);
|
||||
final String usageUsername = dbProps.getProperty("db.usage.username");
|
||||
final String usagePassword = dbProps.getProperty("db.usage.password");
|
||||
final String usageHost = dbProps.getProperty("db.usage.host");
|
||||
|
|
@ -1103,15 +1137,19 @@ public class TransactionLegacy implements Closeable {
|
|||
DriverLoader.loadDriver(usageDriver);
|
||||
|
||||
// Data Source for usage server
|
||||
s_usageDS = createDataSource(usageConnectionUri, usageUsername, usagePassword,
|
||||
usageMaxActive, usageMaxIdle, usageMaxWait, null, null, null, null,
|
||||
null, isolationLevel, "usage");
|
||||
s_usageDS = createDataSource(dbProps.getProperty("db.usage.connectionPoolLib"), usageConnectionUri,
|
||||
usageUsername, usagePassword, usageMaxActive, usageMaxIdle, usageMaxWait, null,
|
||||
null, null, null, null,
|
||||
usageMinIdleConnections, usageConnectionTimeout, usageKeepAliveTimeout, isolationLevel, "usage");
|
||||
|
||||
try {
|
||||
// Configure the simulator db
|
||||
final int simulatorMaxActive = Integer.parseInt(dbProps.getProperty("db.simulator.maxActive"));
|
||||
final int simulatorMaxIdle = Integer.parseInt(dbProps.getProperty("db.simulator.maxIdle"));
|
||||
final long simulatorMaxWait = Long.parseLong(dbProps.getProperty("db.simulator.maxWait"));
|
||||
final Integer simulatorMaxActive = parseNumber(dbProps.getProperty("db.simulator.maxActive"), Integer.class);
|
||||
final Integer simulatorMaxIdle = parseNumber(dbProps.getProperty("db.simulator.maxIdle"), Integer.class);
|
||||
final Long simulatorMaxWait = parseNumber(dbProps.getProperty("db.simulator.maxWait"), Long.class);
|
||||
final Integer simulatorMinIdleConnections = parseNumber(dbProps.getProperty("db.simulator.minIdleConnections"), Integer.class);
|
||||
final Long simulatorConnectionTimeout = parseNumber(dbProps.getProperty("db.simulator.connectionTimeout"), Long.class);
|
||||
final Long simulatorKeepAliveTimeout = parseNumber(dbProps.getProperty("db.simulator.keepAliveTime"), Long.class);
|
||||
final String simulatorUsername = dbProps.getProperty("db.simulator.username");
|
||||
final String simulatorPassword = dbProps.getProperty("db.simulator.password");
|
||||
final String simulatorHost = dbProps.getProperty("db.simulator.host");
|
||||
|
|
@ -1124,15 +1162,18 @@ public class TransactionLegacy implements Closeable {
|
|||
simulatorAutoReconnect;
|
||||
DriverLoader.loadDriver(simulatorDriver);
|
||||
|
||||
s_simulatorDS = createDataSource(simulatorConnectionUri, simulatorUsername, simulatorPassword,
|
||||
simulatorMaxActive, simulatorMaxIdle, simulatorMaxWait, null, null, null, null, cloudValidationQuery, isolationLevel, "simulator");
|
||||
s_simulatorDS = createDataSource(dbProps.getProperty("db.simulator.connectionPoolLib"),
|
||||
simulatorConnectionUri, simulatorUsername, simulatorPassword, simulatorMaxActive,
|
||||
simulatorMaxIdle, simulatorMaxWait, null, null, null, null,
|
||||
cloudValidationQuery, simulatorMinIdleConnections, simulatorConnectionTimeout,
|
||||
simulatorKeepAliveTimeout, isolationLevel, "simulator");
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Simulator DB properties are not available. Not initializing simulator DS");
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
s_ds = getDefaultDataSource("cloud");
|
||||
s_usageDS = getDefaultDataSource("cloud_usage");
|
||||
s_simulatorDS = getDefaultDataSource("simulator");
|
||||
s_ds = getDefaultDataSource(dbProps.getProperty("db.cloud.connectionPoolLib"), "cloud");
|
||||
s_usageDS = getDefaultDataSource(dbProps.getProperty("db.usage.connectionPoolLib"), "cloud_usage");
|
||||
s_simulatorDS = getDefaultDataSource(dbProps.getProperty("db.simulator.connectionPoolLib"), "simulator");
|
||||
s_logger.warn(
|
||||
"Unable to load db configuration, using defaults with 5 connections. Falling back on assumed datasource on localhost:3306 using username:password=cloud:cloud. Please check your configuration",
|
||||
e);
|
||||
|
|
@ -1142,45 +1183,38 @@ public class TransactionLegacy implements Closeable {
|
|||
/**
|
||||
* Creates a data source
|
||||
*/
|
||||
private static DataSource createDataSource(String uri, String username, String password,
|
||||
private static DataSource createDataSource(String connectionPoolLib, String uri, String username, String password,
|
||||
Integer maxActive, Integer maxIdle, Long maxWait, Long timeBtwnEvictionRuns, Long minEvictableIdleTime,
|
||||
Boolean testWhileIdle, Boolean testOnBorrow, String validationQuery, Integer minIdleConnections,
|
||||
Long connectionTimeout, Long keepAliveTime, Integer isolationLevel, String dsName) {
|
||||
s_logger.debug(String.format("Creating datasource for database: %s with connection pool lib: %s", dsName,
|
||||
connectionPoolLib));
|
||||
if (CONNECTION_POOL_LIB_DBCP.equals(connectionPoolLib)) {
|
||||
return createDbcpDataSource(uri, username, password, maxActive, maxIdle, maxWait, timeBtwnEvictionRuns,
|
||||
minEvictableIdleTime, testWhileIdle, testOnBorrow, validationQuery, isolationLevel);
|
||||
}
|
||||
return createHikaricpDataSource(uri, username, password, maxActive, maxIdle, maxWait, minIdleConnections,
|
||||
connectionTimeout, keepAliveTime, isolationLevel, dsName);
|
||||
}
|
||||
|
||||
private static DataSource createHikaricpDataSource(String uri, String username, String password,
|
||||
Integer maxActive, Integer maxIdle, Long maxWait,
|
||||
Long timeBtwnEvictionRuns, Long minEvictableIdleTime,
|
||||
Boolean testWhileIdle, Boolean testOnBorrow,
|
||||
String validationQuery, Integer isolationLevel,
|
||||
String dsName) {
|
||||
Integer minIdleConnections, Long connectionTimeout, Long keepAliveTime,
|
||||
Integer isolationLevel, String dsName) {
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl(uri);
|
||||
config.setUsername(username);
|
||||
config.setPassword(password);
|
||||
|
||||
//int numOfCores = Runtime.getRuntime().availableProcessors();
|
||||
//config.setMaximumPoolSize(numOfCores * 4 + 16);
|
||||
if (maxActive != null) {
|
||||
config.setMaximumPoolSize(maxActive);
|
||||
} else {
|
||||
config.setMaximumPoolSize(250); // 250 connections
|
||||
}
|
||||
|
||||
if (maxIdle != null) {
|
||||
config.setIdleTimeout(maxIdle * 1000);
|
||||
} else {
|
||||
config.setIdleTimeout(30000); // 30 seconds
|
||||
}
|
||||
if (maxWait != null) {
|
||||
config.setMaxLifetime(maxWait);
|
||||
} else {
|
||||
config.setMaxLifetime(600000); // 10 minutes
|
||||
}
|
||||
|
||||
config.setPoolName("hikaricp-pool-" + dsName);
|
||||
config.setPoolName(dsName);
|
||||
|
||||
// Connection pool properties
|
||||
config.setMinimumIdle(5); // Minimum number of idle connections in the pool
|
||||
config.setConnectionTimeout(30000); // 30 seconds in milliseconds
|
||||
config.setKeepaliveTime(600000); // Keepalive time in milliseconds (10 minutes)
|
||||
config.setIdleTimeout(300000); // 5 minutes
|
||||
//config.setMinimumIdle(maxIdle);
|
||||
//config.setConnectionTestQuery("/* ping */ SELECT 1"); // Connection test query
|
||||
config.setMaximumPoolSize(ObjectUtils.defaultIfNull(maxActive, 250));
|
||||
config.setIdleTimeout(ObjectUtils.defaultIfNull(maxIdle, 30) * 1000);
|
||||
config.setMaxLifetime(ObjectUtils.defaultIfNull(maxWait, 600000L));
|
||||
config.setMinimumIdle(ObjectUtils.defaultIfNull(minIdleConnections, 5));
|
||||
config.setConnectionTimeout(ObjectUtils.defaultIfNull(connectionTimeout, 30000L));
|
||||
config.setKeepaliveTime(ObjectUtils.defaultIfNull(keepAliveTime, 600000L));
|
||||
|
||||
String isolationLevelString = "TRANSACTION_READ_COMMITTED";
|
||||
if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) {
|
||||
|
|
@ -1198,19 +1232,62 @@ public class TransactionLegacy implements Closeable {
|
|||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
// Additional config for MySQL
|
||||
config.addDataSourceProperty("useServerPrepStmts", "true");
|
||||
/*
|
||||
config.addDataSourceProperty("useLocalSessionState", "true");
|
||||
config.addDataSourceProperty("rewriteBatchedStatements", "true");
|
||||
config.addDataSourceProperty("cacheResultSetMetadata", "true");
|
||||
config.addDataSourceProperty("cacheServerConfiguration", "true");
|
||||
config.addDataSourceProperty("elideSetAutoCommits", "true");
|
||||
config.addDataSourceProperty("maintainTimeStats", "false");
|
||||
*/
|
||||
|
||||
HikariDataSource dataSource = new HikariDataSource(config);
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
private static DataSource createDbcpDataSource(String uri, String username, String password,
|
||||
Integer maxActive, Integer maxIdle, Long maxWait,
|
||||
Long timeBtwnEvictionRuns, Long minEvictableIdleTime,
|
||||
Boolean testWhileIdle, Boolean testOnBorrow,
|
||||
String validationQuery, Integer isolationLevel) {
|
||||
ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(uri, username, password);
|
||||
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null);
|
||||
GenericObjectPoolConfig config = createPoolConfig(maxActive, maxIdle, maxWait, timeBtwnEvictionRuns, minEvictableIdleTime, testWhileIdle, testOnBorrow);
|
||||
ObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(poolableConnectionFactory, config);
|
||||
poolableConnectionFactory.setPool(connectionPool);
|
||||
if (validationQuery != null) {
|
||||
poolableConnectionFactory.setValidationQuery(validationQuery);
|
||||
}
|
||||
if (isolationLevel != null) {
|
||||
poolableConnectionFactory.setDefaultTransactionIsolation(isolationLevel);
|
||||
}
|
||||
return new PoolingDataSource<>(connectionPool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a GenericObjectPoolConfig configuration usable on connection pool creation
|
||||
*/
|
||||
private static GenericObjectPoolConfig createPoolConfig(Integer maxActive, Integer maxIdle, Long maxWait,
|
||||
Long timeBtwnEvictionRuns, Long minEvictableIdleTime,
|
||||
Boolean testWhileIdle, Boolean testOnBorrow) {
|
||||
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
|
||||
config.setMaxTotal(maxActive);
|
||||
config.setMaxIdle(maxIdle);
|
||||
config.setMaxWaitMillis(maxWait);
|
||||
|
||||
if (timeBtwnEvictionRuns != null) {
|
||||
config.setTimeBetweenEvictionRunsMillis(timeBtwnEvictionRuns);
|
||||
}
|
||||
if (minEvictableIdleTime != null) {
|
||||
config.setMinEvictableIdleTimeMillis(minEvictableIdleTime);
|
||||
}
|
||||
if (testWhileIdle != null) {
|
||||
config.setTestWhileIdle(testWhileIdle);
|
||||
}
|
||||
if (testOnBorrow != null) {
|
||||
config.setTestOnBorrow(testOnBorrow);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static DataSource getDefaultDataSource(final String database) {
|
||||
HikariConfig config = new HikariConfig();
|
||||
|
|
@ -1232,6 +1309,44 @@ public class TransactionLegacy implements Closeable {
|
|||
return new HikariDataSource(config);
|
||||
}
|
||||
|
||||
private static DataSource getDefaultDataSource(final String connectionPoolLib, final String database) {
|
||||
s_logger.debug(String.format("Creating default datasource for database: %s with connection pool lib: %s",
|
||||
database, connectionPoolLib));
|
||||
if (CONNECTION_POOL_LIB_DBCP.equalsIgnoreCase(connectionPoolLib)) {
|
||||
return getDefaultDbcpDataSource(database);
|
||||
}
|
||||
return getDefaultHikaricpDataSource(database);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static DataSource getDefaultHikaricpDataSource(final String database) {
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl("jdbc:mysql://localhost:3306/" + database + "?" + CONNECTION_PARAMS);
|
||||
config.setUsername("cloud");
|
||||
config.setPassword("cloud");
|
||||
config.setPoolName(database);
|
||||
config.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
||||
config.setMaximumPoolSize(250);
|
||||
config.setConnectionTimeout(1000);
|
||||
config.setIdleTimeout(1000);
|
||||
config.setKeepaliveTime(1000);
|
||||
config.setMaxLifetime(1000);
|
||||
config.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
|
||||
config.setInitializationFailTimeout(-1L);
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
config.addDataSourceProperty("prepStmtCacheSize", "250");
|
||||
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
|
||||
return new HikariDataSource(config);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static DataSource getDefaultDbcpDataSource(final String database) {
|
||||
final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://localhost:3306/" + database + "?" + CONNECTION_PARAMS, "cloud", "cloud");
|
||||
final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null);
|
||||
final GenericObjectPool connectionPool = new GenericObjectPool(poolableConnectionFactory);
|
||||
return new PoolingDataSource(connectionPool);
|
||||
}
|
||||
|
||||
private static String getDBHAParams(String dbName, Properties dbProps) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("failOverReadOnly=" + dbProps.getProperty("db." + dbName + ".failOverReadOnly"));
|
||||
|
|
|
|||
|
|
@ -48,5 +48,10 @@
|
|||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
12
pom.xml
12
pom.xml
|
|
@ -100,6 +100,7 @@
|
|||
<cs.commons-validator.version>1.6</cs.commons-validator.version>
|
||||
<cs.configuration.version>1.10</cs.configuration.version>
|
||||
<cs.daemon.version>1.3.3</cs.daemon.version>
|
||||
<cs.dbcp.version>2.9.0</cs.dbcp.version>
|
||||
<cs.hikaricp.version>5.1.0</cs.hikaricp.version>
|
||||
<cs.discovery.version>0.5</cs.discovery.version>
|
||||
<cs.lang.version>2.6</cs.lang.version>
|
||||
|
|
@ -361,6 +362,17 @@
|
|||
<artifactId>commons-daemon</artifactId>
|
||||
<version>${cs.daemon.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
<version>${cs.dbcp.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>org.apache.commons</artifactId>
|
||||
<groupId>commons-pool2</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
|
|
|
|||
|
|
@ -617,11 +617,7 @@ export default {
|
|||
}).then(json => {
|
||||
this.editableValueKey = null
|
||||
this.$store.dispatch('RefreshFeatures')
|
||||
var message = `${this.$t('message.setting.updated')} ${record.name}`
|
||||
if (record.isdynamic) {
|
||||
message += `. ${this.$t('message.setting.update.delay')}`
|
||||
}
|
||||
this.$message.success(message)
|
||||
this.$messageConfigSuccess(`${this.$t('message.setting.updated')} ${record.name}`, record)
|
||||
if (json.updateconfigurationresponse &&
|
||||
json.updateconfigurationresponse.configuration &&
|
||||
!json.updateconfigurationresponse.configuration.isdynamic &&
|
||||
|
|
@ -642,11 +638,7 @@ export default {
|
|||
api('resetConfiguration', {
|
||||
name: item.name
|
||||
}).then(() => {
|
||||
var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}`
|
||||
if (item.isdynamic) {
|
||||
message += `. ${this.$t('message.setting.update.delay')}`
|
||||
}
|
||||
this.$message.success(message)
|
||||
this.$messageConfigSuccess(`${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}`, item)
|
||||
}).catch(error => {
|
||||
console.error(error)
|
||||
this.$message.error(this.$t('message.error.reset.config'))
|
||||
|
|
|
|||
|
|
@ -175,10 +175,7 @@ export default {
|
|||
value: this.editableValue
|
||||
}).then(() => {
|
||||
var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.update.to')} ${this.editableValue}`
|
||||
if (item.isdynamic) {
|
||||
message += `. ${this.$t('message.setting.update.delay')}`
|
||||
}
|
||||
this.handleSuccessMessage(item.name, this.$route.meta.name, message)
|
||||
this.handleSuccessMessage(item, this.$route.meta.name, message)
|
||||
}).catch(error => {
|
||||
console.error(error)
|
||||
this.$message.error(this.$t('message.error.save.setting'))
|
||||
|
|
@ -208,10 +205,7 @@ export default {
|
|||
name: item.name
|
||||
}).then(() => {
|
||||
var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}`
|
||||
if (item.isdynamic) {
|
||||
message += `. ${this.$t('message.setting.update.delay')}`
|
||||
}
|
||||
this.handleSuccessMessage(item.name, this.$route.meta.name, message)
|
||||
this.handleSuccessMessage(item, this.$route.meta.name, message)
|
||||
}).catch(error => {
|
||||
console.error(error)
|
||||
this.$message.error(this.$t('message.error.reset.config'))
|
||||
|
|
@ -226,12 +220,16 @@ export default {
|
|||
})
|
||||
})
|
||||
},
|
||||
handleSuccessMessage (name, scope, message) {
|
||||
var obj = this.warningMessages[name]
|
||||
handleSuccessMessage (config, scope, message) {
|
||||
var obj = this.warningMessages[config.name]
|
||||
if (obj && obj.scope === scope) {
|
||||
this.$warning({ title: message, content: obj.warning })
|
||||
var content = obj.warning
|
||||
if (config.isdynamic) {
|
||||
content = `this.$t('message.setting.update.delay').\n ${content}`
|
||||
}
|
||||
this.$warning({ title: message, content: content })
|
||||
} else {
|
||||
this.$message.success(message)
|
||||
this.$messageConfigSuccess(message, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,6 +288,13 @@ export const notifierPlugin = {
|
|||
close: (key) => notification.close(key),
|
||||
destroy: () => notification.destroy()
|
||||
}
|
||||
|
||||
app.config.globalProperties.$messageConfigSuccess = function (msg, configrecord) {
|
||||
if (configrecord.isdynamic) {
|
||||
msg += `. ${this.$t('message.setting.update.delay')}`
|
||||
}
|
||||
message.success(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -250,11 +250,7 @@ export default {
|
|||
this.actualValue = this.editableValue
|
||||
this.$emit('change-config', { value: newValue })
|
||||
this.$store.dispatch('RefreshFeatures')
|
||||
var message = `${this.$t('message.setting.updated')} ${configrecord.name}`
|
||||
if (configrecord.isdynamic) {
|
||||
message += `. ${this.$t('message.setting.update.delay')}`
|
||||
}
|
||||
this.$message.success(message)
|
||||
this.$messageConfigSuccess(`${this.$t('message.setting.updated')} ${configrecord.name}`, configrecord)
|
||||
if (json.updateconfigurationresponse &&
|
||||
json.updateconfigurationresponse.configuration &&
|
||||
!json.updateconfigurationresponse.configuration.isdynamic &&
|
||||
|
|
@ -291,11 +287,7 @@ export default {
|
|||
}
|
||||
this.$emit('change-config', { value: newValue })
|
||||
this.$store.dispatch('RefreshFeatures')
|
||||
var message = `${this.$t('label.setting')} ${configrecord.name} ${this.$t('label.reset.config.value')}`
|
||||
if (configrecord.isdynamic) {
|
||||
message += `. ${this.$t('message.setting.update.delay')}`
|
||||
}
|
||||
this.$message.success(message)
|
||||
this.$messageConfigSuccess(`${this.$t('label.setting')} ${configrecord.name} ${this.$t('label.reset.config.value')}`, configrecord)
|
||||
if (json.resetconfigurationresponse &&
|
||||
json.resetconfigurationresponse.configuration &&
|
||||
!json.resetconfigurationresponse.configuration.isdynamic &&
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@ db.usage.port=3306
|
|||
db.usage.name=cloud_usage
|
||||
|
||||
# usage database tuning parameters
|
||||
db.usage.connectionPoolLib=hikaricp
|
||||
db.usage.maxActive=100
|
||||
db.usage.maxIdle=30
|
||||
db.usage.maxWait=10000
|
||||
db.usage.minIdleConnections=5
|
||||
db.usage.connectionTimeout=30000
|
||||
db.usage.keepAliveTime=600000
|
||||
db.usage.autoReconnect=true
|
||||
|
|
|
|||
Loading…
Reference in New Issue