Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 게시글 순위 조회 관련 변경사항(배치) #43

Open
hun-ca opened this issue Aug 21, 2022 · 0 comments
Open

[fix] 게시글 순위 조회 관련 변경사항(배치) #43

hun-ca opened this issue Aug 21, 2022 · 0 comments
Assignees
Labels

Comments

@hun-ca
Copy link
Member

hun-ca commented Aug 21, 2022

게시글 전체조회(페이징) 관련 API에서 순위를 계산하는 쿼리는 배치+스케줄러를 활용해서 미리 계산하여 DB에 적재해둬야 할 거 같습니다. (각 개별 유저의 요청마다 전체 게시글에 대해 sort를 수행할 순 없기 때문)

  • 현재 대용량 데이터가 아니기때문에 배치보다 단순 스케줄러로 구현 후 추후 배치 도입
  • 랭킹을 미리 스케줄러를 통해 계산해 두고 이를 따로 테이블에 저장해 둔다면 랭킹 기준에 따라 각각 테이블이 필요하게 됨.
  • 레디스를 사용해서 인메모리로 저장할 수도 있지만 전체 게시글에 대해 랭킹을 해야하기 때문에 메모리 초과 발생 가능 (레디스 사용 안할 예정)
  • SQL order by 수행 시, 메모리만 사용하지 않고 디스크까지 같이 사용하는 방법이 있긴 함. (DBMS마다 다름, 추가적으로 알아볼 것)
  • 만약 순위 정보 게시글을 저장할 테이블을 만든다면, 게시글에 대한 모든 정보를 넣을지, article id만 넣을지도 생각해 봐야 할 것

cf. 정렬 기준이 되는 필트에 인덱스 설정 필수, 실행계획을 통해 인덱스 사용되는지 확인할 것


mysql 공식문서 참고 (링크)

image

  • 인기 게시글 정렬 작업 자체가 성능을 중요하게 필요로 하는 기능은 아니기 때문에 메모리가 부족할 경우 디스크를 사용하더라도 크게 문제되지 않을 것

관련기술

  • elastic search (우선은 RDB로 해결 후, 적용 예정)
@hun-ca hun-ca added the fix label Aug 21, 2022
@hun-ca hun-ca self-assigned this Aug 21, 2022
@hun-ca hun-ca pinned this issue Aug 28, 2022
@hun-ca hun-ca changed the title [fix] 게시글 순위 관련 조회 변경(배치) [fix] 게시글 순위 조회 관련 대규모 변경사항(배치) Aug 28, 2022
@hun-ca hun-ca changed the title [fix] 게시글 순위 조회 관련 대규모 변경사항(배치) [fix] 게시글 순위 조회 관련 변경사항(배치) Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant