signal-batch/src/main/resources/application-query.yml
LHT 28e6887379 fix: WebSocket OOM 방지 — 버퍼 256MB→2MB + 힙 기반 Admission Control
근본 원인: maxTextMessageBufferSize=256MB가 세션당 Humongous 객체 유발
- 100세션 × 256MB = 25.6GB G1GC 회수 불가 Humongous 리전 누적 → OOM

변경 내역:
- WebSocketStompConfig: 컨테이너 버퍼 256MB→2MB, SockJS stream 100MB→5MB
- WebSocketProperties: sendBuffer 256→50MB, outboundQueue 5000→200, msgLimit 50→2MB
- YAML(prod/prod-mpr/query): websocket.transport 섹션 명시적 추가
- ActiveQueryManager: 힙 사용률 85% 초과 시 쿼리 대기열 전환
- ChunkedTrackStreamingService: 중간 컬렉션 clear()/null 즉시 해제
- GisServiceV2: 캐시 원본 보호 toBuilder().build() + 중간 컬렉션 해제
- StompTrackController: activeSessions COMPLETED/ERROR 시 자동 제거
- AsyncConfig: 스레드풀 core 40→15, max 120→30

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 16:37:48 +09:00

139 lines
4.2 KiB
YAML
Raw Blame 히스토리

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 조회 전용 서버 설정 (10.29.17.90)
# 배치 작업 없이 API 조회만 수행하는 프로파일
server:
port: 8090
tomcat:
threads:
max: 200
min-spare: 10
connection-timeout: 60000
max-http-form-post-size: 50MB
max-swallow-size: 50MB
max-connections: 10000
accept-count: 100
spring:
datasource:
# 조회 전용 DB (10.29.17.90 로컬 DB) - 표준 Spring Boot DataSource 설정
url: jdbc:postgresql://localhost:5432/mpcdb2?currentSchema=signal&options=-csearch_path=signal,public&assumeMinServerVersion=12&reWriteBatchedInserts=true
username: mpc
password: mpc#8932
driver-class-name: org.postgresql.Driver
hikari:
pool-name: QueryOnlyHikariPool
connection-timeout: 5000
idle-timeout: 600000
max-lifetime: 1800000
maximum-pool-size: 60
minimum-idle: 10
connection-test-query: SELECT 1
validation-timeout: 5000
leak-detection-threshold: 60000
connection-init-sql: "SET TIME ZONE 'Asia/Seoul'; SET search_path TO signal, public;"
data-source-properties:
prepareThreshold: 3
preparedStatementCacheQueries: 250
# Request 크기 설정
servlet:
multipart:
max-file-size: 50MB
max-request-size: 50MB
# Spring Batch 자동 구성 완전 비활성화
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration
# Spring Batch Job 비활성화
batch:
job:
enabled: false
jdbc:
initialize-schema: never
logging:
level:
root: INFO
gc.mda.signal_batch: DEBUG
gc.mda.signal_batch.global.util: INFO
gc.mda.signal_batch.global.websocket.service: INFO
gc.mda.signal_batch.batch: WARN # 배치 관련 로그 최소화
gc.mda.signal_batch.domain: INFO
gc.mda.signal_batch.monitoring: DEBUG
gc.mda.signal_batch.monitoring.controller: INFO
org.springframework.batch: WARN # 배치 관련 로그 최소화
org.springframework.jdbc: WARN
org.postgresql: WARN
com.zaxxer.hikari: INFO
# 배치 설정 (조회 전용 서버에서는 사용 안 함)
vessel:
# 통합선박 기능 비활성화 (query DB에 통합테이블이 없을 수 있음)
integration:
enabled: false
batch:
# 스케줄러 비활성화 (중요!)
scheduler:
enabled: false
incremental:
delay-minutes: 3
# 비정상 궤적 검출 비활성화
abnormal-detection:
enabled: false
# 기타 배치 설정은 사용되지 않지만 기본값 유지
chunk-size: 10000
page-size: 5000
partition-size: 12
# 일일 항적 데이터 인메모리 캐시 (조회 전용 서버의 핵심 성능 설정)
cache:
daily-track:
enabled: true
retention-days: 7 # D-1 ~ D-7 (오늘 제외)
max-memory-gb: 6 # 최대 6GB (조회 전용이므로 배치 없이 메모리 여유)
warmup-async: true # 비동기 워밍업 (서버 시작 차단 없음)
# WebSocket 부하 제어 설정
websocket:
query:
max-concurrent-global: 40 # 조회 전용 서버 (배치 없으므로 prod-mpr보다 여유)
max-per-session: 15 # 세션당 동시 쿼리 상한
queue-timeout-seconds: 30 # 글로벌 대기 큐 타임아웃
transport:
message-size-limit-mb: 2 # 단일 STOMP 메시지 상한 (청크 1024KB 기준)
send-buffer-size-limit-mb: 50 # 세션당 송신 버퍼 상한 (사전 할당 아님, 최악 40×50MB=2GB)
outbound-queue-capacity: 200 # 아웃바운드 메시지 큐
send-time-limit-seconds: 30 # 메시지 전송 시간 제한
session:
idle-timeout-ms: 15000
server-heartbeat-ms: 5000
client-heartbeat-ms: 5000
sockjs-disconnect-delay-ms: 5000
send-time-limit-seconds: 30
# REST V2 부하 제어 설정
rest:
v2:
query:
timeout-seconds: 30 # 슬롯 대기 타임아웃 (초)
max-total-points: 500000 # 응답 총 포인트 상한
# 액추에이터 설정
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus,env,loggers,threaddump,heapdump
endpoint:
health:
show-details: always
show-components: always
metrics:
tags:
application: vessel-query-server
environment: query