implement advanced memory optimization system with configurable settings

This commit is contained in:
2025-09-25 22:57:24 -05:00
parent eb3ab7c4e6
commit f56c98535b
22 changed files with 483 additions and 102 deletions

86
.env
View File

@@ -1,22 +1,74 @@
TOKEN = 'OTkxMDYyNzUxNjMzODgzMTM2.Gjzppb.OsdqEDhl_tiQmw4KL7ITbEZ1e-s9VeoF_xJvQQ'
REDIS_URL = 'redis-17965.c323.us-east-1-2.ec2.redns.redis-cloud.com'
REDIS_PASS = 'HnPiQFoWwsBdJY62SiHZSEDmnbgiycZ5'
CLIENT = '991062751633883136'
# Configuración de ejemplo para optimización de memoria
# Copia este archivo como .env.test y ajusta los valores según tus necesidades
# developement
guildTest = '1316592320954630144'
GOOGLE_AI_API_KEY = 'AIzaSyDcqOndCJw02xFs305iQE7KVptBoBH8aPk'
# ===========================================
# CONFIGURACIÓN DE DISCORD
# ===========================================
TOKEN=OTkxMDYyNzUxNjMzODgzMTM2.Gjzppb.OsdqEDhl_tiQmw4KL7ITbEZ1e-s9VeoF_xJvQQ
guildTest=1316592320954630144
GOOGLE_AI_API_KEY=AIzaSyDcqOndCJw02xFs305iQE7KVptBoBH8aPk
CLIENT=991062751633883136
# This was inserted by `prisma init`:
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
# ===========================================
# CONFIGURACIÓN DE BASE DE DATOS
# ===========================================
DATABASE_URL=postgresql://postgres.gndwiodomcunueuxwthl:Lop0090...@aws-1-us-west-1.pooler.supabase.com:5432/postgres
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
# ===========================================
# REDIS
# ==========================================
REDIS_URL=redis-17965.c323.us-east-1-2.ec2.redns.redis-cloud.com
REDIS_PASS=AIzaSyDcqOndCJw02xFs305iQE7KVptBoBH8aPk
# The following `prisma+postgres` URL is similar to the URL produced by running a local Prisma Postgres
# server with the `prisma dev` CLI command, when not choosing any non-default ports or settings. The API key, unlike the
# one found in a remote Prisma Postgres URL, does not contain any sensitive information.
# ===========================================
# OPTIMIZACIÓN DE MEMORIA
# ===========================================
DATABASE_URL="postgresql://postgres.gndwiodomcunueuxwthl:Lop0090...@aws-1-us-west-1.pooler.supabase.com:5432/postgres"
#DATABASE_URL="file:./dev.db"
# Monitor de memoria (0 = desactivado, >0 = segundos entre reportes)
MEMORY_LOG_INTERVAL_SECONDS=120
# Optimizador avanzado de memoria (requiere --expose-gc)
ENABLE_MEMORY_OPTIMIZER=true
# ===========================================
# CACHE DE DISCORD.JS
# ===========================================
# Límites de cache (menor = menos memoria, mayor = mejor rendimiento)
CACHE_MESSAGES_LIMIT=50 # Mensajes por canal
CACHE_MEMBERS_LIMIT=100 # Miembros por servidor
# ===========================================
# SISTEMA DE LIMPIEZA AUTOMÁTICA
# ===========================================
# Intervalo de limpieza de mensajes (segundos)
SWEEP_MESSAGES_INTERVAL_SECONDS=300 # cada 5 minutos
# Tiempo de vida de mensajes en cache (segundos)
SWEEP_MESSAGES_LIFETIME_SECONDS=900 # 15 minutos
# ===========================================
# CONFIGURACIONES PREESTABLECIDAS
# ===========================================
# ULTRA-LIGERO (< 512MB RAM disponible):
# CACHE_MESSAGES_LIMIT=10
# CACHE_MEMBERS_LIMIT=25
# SWEEP_MESSAGES_INTERVAL_SECONDS=120
# SWEEP_MESSAGES_LIFETIME_SECONDS=300
# MEMORY_LOG_INTERVAL_SECONDS=60
# BALANCEADO (1GB+ RAM disponible):
# CACHE_MESSAGES_LIMIT=50
# CACHE_MEMBERS_LIMIT=100
# SWEEP_MESSAGES_INTERVAL_SECONDS=300
# SWEEP_MESSAGES_LIFETIME_SECONDS=900
# MEMORY_LOG_INTERVAL_SECONDS=120
# ALTO RENDIMIENTO (2GB+ RAM disponible):
# CACHE_MESSAGES_LIMIT=200
# CACHE_MEMBERS_LIMIT=500
# SWEEP_MESSAGES_INTERVAL_SECONDS=600
# SWEEP_MESSAGES_LIFETIME_SECONDS=1800
# MEMORY_LOG_INTERVAL_SECONDS=300