Giter Club home page Giter Club logo

notice-management-backend's Introduction

공지사항 관리 REST API

개발할 때 마주한 문제들 및 해결 방법

  1. 공지사항 조회수 동시성 이슈 해결하기
    • 문제 상황: JMeter를 사용하여 1000명의 동시 사용자가 특정 공지사항을 조회할 때, 예상했던 조회수 1000명 대신 396명의 조회수만 카운트되는 동시성 문제가 발생했습니다.
    • 해결 방안: 비관적 락을 선택하여 대용량 트래픽 환경에서의 충돌을 효율적으로 관리하기로 결정했습니다. 낙관적 락과 Redis를 사용한 락은 각각 충돌 처리 비용과 보안상의 이유로 배제되었습니다.
  2. 인수 테스트에서 테스트 격리하기
    • 문제 상황: 공지사항 등록 기능에 대한 인수 테스트 중, 서비스가 생성한 공지사항의 ID 확인 시 한 테스트는 성공했으나 다른 테스트에서는 ID 값이 예상과 달리 2L로 나타나 실패했습니다.
    • 해결 방안: 트랜잭션 롤백 시 자동 증가 값이 롤백되지 않는 것이 문제의 원인이었습니다. TRUNCATE TABLE notices RESTART IDENTITY; 명령어를 사용하여 테스트마다 테이블과 자동 증가 값을 초기화하기로 결정했습니다.

실행 방법

H2 데이터베이스가 설치되어 있어야 합니다.

  • 프로젝트를 클론하고 싶은 디렉토리로 이동합니다.
  • 터미널에서 git clone https://github.com/Yiseull/notice-management-backend.git 명령어를 입력합니다.
  • IntelliJ IDEA에서 notice-management-backend 프로젝트의 build.gradle 파일을 오픈합니다.
  • 프로젝트를 실행합니다.
  • http://localhost:8080/swagger-ui/index.html 에서 API 명세를 확인하고 테스트할 수 있습니다.

기술 스택

  • Gradle
  • Java 17
  • Spring Boot 3.2.4
  • Spring Data JPA
  • H2
  • Junit5
  • Swagger

notice-management-backend's People

Contributors

yiseull avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.