Skip to content

Commit ee86b52

Browse files
authored
[feature/#78] 부하테스트 실행 환경 구성 (#85)
- SPRING_PROFILES_ACTIVE를 .env로 토글 (평소 prod / 부하시 prod,loadtest) - 시드 확장: 회원 100->2500, 과목 20->30 - 경량 지표 노출: actuator + micrometer-prometheus (tomcat threads / hikaricp connections / cpu) -> /actuator/prometheus
1 parent 5709735 commit ee86b52

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎.env.example‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# Docker Hub 사용자명 (앱 이미지: <DOCKER_USERNAME>/docker-springboot:latest)
55
DOCKER_USERNAME=your-dockerhub-username
66

7+
# Spring 프로파일 (평소 prod / 부하테스트 시 prod,loadtest 로 변경하면 헤더 기반 userId 활성화)
8+
SPRING_PROFILES_ACTIVE=prod
9+
710
# MySQL
811
MYSQL_ROOT_PASSWORD=change-me-root-password
912
DB_NAME=course_register

‎build.gradle‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ dependencies {
6060

6161
// redisson
6262
implementation 'org.redisson:redisson-spring-boot-starter:3.27.2'
63+
64+
// monitoring (부하테스트용 지표: thread pool / connection pool / cpu)
65+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
66+
implementation 'io.micrometer:micrometer-registry-prometheus'
6367
}
6468

6569
tasks.named('test') {

‎docker-compose.prod.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ services:
4242
ports:
4343
- "80:8080"
4444
environment:
45-
SPRING_PROFILES_ACTIVE: prod
45+
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-prod}
4646
DB_HOST: mysql
4747
DB_PORT: 3306
4848
DB_NAME: ${DB_NAME}

‎src/main/java/com/practice/course_registration/global/init/DataInitializer.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void run(String... args) {
5050
private void seedSubjects() {
5151
SubjectDay[] days = SubjectDay.values();
5252
List<Subject> subjects = new ArrayList<>();
53-
for (int i = 1; i <= 20; i++) {
53+
for (int i = 1; i <= 30; i++) {
5454
subjects.add(Subject.builder()
5555
.subjectName("테스트과목" + i)
5656
.professorName("교수" + i)

‎src/main/resources/application-prod.yml‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,15 @@ server:
4343
app:
4444
seed:
4545
enabled: true
46-
member-count: 100
47-
member-password: test1234
46+
member-count: 2500
47+
member-password: test1234
48+
49+
# 부하테스트용 지표 노출 (thread pool / connection pool / cpu)
50+
management:
51+
endpoints:
52+
web:
53+
exposure:
54+
include: health, prometheus
55+
metrics:
56+
tags:
57+
application: course-registration

0 commit comments

Comments
 (0)