HEX
Server: LiteSpeed
System: Linux cluster02.load-balancer.x2.network 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: kbdhpghp (1098)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/self/root/etc/my.cnf
[client-server]
!includedir /etc/my.cnf.d

[mysqld]
# ============================================================================
# PERFORMANCE SCHEMA
# ============================================================================
performance-schema = 0
# MANTIDO: Desabilita Performance Schema que consome ~400MB RAM + overhead CPU

# ============================================================================
# INNODB BUFFER POOL - CONFIGURAÇÃO CRÍTICA
# ============================================================================
innodb_buffer_pool_size = 24G
# ALTERADO: 32G -> 24G (libera ~8G para sistema e buffers)
# MOTIVO: Equilíbrio entre cache InnoDB e memória disponível para conexões/OS

innodb_buffer_pool_instances = 6
# DIVIDE pool em 6 instâncias (~4G cada)

innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1

innodb_log_buffer_size = 32M

# ============================================================================
# QUERY CACHE - DESATIVADO (mantido)
# ============================================================================
query_cache_type = 0
query_cache_size = 0
query_cache_limit = 2M
query_cache_min_res_unit = 8K

# ============================================================================
# NETWORK & PACKET SIZE
# ============================================================================
max_allowed_packet = 536870912

# ============================================================================
# FILE DESCRIPTORS & TABLE CACHE
# ============================================================================
open_files_limit = 65535

table_open_cache = 8000
# Reduzido de 16384 para 8000 para controlar footprint de FD/memória

table_definition_cache = 18000

# ============================================================================
# STORAGE ENGINE
# ============================================================================
innodb_file_per_table = 1
default-storage-engine = InnoDB

# ============================================================================
# CONNECTION MANAGEMENT
# ============================================================================
max_connections = 230
# REDUZIDO: 700 -> 230 (você pediu 230). Baseado em Max_used_connections=248 historicamente;
# 230 dará margem, reduz risco de picos massivos de alocação de buffers.
max_user_connections = 50

thread_cache_size = 100
# Cache de threads para reduzir overhead de criação de threads

wait_timeout = 60
interactive_timeout = 60

# ============================================================================
# PER-CONNECTION BUFFERS (ALOCADOS SOB DEMANDA)
# ============================================================================
sort_buffer_size = 2M
read_buffer_size = 1M
read_rnd_buffer_size = 1M
join_buffer_size = 2M
thread_stack = 512K

# ============================================================================
# TEMPORARY TABLES (IN-MEMORY)
# ============================================================================
tmp_table_size = 128M
max_heap_table_size = 128M
# Reduzido de 512M -> 128M para evitar grandes alocações concorrentes em RAM.
# Trade-off: pode aumentar uso de disk tmp tables — monitorar Created_tmp_disk_tables/sec

# ============================================================================
# MYISAM (LEGACY)
# ============================================================================
key_buffer_size = 64M
# Se não usa MyISAM, não precisa de 512M; mantive 64M para tabelas de sistema

# ============================================================================
# INNODB LOGS & CRASH RECOVERY
# ============================================================================
innodb_log_file_size = 1G
innodb_log_files_in_group = 2
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT

# ============================================================================
# INNODB I/O THREADS & CAPACITY
# ============================================================================
innodb_io_capacity = 5000
innodb_io_capacity_max = 8000
innodb_read_io_threads = 8
innodb_write_io_threads = 8

# ============================================================================
# PATHS & SYSTEM
# ============================================================================
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
log-error = /var/lib/mysql/mysqld.log
pid-file = /var/lib/mysql/mysqld.pid

# ============================================================================
# SECURITY & AUTHENTICATION
# ============================================================================
plugin-load-add = auth_socket.so
unix_socket = OFF

# ============================================================================
# SQL MODE
# ============================================================================
sql_mode = ""

# ============================================================================
# NOTES & TUNING
# ============================================================================
# - Algumas variáveis (innodb_buffer_pool_size, innodb_log_file_size) requerem restart
# - Valores como max_connections podem ser alterados em runtime com SET GLOBAL
# - Monitore Created_tmp_tables e Created_tmp_disk_tables após aplicar