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

chat read 용 cache #15

Open
1 task
ytjdud opened this issue May 14, 2024 · 1 comment
Open
1 task

chat read 용 cache #15

ytjdud opened this issue May 14, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request hold 기능 구현/해결 보류 invalid This doesn't seem right

Comments

@ytjdud
Copy link
Member

ytjdud commented May 14, 2024

채팅 Read 용 캐시를 만든다.

기존에 있는 캐시는 주로 벌크 insertion 용으로 만들었고 물론 읽을때도 기존 디비보단 빠르게 Message 객체를 읽어올 수 있다.

하지만 프런트에게 리턴해줘야하는 메시지내용은 Message 객체 뿐만 아니라 유저정보도 담아서 줘야하는데..
Message 객체에 유저정보를 다른 서비스에서 받아다가 + 붙이는 작업도 시간이 걸릴 것으로 예상됨
그래서 클라이언트에게 반환해주는 객체_최종을 담은 캐시를 만들자

  • 기존에 걸리는 시간 테스트
@ytjdud ytjdud self-assigned this May 14, 2024
@ytjdud ytjdud added the enhancement New feature or request label May 14, 2024
@ytjdud
Copy link
Member Author

ytjdud commented Jul 8, 2024

문제점.

1. 채팅과 유저정보를 미리 연결해두면, 유저정보의 불일치가 발생할 수 있다.
그리고 유저정보 캐싱을 한다한들, 사용자 로컬(디바이스) 단에서 한다고 들었다.

2. DB 와 캐시의 일관성을 유지하는 것이 복잡하다.

2-1. 캐시를 하나 (Read 용) 두는 경우
첫 채팅은 DB에 저장.
사용자가 채팅방을 재접속 했을 시, 최근 채팅 내역을 Read Through
채팅을 재개한다면 Write Through, 재개하지 않는 다면 상관X

2-2. 캐시를 두개 (Read 용, 채팅 재개시 update 용) 두는 경우
Scan Jul 8, 2024 at 11 50 AM 2


결론

캐시 정책을 고민할 수록, 오히려 현 상황에서 캐시를 도입하는게 적절한지에 대한 의문.
따라서 해당 이슈는 잠시 보류한다.

@ytjdud ytjdud added hold 기능 구현/해결 보류 invalid This doesn't seem right labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hold 기능 구현/해결 보류 invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant