Skip to content

Latest commit

 

History

History
92 lines (79 loc) · 1.98 KB

README.md

File metadata and controls

92 lines (79 loc) · 1.98 KB

LockTest

낙관적 락, 비관적 락, 분산락을 다양한 시나리오에 대해 테스트 후 성능을 비교하기 위한 레포지토리

의존성

  • Java 21
  • Spring Boot 3

실행법

  • .env 추가

    DB_USERNAME= # DB Username
    DB_DATABASE= # DB database name
    DB_PASSWORD= # DB Password
    REDIS_PORT= # Redis Port
    REDIS_PASSWORD= # Redis Password
  • application.yml 추가

    # src/main/resources/application.yml
    server:
      port: # Server Port
      servlet:
        context-path: "/api"
    
    spring:
      profiles:
        active: "dev"
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: # JDBC Connection URL
        username: ${DB_USERNAME}
        password: ${DB_PASSWORD}
      jpa:
        hibernate:
          ddl-auto: create
        properties:
          hibernate:
            format_sql: true
            highlight_sql: true
            generate_statistics: true
            jdbc.batch_size: 300
            order_inserts: true
            order_updates: true
            session.events.log.LOG_QUERIES_SLOWER_THAN_MS: 300
      redis:
        host: ${REDIS_HOST}
        port: ${REDIS_PORT}
        password: ${REDIS_PASSWORD}
      output:
        ansi:
          enabled: ALWAYS
    
    logging:
      level:
        org.hibernate.SQL: DEBUG
        org.hibernate.SQL_SLOW: INFO
        org.hibernate.orm.jdbc.bind: TRACE
        org.hibernate.stat: TRACE
    
    custom:
      service:
        baseUrl: ${BASE_URL}
    
  • 서버 실행

    ./gradlew bootrun
  • 유닛 테스트

    ./gradlew clean test
  • 부하 테스트

    docker-compose -f ./stress-test/docker-compose.stress.yml up -d

API

  • 서버 실행 후 스웨거를 통해 확인 가능
  • /api/swagger-ui/index.html