11.13. 容量策略
JBoss EAP 支持为 Jakarta Connectors 部署定义容量策略,包括数据源。容量策略定义了如何创建池的物理连接,称为容量递增和销毁,称为容量减少。默认策略设置为为每个请求创建一个容量递增的连接,并在为容量减少调度空闲超时时销毁所有连接。
要配置容量策略,您需要指定容量递增类、容量减少类或两者。
示例:定义容量策略
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-incrementer-class, value="org.jboss.jca.core.connectionmanager.pool.capacity.SizeIncrementer") /subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-decrementer-class, value="org.jboss.jca.core.connectionmanager.pool.capacity.SizeDecrementer")
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-incrementer-class, value="org.jboss.jca.core.connectionmanager.pool.capacity.SizeIncrementer")
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-decrementer-class, value="org.jboss.jca.core.connectionmanager.pool.capacity.SizeDecrementer")
您还可以配置指定容量递增或减少类的属性。
示例:为容量策略配置属性
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-incrementer-properties.size, value=2) /subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-decrementer-properties.size, value=2)
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-incrementer-properties.size, value=2)
/subsystem=datasources/data-source=ExampleDS:write-attribute(name=capacity-decrementer-properties.size, value=2)
MaxPoolSize incrementer 策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.MaxPoolSizeIncrementer
MaxPoolSize incrementer 策略会将池填充到每个请求的最大值中。当您要保持所有可用连接的最大数量时,此策略很有用。
大小递增策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.SizeIncrementer
Size incrementer 策略将根据每个请求的指定连接数填充池。当您要递增每个请求时,这个策略很有用,因为下一个请求还需要连接。
| Name | 描述 |
|---|---|
| Size | 应该创建的连接数 |
这是默认的递增策略,大小为 1。
watermark incrementer 策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.WatermarkIncrementer
Watermark 递增程序策略会将池填充到每个请求的指定连接数。当您希望始终在池中保留指定数量的连接时,此策略很有用。
| Name | 描述 |
|---|---|
| watermark | 连接数的水位线级别 |
MinPoolSize decrementer 策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.MinPoolSizeDecrementer
MinPoolSize decrementer 策略会将池减少到每个请求的最小大小。当您要限制每个闲置超时请求后的连接数量时,此策略很有用。该池将以 First Out (FIFO)的方式运行。
大小减少器策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.SizeDecrementer
Size decrementer 策略会减少每个空闲超时请求的指定连接数的池。
| Name | 描述 |
|---|---|
| Size | 应该销毁的连接数量 |
当您要减少每个闲置超时请求的附加数量时,此策略很有用,因为池使用量会随时间减少。
该池将以 First Out (FIFO)的方式运行。
timedout decrementer 策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.TimedOutDecrementer
TimedOut decrementer 策略将删除每个空闲超时请求池中超时的所有连接。该池将以 First In Last Out (FILO)方式运行。
此策略是默认的减少策略。
timedout/FIFO decrementer 策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.TimedOutFIFODecrementer
TimedOutFIFO decrementer 策略将删除每个空闲超时请求池中超时的所有连接。该池将以 First Out (FIFO)的方式运行。
watermark decrementer 策略
类名称 :org.jboss.jca.core.connectionmanager.pool.capacity.WatermarkDecrementer
Watermark decrementer 策略会将池减少到每个空闲超时请求的指定连接数。当您希望始终在池中保留指定数量的连接时,此策略很有用。该池将以 First Out (FIFO)的方式运行。
| Name | 描述 |
|---|---|
| watermark | 连接数的水位线级别 |