Optimize MongoDB configuration and reduce resource limits for improved performance
This commit is contained in:
@@ -2,8 +2,14 @@ services:
|
|||||||
mongodb:
|
mongodb:
|
||||||
image: mongo:7
|
image: mongo:7
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
mem_limit: 512m
|
command:
|
||||||
mem_reservation: 256m
|
- mongod
|
||||||
|
- --wiredTigerCacheSizeGB
|
||||||
|
- "0.25"
|
||||||
|
- --setParameter
|
||||||
|
- diagnosticDataCollectionEnabled=false
|
||||||
|
mem_limit: 384m
|
||||||
|
mem_reservation: 192m
|
||||||
environment:
|
environment:
|
||||||
MONGO_INITDB_DATABASE: Invario_Website
|
MONGO_INITDB_DATABASE: Invario_Website
|
||||||
volumes:
|
volumes:
|
||||||
@@ -25,7 +31,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
MONGO_URI: mongodb://mongodb:27017
|
MONGO_URI: mongodb://mongodb:27017
|
||||||
MONGO_DB_NAME: Invario_Website
|
MONGO_DB_NAME: Invario_Website
|
||||||
MONGO_MAX_POOL_SIZE: ${MONGO_MAX_POOL_SIZE:-24}
|
MONGO_MAX_POOL_SIZE: ${MONGO_MAX_POOL_SIZE:-12}
|
||||||
MONGO_MIN_POOL_SIZE: ${MONGO_MIN_POOL_SIZE:-0}
|
MONGO_MIN_POOL_SIZE: ${MONGO_MIN_POOL_SIZE:-0}
|
||||||
MONGO_MAX_IDLE_MS: ${MONGO_MAX_IDLE_MS:-60000}
|
MONGO_MAX_IDLE_MS: ${MONGO_MAX_IDLE_MS:-60000}
|
||||||
MONGO_CONNECT_TIMEOUT_MS: ${MONGO_CONNECT_TIMEOUT_MS:-1500}
|
MONGO_CONNECT_TIMEOUT_MS: ${MONGO_CONNECT_TIMEOUT_MS:-1500}
|
||||||
@@ -48,8 +54,8 @@ services:
|
|||||||
- /etc/nginx/certs:/etc/nginx/certs
|
- /etc/nginx/certs:/etc/nginx/certs
|
||||||
ports:
|
ports:
|
||||||
- "4999:4999"
|
- "4999:4999"
|
||||||
mem_limit: 384m
|
mem_limit: 256m
|
||||||
mem_reservation: 192m
|
mem_reservation: 128m
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mongo_data:
|
mongo_data:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
bind = "0.0.0.0:4999"
|
bind = "0.0.0.0:4999"
|
||||||
worker_class = "gthread"
|
worker_class = "gthread"
|
||||||
workers = 1
|
workers = 1
|
||||||
threads = 8
|
threads = 4
|
||||||
timeout = 45
|
timeout = 45
|
||||||
keepalive = 2
|
keepalive = 2
|
||||||
max_requests = 400
|
max_requests = 300
|
||||||
max_requests_jitter = 60
|
max_requests_jitter = 40
|
||||||
preload_app = False
|
preload_app = False
|
||||||
accesslog = "-"
|
accesslog = "-"
|
||||||
errorlog = "-"
|
errorlog = "-"
|
||||||
|
|||||||
+1
-1
@@ -80,7 +80,7 @@ def _env_int(name: str, default: int) -> int:
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
MONGO_MAX_POOL_SIZE = max(_env_int("MONGO_MAX_POOL_SIZE", 24), 1)
|
MONGO_MAX_POOL_SIZE = max(_env_int("MONGO_MAX_POOL_SIZE", 12), 1)
|
||||||
MONGO_MIN_POOL_SIZE = max(_env_int("MONGO_MIN_POOL_SIZE", 0), 0)
|
MONGO_MIN_POOL_SIZE = max(_env_int("MONGO_MIN_POOL_SIZE", 0), 0)
|
||||||
MONGO_MAX_IDLE_MS = max(_env_int("MONGO_MAX_IDLE_MS", 60000), 1000)
|
MONGO_MAX_IDLE_MS = max(_env_int("MONGO_MAX_IDLE_MS", 60000), 1000)
|
||||||
MONGO_CONNECT_TIMEOUT_MS = max(_env_int("MONGO_CONNECT_TIMEOUT_MS", 1500), 500)
|
MONGO_CONNECT_TIMEOUT_MS = max(_env_int("MONGO_CONNECT_TIMEOUT_MS", 1500), 500)
|
||||||
|
|||||||
Reference in New Issue
Block a user