mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 13:26:23 +00:00
✨ 주요 기능 - Azure 기반 물리아키텍처 설계 (개발환경/운영환경) - 7개 마이크로서비스 물리 구조 설계 - 네트워크 아키텍처 다이어그램 작성 (Mermaid) - 환경별 비교 분석 및 마스터 인덱스 문서 📁 생성 파일 - design/backend/physical/physical-architecture.md (마스터) - design/backend/physical/physical-architecture-dev.md (개발환경) - design/backend/physical/physical-architecture-prod.md (운영환경) - design/backend/physical/*.mmd (4개 Mermaid 다이어그램) 🎯 핵심 성과 - 비용 최적화: 개발환경 월 $143, 운영환경 월 $2,860 - 확장성: 개발환경 100명 → 운영환경 10,000명 (100배) - 가용성: 개발환경 95% → 운영환경 99.9% - 보안: 다층 보안 아키텍처 (L1~L4) 🛠️ 기술 스택 - Azure Kubernetes Service (AKS) - Azure Database for PostgreSQL Flexible - Azure Cache for Redis Premium - Azure Service Bus Premium - Application Gateway + WAF 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
189 lines
5.0 KiB
Plaintext
189 lines
5.0 KiB
Plaintext
@startuml
|
|
!theme mono
|
|
|
|
title AI Service 캐시 데이터 구조도 (Redis)
|
|
|
|
' ===== Redis 캐시 구조 =====
|
|
package "Redis Cache" {
|
|
|
|
' AI 추천 결과 캐시
|
|
entity "ai:recommendation:{eventId}" as recommendation_cache {
|
|
**캐시 키**: ai:recommendation:{eventId}
|
|
--
|
|
TTL: 3600초 (1시간)
|
|
==
|
|
eventId: UUID <<PK>>
|
|
--
|
|
**trendAnalysis**
|
|
industryTrends: JSON Array
|
|
- keyword: String
|
|
- relevance: Double
|
|
- description: String
|
|
regionalTrends: JSON Array
|
|
seasonalTrends: JSON Array
|
|
--
|
|
**recommendations**: JSON Array
|
|
- optionNumber: Integer
|
|
- concept: String
|
|
- title: String
|
|
- description: String
|
|
- targetAudience: String
|
|
- duration: JSON Object
|
|
* recommendedDays: Integer
|
|
* recommendedPeriod: String
|
|
- mechanics: JSON Object
|
|
* type: ENUM (DISCOUNT, GIFT, STAMP, etc.)
|
|
* details: String
|
|
- promotionChannels: String Array
|
|
- estimatedCost: JSON Object
|
|
* min: Integer
|
|
* max: Integer
|
|
* breakdown: Map<String, Integer>
|
|
- expectedMetrics: JSON Object
|
|
* newCustomers: {min, max}
|
|
* revenueIncrease: {min, max}
|
|
* roi: {min, max}
|
|
- differentiator: String
|
|
--
|
|
generatedAt: Timestamp
|
|
expiresAt: Timestamp
|
|
aiProvider: ENUM (CLAUDE, GPT_4)
|
|
}
|
|
|
|
' 작업 상태 캐시
|
|
entity "ai:job:status:{jobId}" as job_status_cache {
|
|
**캐시 키**: ai:job:status:{jobId}
|
|
--
|
|
TTL: 86400초 (24시간)
|
|
==
|
|
jobId: UUID <<PK>>
|
|
--
|
|
status: ENUM <<NOT NULL>>
|
|
- PENDING
|
|
- PROCESSING
|
|
- COMPLETED
|
|
- FAILED
|
|
progress: Integer (0-100)
|
|
message: String
|
|
createdAt: Timestamp
|
|
}
|
|
|
|
' 트렌드 분석 캐시
|
|
entity "ai:trend:{industry}:{region}" as trend_cache {
|
|
**캐시 키**: ai:trend:{industry}:{region}
|
|
--
|
|
TTL: 86400초 (24시간)
|
|
==
|
|
cacheKey: String <<PK>>
|
|
(industry + region 조합)
|
|
--
|
|
**industryTrends**: JSON Array
|
|
- keyword: String
|
|
- relevance: Double (0.0-1.0)
|
|
- description: String
|
|
**regionalTrends**: JSON Array
|
|
- keyword: String
|
|
- relevance: Double
|
|
- description: String
|
|
**seasonalTrends**: JSON Array
|
|
- keyword: String
|
|
- relevance: Double
|
|
- description: String
|
|
}
|
|
|
|
}
|
|
|
|
' ===== 캐시 관계 설명 =====
|
|
note right of recommendation_cache
|
|
**AI 추천 결과 캐시**
|
|
- Event Service에서 이벤트 ID로 조회
|
|
- 캐시 미스 시 AI API 호출 후 저장
|
|
- 1시간 TTL로 최신 트렌드 반영
|
|
- JSON 형식으로 직렬화 저장
|
|
end note
|
|
|
|
note right of job_status_cache
|
|
**작업 상태 캐시**
|
|
- Kafka 메시지 수신 후 생성
|
|
- 비동기 작업 진행 상황 추적
|
|
- 24시간 TTL로 이력 보관
|
|
- Progress: 0(시작) → 100(완료)
|
|
end note
|
|
|
|
note right of trend_cache
|
|
**트렌드 분석 캐시**
|
|
- 업종/지역 조합으로 캐싱
|
|
- AI API 호출 비용 절감
|
|
- 24시간 TTL로 일간 트렌드 반영
|
|
- 추천 생성 시 재사용
|
|
end note
|
|
|
|
' ===== 캐시 의존 관계 =====
|
|
recommendation_cache ..> trend_cache : "uses\n(트렌드 데이터 참조)"
|
|
job_status_cache ..> recommendation_cache : "tracks\n(추천 생성 작업 상태)"
|
|
|
|
' ===== 외부 시스템 참조 =====
|
|
package "External References" {
|
|
entity "Event Service" as event_service {
|
|
eventId: UUID
|
|
--
|
|
(외부 서비스)
|
|
}
|
|
|
|
entity "Kafka Topic" as kafka_topic {
|
|
ai-job-request
|
|
--
|
|
jobId: UUID
|
|
eventId: UUID
|
|
}
|
|
}
|
|
|
|
event_service ..> recommendation_cache : "요청\n(GET /recommendation/{eventId})"
|
|
kafka_topic ..> job_status_cache : "생성\n(비동기 작업 시작)"
|
|
|
|
' ===== 캐시 키 패턴 설명 =====
|
|
note bottom of recommendation_cache
|
|
**캐시 키 예시**
|
|
ai:recommendation:123e4567-e89b-12d3-a456-426614174000
|
|
|
|
**캐싱 전략**: Cache-Aside
|
|
1. 캐시 조회 시도
|
|
2. 미스 시 AI API 호출
|
|
3. 결과를 캐시에 저장
|
|
4. TTL 만료 시 자동 삭제
|
|
end note
|
|
|
|
note bottom of trend_cache
|
|
**캐시 키 예시**
|
|
ai:trend:음식점:강남구
|
|
ai:trend:카페:성동구
|
|
|
|
**데이터 구조**
|
|
- 업종별 주요 트렌드 키워드
|
|
- 지역별 소비 패턴
|
|
- 계절별 선호도
|
|
- 각 트렌드의 관련도 점수
|
|
end note
|
|
|
|
' ===== Redis 설정 정보 =====
|
|
legend right
|
|
**Redis 캐시 설정**
|
|
|항목|설정값|
|
|
|호스트|${REDIS_HOST:localhost}|
|
|
|포트|${REDIS_PORT:6379}|
|
|
|타임아웃|3000ms|
|
|
|최대 연결|8|
|
|
|
|
**만료 정책**
|
|
- 추천 결과: 1시간 (실시간성)
|
|
- 작업 상태: 24시간 (이력 보관)
|
|
- 트렌드: 24시간 (일간 갱신)
|
|
|
|
**메모리 관리**
|
|
- 만료 정책: volatile-lru
|
|
- 최대 메모리: 1GB
|
|
- 예상 사용량: 추천 50KB, 상태 1KB, 트렌드 10KB
|
|
end legend
|
|
|
|
@enduml
|