hikari 配置中英对照(译)

hikariCP 配置中英对照
原文(英):https://blog.csdn.net/crazyman2010/article/details/85249311

Frequently used

经常使用的配置

autoCommit
This property controls the default auto-commit behavior of connections returned from the pool. It is a boolean value. Default: true

自动提交
此属性控制从池返回的连接的默认自动提交行为。它是一个布尔值。默认值:真正的

connectionTimeout
This property controls the maximum number of milliseconds that a client (that’s you) will wait for a connection from the pool. If this time is exceeded without a connection becoming available, a SQLException will be thrown. Lowest acceptable connection timeout is 250 ms. Default: 30000 (30 seconds)

连接超时
此属性控制客户端(即您)等待来自池的连接的最大毫秒数。如果在没有连接可用的情况下超过了这个时间,将抛出一个SQLException异常。最低可接受的连接超时是250毫秒。默认值:30000(30秒)

idleTimeout
This property controls the maximum amount of time that a connection is allowed to sit idle in the pool. This setting only applies when minimumIdle is defined to be less than maximumPoolSize. Idle connections will not be retired once the pool reaches minimumIdle connections. Whether a connection is retired as idle or not is subject to a maximum variation of +30 seconds, and average variation of +15 seconds. A connection will never be retired as idle before this timeout. A value of 0 means that idle connections are never removed from the pool. The minimum allowed value is 10000ms (10 seconds). Default: 600000 (10 minutes)

这个属性控制的最大允许的时间连接池中空闲。这个设置只适用于当minimumIdle小于maximumPoolSize定义。空闲连接不会退休一旦达到minimumIdle连接池。是否退休空闲连接的最大变化+
30秒,平均变异+ 15秒。连接永远不会退休之前闲置超时。的值为0意味着空闲连接永远不会从池中删除。允许的最小值是10000
ms(10秒)。默认值:600000(10分钟)

maxLifetime
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. On a connection-by-connection basis, minor negative attenuation is applied to avoid mass-extinction in the pool. We strongly recommend setting this value, and it should be several seconds shorter than any database or infrastructure imposed connection time limit. A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the idleTimeout setting. Default: 1800000 (30 minutes)

此属性控制池中连接的最大生存期。正在使用的连接永远不会退役,只有当它关闭时才会被移除。在逐个连接的基础上,应用了较小的负衰减来避免池中的大规模消光。我们强烈建议设置此值,它应该比任何数据库或基础设施设置的连接时间限制短几秒。值0表示没有最大生存期(无限生存期),当然,这取决于idleTimeout设置。默认值:1800000(30分钟)

connectionTestQuery
If your driver supports JDBC4 we strongly recommend not setting this property. This is for “legacy” drivers that do not support the JDBC4 Connection.isValid() API. This is the query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive. Again, try running the pool without this property, HikariCP will log an error if your driver is not JDBC4 compliant to let you know. Default: none

如果您的驱动程序支持JDBC4,我们强烈建议不要设置此属性。这是针对不支持JDBC4 Connection.isValid() API的“遗留”驱动程序的。这个查询将在连接从池中提供给您之前执行,以验证到数据库的连接是否仍然是活动的。同样,尝试在不使用此属性的情况下运行池,如果您的驱动程序不兼容JDBC4, HikariCP将记录一个错误。默认值:无

minimumIdle
This property controls the minimum number of idle connections that HikariCP tries to maintain in the pool. If the idle connections dip below this value and total connections in the pool are less than maximumPoolSize, HikariCP will make a best effort to add additional connections quickly and efficiently. However, for maximum performance and responsiveness to spike demands, we recommend not setting this value and instead allowing HikariCP to act as a fixed size connection pool. Default: same as maximumPoolSize

该属性控制HikariCP试图在池中维护的空闲连接的最小数量。如果空闲连接低于这个值,并且池中的总连接小于最大池大小,HikariCP将尽最大努力快速有效地添加额外的连接。但是,为了获得最大的性能和对峰值需求的响应,我们建议不要设置这个值,而是允许HikariCP充当固定大小的连接池。默认值:与maximumPoolSize相同

maximumPoolSize
This property controls the maximum size that the pool is allowed to reach, including both idle and in-use connections. Basically this value will determine the maximum number of actual connections to the database backend. A reasonable value for this is best determined by your execution environment. When the pool reaches this size, and no idle connections are available, calls to getConnection() will block for up to connectionTimeout milliseconds before timing out. Please read about pool sizing.Default: 10

此属性控制池允许达到的最大大小,包括空闲连接和正在使用的连接。基本上,这个值将决定到数据库后端的实际连接的最大数量。合理的值最好由您的执行环境决定。当池达到这个大小,并且没有空闲连接可用时,对getConnection()的调用将在超时之前阻塞至多几毫秒的时间。请阅读关于池大小的信息。默认值:10

metricRegistry
This property is only available via programmatic configuration or IoC container. This property allows you to specify an instance of a Codahale/Dropwizard MetricRegistry to be used by the pool to record various metrics. See the Metrics wiki page for details. Default: none

此属性仅可通过编程配置或IoC容器使用。该属性允许您指定Codahale/Dropwizard MetricRegistry的一个实例,该实例将被池用来记录各种指标。有关详细信息,请参见Metrics wiki页面。默认值:无

healthCheckRegistry
This property is only available via programmatic configuration or IoC container. This property allows you to specify an instance of a Codahale/Dropwizard HealthCheckRegistry to be used by the pool to report current health information. See the Health Checks wiki page for details. Default: none

此属性仅可通过编程配置或IoC容器使用。此属性允许您指定一个Codahale/Dropwizard HealthCheckRegistry实例,以供池使用,以报告当前的健康信息。有关详细信息,请参阅Health check wiki页面。默认值:无

poolName
This property represents a user-defined name for the connection pool and appears mainly in logging and JMX management consoles to identify pools and pool configurations. Default: auto-generated

此属性表示连接池的用户定义名称,主要出现在日志和JMX管理控制台中,用于标识池和池配置。默认值:自动生成

Infrequently used

不常使用的

initializationFailTimeout
This property controls whether the pool will “fail fast” if the pool cannot be seeded with an initial connection successfully. Any positive number is taken to be the number of milliseconds to attempt to acquire an initial connection; the application thread will be blocked during this period. If a connection cannot be acquired before this timeout occurs, an exception will be thrown. This timeout is applied after the connectionTimeout period. If the value is zero (0), HikariCP will attempt to obtain and validate a connection. If a connection is obtained, but fails validation, an exception will be thrown and the pool not started. However, if a connection cannot be obtained, the pool will start, but later efforts to obtain a connection may fail. A value less than zero will bypass any initial connection attempt, and the pool will start immediately while trying to obtain connections in the background. Consequently, later efforts to obtain a connection may fail. Default: 1

此属性控制如果不能成功地为池添加初始连接,则池是否将“快速失败”。任何正数都被认为是试图获取初始连接的毫秒数;应用程序线程将在此期间被阻塞。如果在发生超时之前无法获得连接,将抛出异常。此超时将在connectionTimeout期间之后应用。如果值为0 (0),HikariCP将尝试获取并验证连接。如果获得了连接,但验证失败,将抛出异常,池未启动。但是,如果无法获得连接,则池将启动,但是稍后获取连接的尝试可能失败。小于0的值将绕过任何初始连接尝试,池将在尝试在后台获取连接时立即启动。因此,以后获取连接的努力可能会失败。默认值:1

isolateInternalQueries
This property determines whether HikariCP isolates internal pool queries, such as the connection alive test, in their own transaction. Since these are typically read-only queries, it is rarely necessary to encapsulate them in their own transaction. This property only applies if autoCommit is disabled. Default: false

此属性确定HikariCP是否将内部池查询(如连接活动测试)隔离在它们自己的事务中。由于这些查询通常是只读的,因此很少需要将它们封装到自己的事务中。此属性仅在禁用自动提交时适用。默认值:假

allowPoolSuspension
This property controls whether the pool can be suspended and resumed through JMX. This is useful for certain failover automation scenarios. When the pool is suspended, calls to getConnection() will not timeout and will be held until the pool is resumed. Default: false

此属性控制是否可以通过JMX挂起和恢复池。这对于某些故障转移自动化场景非常有用。当池被挂起时,对getConnection()的调用将不会超时,并将一直保持到池恢复。默认值:假

readOnly
This property controls whether Connections obtained from the pool are in read-only mode by default. Note some databases do not support the concept of read-only mode, while others provide query optimizations when the Connection is set to read-only. Whether you need this property or not will depend largely on your application and database. Default: false

此属性控制从池中获得的连接在默认情况下是否处于只读模式。注意,有些数据库不支持只读模式的概念,而其他数据库在连接设置为只读时提供查询优化。是否需要此属性主要取决于您的应用程序和数据库。默认值:假

registerMbeans
This property controls whether or not JMX Management Beans (“MBeans”) are registered or not. Default: false

此属性控制是否注册了JMX管理bean(“mbean”)。默认值:假

catalog
This property sets the default catalog for databases that support the concept of catalogs. If this property is not specified, the default catalog defined by the JDBC driver is used. Default: driver default

此属性为支持编目概念的数据库设置默认编目。如果未指定此属性,则使用JDBC驱动程序定义的默认目录。默认值:司机默认

connectionInitSql
This property sets a SQL statement that will be executed after every new connection creation before adding it to the pool. If this SQL is not valid or throws an exception, it will be treated as a connection failure and the standard retry logic will be followed. Default: none

此属性设置一个SQL语句,该语句将在每个新连接创建后执行,然后将其添加到池中。如果此SQL无效或抛出异常,则将其视为连接失败,并遵循标准的重试逻辑。默认值:无

driverClassName
HikariCP will attempt to resolve a driver through the DriverManager based solely on the jdbcUrl, but for some older drivers the driverClassName must also be specified. Omit this property unless you get an obvious error message indicating that the driver was not found. Default: none

HikariCP将尝试仅基于jdbcUrl通过驱动程序管理器解析驱动程序,但是对于一些较老的驱动程序,也必须指定驱动程序类名。省略此属性,除非您得到一个明显的错误消息,指示没有找到驱动程序。默认值:无

transactionIsolation
This property controls the default transaction isolation level of connections returned from the pool. If this property is not specified, the default transaction isolation level defined by the JDBC driver is used. Only use this property if you have specific isolation requirements that are common for all queries. The value of this property is the constant name from the Connectionclass such as TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ, etc. Default: driver default

此属性控制从池返回的连接的默认事务隔离级别。如果未指定此属性,则使用JDBC驱动程序定义的默认事务隔离级别。仅当您具有对所有查询都通用的特定隔离需求时才使用此属性。这个属性的值是Connectionclass中的常量名,如TRANSACTION_READ_COMMITTED、TRANSACTION_REPEATABLE_READ等。默认值:司机默认

validationTimeout
This property controls the maximum amount of time that a connection will be tested for aliveness. This value must be less than the connectionTimeout. Lowest acceptable validation timeout is 250 ms. Default: 5000

此属性控制将测试连接活性的最大时间量。此值必须小于connectionTimeout。最低可接受的验证超时是250毫秒。默认值:5000

leakDetectionThreshold
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. A value of 0 means leak detection is disabled. Lowest acceptable value for enabling leak detection is 2000 (2 seconds). Default: 0

此属性控制在记录指示可能的连接泄漏的消息之前连接离开池的时间量。值0表示泄漏检测被禁用。启用泄漏检测的最低可接受值是2000(2秒)。默认值:0

dataSource
This property is only available via programmatic configuration or IoC container. This property allows you to directly set the instance of the DataSource to be wrapped by the pool, rather than having HikariCP construct it via reflection. This can be useful in some dependency injection frameworks. When this property is specified, the dataSourceClassName property and all DataSource-specific properties will be ignored. Default: none

此属性仅可通过编程配置或IoC容器使用。此属性允许您直接设置要由池包装的数据源实例,而不是通过反射让HikariCP构造它。这在一些依赖注入框架中非常有用。当指定此属性时,将忽略dataSourceClassName属性和所有特定于数据源的属性。默认值:无

schema
This property sets the default schema for databases that support the concept of schemas. If this property is not specified, the default schema defined by the JDBC driver is used. Default: driver default

此属性为支持模式概念的数据库设置默认模式。如果未指定此属性,则使用JDBC驱动程序定义的默认模式。默认值:司机默认

threadFactory
This property is only available via programmatic configuration or IoC container. This property allows you to set the instance of the java.util.concurrent.ThreadFactory that will be used for creating all threads used by the pool. It is needed in some restricted execution environments where threads can only be created through a ThreadFactory provided by the application container. Default: none

此属性仅可通过编程配置或IoC容器使用。该属性允许您设置java.util.concurrent的实例。将用于创建池使用的所有线程的ThreadFactory。在某些受限制的执行环境中需要它,在这些环境中,线程只能通过应用程序容器提供的ThreadFactory创建。默认值:无

scheduledExecutor
This property is only available via programmatic configuration or IoC container. This property allows you to set the instance of the java.util.concurrent.ScheduledExecutorService that will be used for various internally scheduled tasks. If supplying HikariCP with a ScheduledThreadPoolExecutor instance, it is recommended that setRemoveOnCancelPolicy(true) is used.Default: none

此属性仅可通过编程配置或IoC容器使用。该属性允许您设置java.util.concurrent的实例。ScheduledExecutorService将用于各种内部调度的任务。如果使用ScheduledThreadPoolExecutor实例提供HikariCP,建议使用setRemoveOnCancelPolicy(true)。默认值:无

若有不当请访问原链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值