Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

S3: Update maxconn and npthread values from haproxy config #1756

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions scripts/provisioning/s3_haproxy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def process(self):
setup_type = str(self.get_config_with_defaults('CONFIG>CONFSTORE_SETUP_TYPE'))

Log.info(f'Setup type is {setup_type}')
self.setup_size =str(self.get_config_with_defaults('CONFIG>CONFSTORE_SETUP_SIZE'))
Log.info(f'Setup size is : {self.setup_size}')

if ("K8" == setup_type) :
self.configure_haproxy_k8()
Expand Down Expand Up @@ -212,6 +214,19 @@ def configure_haproxy_k8(self):
s3backendport = self.get_s3server_backend_port()
s3authbendport = self.get_s3auth_backend_port()

# update maxconn value and nbproc/nbthread value based on
# setup size value mentioned in solution.yaml
if self.setup_size == "large" :
maxconn_global_section_value = "1000"
maxconn_default_section_value = "1000"
nb_key = "nbthread"
nb_value = "16"
else:
maxconn_global_section_value = "13"
maxconn_default_section_value = "3000"
nb_key = "nbproc"
nb_value = "2"

config_file = os.path.join(baseconfig_path, 's3/haproxy.cfg')
errors_file = self.get_confkey("S3_HAPROXY_ERROR_CONFIG_FILE")
global_text = '''global
Expand Down Expand Up @@ -244,10 +259,10 @@ def configure_haproxy_k8(self):

chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 13
maxconn %s
user haproxy
group haproxy
nbproc 2
%s %s
daemon

# turn on stats unix socket and dynamic configuration reload
Expand Down Expand Up @@ -284,7 +299,7 @@ def configure_haproxy_k8(self):
timeout server 360s
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
maxconn %s
'''
frontend_s3main_text = '''
#----------------------------------------------------------------------
Expand Down Expand Up @@ -331,8 +346,8 @@ def configure_haproxy_k8(self):
default-server inter 2s fastinter 100 rise 1 fall 5 on-error fastinter
'''
config_handle = open(config_file, "w+")
config_handle.write(global_text)
config_handle.write(default_text % errors_file)
config_handle.write(global_text % (maxconn_global_section_value, nb_key, nb_value))
config_handle.write(default_text % (errors_file, maxconn_default_section_value))
config_handle.write(frontend_s3main_text)
config_handle.write(
" bind 0.0.0.0:%s\n"
Expand Down
2 changes: 2 additions & 0 deletions scripts/provisioning/s3_prov_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PREPARE:
CONFIG:
# Public keys which came from provisioner which may or may not have default values.
CONFSTORE_SETUP_TYPE: "cortx>common>setup_type" #M (Usedby : s3_deployment)
CONFSTORE_SETUP_SIZE: "cortx>common>setup_size" #O (Usedby : s3_deployment)
CONFSTORE_BASE_LOG_PATH: "cortx>common>storage>log" #M (Usedby : all)
CONFSTORE_S3_SECURITY_CERTIFICATE: "cortx>common>security>ssl_certificate" #O default - /etc/ssl/stx/stx.pem (Usedby : s3_deployment, haproxy)
#CONFSTORE_S3_STORAGE_MISC: "cortx>common>storage>misc" #O default - /var/data/cortx (Usedby : none)
Expand Down Expand Up @@ -106,6 +107,7 @@ TEST:
DEFAULT_POST_INSTALL:
DEFAULT_PREPARE:
DEFAULT_CONFIG:
CONFSTORE_SETUP_SIZE: "small"
CONFSTORE_LDAPADMIN_USER_KEY: "sgiamadmin"
CONFSTORE_S3_MOTR_MAX_UNITS_PER_REQUEST : "8"
CONFSTORE_S3_MOTR_MAX_START_TIMEOUT : "240"
Expand Down