Skip to content

Commit

Permalink
testing datanucleus
Browse files Browse the repository at this point in the history
  • Loading branch information
givanovexpe committed Jun 26, 2024
1 parent 5bc8655 commit 58e70e6
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
12 changes: 12 additions & 0 deletions k8s-readonly.tf
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ resource "kubernetes_deployment_v1" "apiary_hms_readonly" {
name = "LIMIT_PARTITION_REQUEST_NUMBER"
value = var.hms_ro_request_partition_limit == "" ? "" : var.hms_ro_request_partition_limit
}

dynamic "env" {
for_each = var.hms_additional_environment_variables

Expand All @@ -195,6 +196,17 @@ resource "kubernetes_deployment_v1" "apiary_hms_readonly" {
}
}

dynamic "env" {
for_each = {
for k, v in var.hms_ro_datanucleus_connection_pool_config :
k => v if v != null
}
content {
name = env.key
value = env.value
}
}

liveness_probe {
tcp_socket {
port = var.hive_metastore_port
Expand Down
12 changes: 12 additions & 0 deletions k8s-readwrite.tf
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ resource "kubernetes_deployment_v1" "apiary_hms_readwrite" {
name = "LIMIT_PARTITION_REQUEST_NUMBER"
value = var.hms_rw_request_partition_limit == "" ? "" : var.hms_rw_request_partition_limit
}

dynamic "env" {
for_each = var.hms_additional_environment_variables

Expand All @@ -235,6 +236,17 @@ resource "kubernetes_deployment_v1" "apiary_hms_readwrite" {
}
}

dynamic "env" {
for_each = {
for k, v in var.hms_rw_datanucleus_connection_pool_config :
k => v if v != null
}
content {
name = env.key
value = env.value
}
}

liveness_probe {
tcp_socket {
port = var.hive_metastore_port
Expand Down
111 changes: 111 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -757,3 +757,114 @@ variable "apiary_common_producer_iamroles" {
type = list(string)
default = []
}

variable "hms_rw_datanucleus_connection_pool_config" {
type = object({
DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE = number
DATANUCLEUS_CONNECTION_POOL_MIN_IDLE = number //HikariCP
DATANUCLEUS_CONNECTION_POOL_LEAK_DETECTION_THRESHOLD = number //HikariCP
DATANUCLEUS_CONNECTION_POOL_LEAK_MAX_LIFETIME = number //HikariCP
DATANUCLEUS_CONNECTION_POOL_AUTO_COMMIT = bool //HikariCP
DATANUCLEUS_CONNECTION_POOL_IDLE_TIMEOUT = number //HikariCP
DATANUCLEUS_CONNECTION_POOL_CONNECTION_WAIT_TIMEOUT = number //HikariCP
DATANUCLEUS_CONNECTION_POOL_VALIDATION_TIMEOUT = number //HikariCP
DATANUCLEUS_CONNECTION_POOL_NAME = string //HikariCP
DATANUCLEUS_CONNECTION_POOL_REGISTER_MBEANS = bool //HikariCP
})
default = {
DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE = null
DATANUCLEUS_CONNECTION_POOL_MIN_IDLE = null
DATANUCLEUS_CONNECTION_POOL_LEAK_DETECTION_THRESHOLD = null
DATANUCLEUS_CONNECTION_POOL_LEAK_MAX_LIFETIME = null
DATANUCLEUS_CONNECTION_POOL_AUTO_COMMIT = null
DATANUCLEUS_CONNECTION_POOL_IDLE_TIMEOUT = null
DATANUCLEUS_CONNECTION_POOL_CONNECTION_WAIT_TIMEOUT = null
DATANUCLEUS_CONNECTION_POOL_VALIDATION_TIMEOUT = null
DATANUCLEUS_CONNECTION_POOL_NAME = null
DATANUCLEUS_CONNECTION_POOL_REGISTER_MBEANS = null
}
description =<<EOF
DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE - 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.
Default: 10
DATANUCLEUS_CONNECTION_POOL_MIN_IDLE [HikariCP only] - Datanucleus Connection Pool minimum idle number of connection [HikariCP only]
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,
it is recommend not setting this value and instead allowing HikariCP to act as a fixed size connection pool.
Default: same as DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE if unset
DATANUCLEUS_CONNECTION_POOL_IDLE_TIMEOUT [HikariCP only] - Datanucleus Connection Pool minimum idle number of connection [HikariCP only]
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)
DATANUCLEUS_CONNECTION_POOL_LEAK_DETECTION_THRESHOLD [HikariCP only] - 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
DATANUCLEUS_CONNECTION_POOL_LEAK_MAX_LIFETIME [HikariCP only] - 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.
The minimum allowed value is 30000ms (30 seconds).
Default: 1800000 (30 minutes)
DATANUCLEUS_CONNECTION_POOL_AUTO_COMMIT [HikariCP only] - This property controls the default auto-commit behavior of connections
returned from the pool. It is a boolean value.
Default: true
DATANUCLEUS_CONNECTION_POOL_CONNECTION_WAIT_TIMEOUT [HikariCP only] - 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)
DATANUCLEUS_CONNECTION_POOL_VALIDATION_TIMEOUT [HikariCP only] - 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
DATANUCLEUS_CONNECTION_POOL_NAME [HikariCP only] - 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
DATANUCLEUS_CONNECTION_POOL_REGISTER_MBEANS [HikariCP only] - This property controls whether or not JMX Management Beans ("MBeans")
are registered or not.
Default: false
EOF
}

variable "hms_ro_datanucleus_connection_pool_config" {
type = object({
DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE = number
DATANUCLEUS_CONNECTION_POOL_MIN_IDLE = number
DATANUCLEUS_CONNECTION_POOL_LEAK_DETECTION_THRESHOLD = number
DATANUCLEUS_CONNECTION_POOL_LEAK_MAX_LIFETIME = number
DATANUCLEUS_CONNECTION_POOL_AUTO_COMMIT = bool
DATANUCLEUS_CONNECTION_POOL_IDLE_TIMEOUT = number
DATANUCLEUS_CONNECTION_POOL_CONNECTION_WAIT_TIMEOUT = number
DATANUCLEUS_CONNECTION_POOL_VALIDATION_TIMEOUT = number
DATANUCLEUS_CONNECTION_POOL_NAME = string
DATANUCLEUS_CONNECTION_POOL_REGISTER_MBEANS = bool
})
default = {
DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE = null
DATANUCLEUS_CONNECTION_POOL_MIN_IDLE = null
DATANUCLEUS_CONNECTION_POOL_LEAK_DETECTION_THRESHOLD = null
DATANUCLEUS_CONNECTION_POOL_LEAK_MAX_LIFETIME = null
DATANUCLEUS_CONNECTION_POOL_AUTO_COMMIT = null
DATANUCLEUS_CONNECTION_POOL_IDLE_TIMEOUT = null
DATANUCLEUS_CONNECTION_POOL_CONNECTION_WAIT_TIMEOUT = null
DATANUCLEUS_CONNECTION_POOL_VALIDATION_TIMEOUT = null
DATANUCLEUS_CONNECTION_POOL_NAME = null
DATANUCLEUS_CONNECTION_POOL_REGISTER_MBEANS = null
}
}

0 comments on commit 58e70e6

Please sign in to comment.