Какой анализ я должен учитывать при определении свойств источника данных в Hikari? Приложение Mi имеет 1200 запросов в минуту, время отклика составляет около 320 мс, все работает в AWS, я получаю 0,3% ошибки.
вызвано
com.zaxxer.hikari.pool.HikariPool $ PoolInitializationException: Ошибка
инициализировать пул: слишком много подключений
Я занимался расследованием, но я не понимаю, как определить эффективную конфигурацию для различных сценариев, принимая во внимание RPM, время отклика и механизм базы данных.
https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby
https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration
Это мой фактический конфиг
@Data
@NoArgsConstructor
@ToString
public static class Datasource {
private String username;
private String password;
private String url;
private String schema;
private String driver;
private String host;
private boolean cachePrepStmts = true; //Neither of the above parameters have any effect if the cache is in fact disabled, as it is by default.
private int prepStmtCacheSize = 250; //This sets the number of prepared statements that the MySQL driver will cache per connection.
private int prepStmtCacheSqlLimit = 1024; //<default:256 > This is the maximum length of a prepared SQL statement that the driver will cache
private boolean useServerPrepStmts = true;//Newer versions of MySQL support server-side prepared statements, this can provide a substantial performance boost. Set this property to true.
private int maximumPoolSize = 10; //<default:10> This property controls the maximum size that the pool is allowed to reach, including both idle and in-use connections.
private int maxLifetime = 1800000; //<default:1800000> This property controls the maximum lifetime of a connection in the pool. An in-use connection will never be retired, only when it is closed will it then be removed
private int connectionTimeout = 30000;//<default:30000> This property controls the maximum number of milliseconds that a client (that's you) will wait for a connection from the pool
private int minimumIdle = 5; // <default: same as maximumPoolSize> This property controls the minimum number of idle connections that HikariCP tries to maintain in the pool.
private int idleTimeout = 600000; //<default: 600000> This property controls the maximum amount of time that a connection is allowed to sit idle in the pool.
private int leakDetectionThreshold = 0; //<default> This property controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak.
}