Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
๐ Summary
๐ฌ Review Points
์ปค์คํ ItemReader๊ฐ ์๋ RepositoryItemReader๋ฅผ ์ฌ์ฉ
์ฒ์ ๊ตฌํํ ๋, ์ปค์คํ ItemReader๋ฅผ ํตํด์ ๋ง์ฝ ์ข์์ ๋ฐ์ดํฐ๊ฐ 100๋ง ๊ฑด์ด๋ผ๋ฉด,
100๋ง๊ฑด์ ๋ชจ๋ ์ฝ์ด์ ์ฒ๋ฆฌ๋ฅผ ํ๋ค๋ฉด ๋ฐ์ดํฐ ์์ด ๋ ๋ง์์ง๋ฉด OOM ์ด์๊ฐ ๋ฐ์ํ ์ ์์ ๊ฒ ๊ฐ์,
Spring Batch ์์ ์ง์ํ๋ RepositoryItemReader๋ฅผ ์ฌ์ฉํด์ chunk size์ ๋์ผํ
ํ์ด์ง ๋ฐ์ดํฐ๋ฅผ ์ฒ๋ฆฌํ๋๋ก ๊ตฌํํ์์ต๋๋ค.
๊ถ๊ธํ ์ ์ RepositoryItemReader ๋ฅผ ์ฌ์ฉํด์ ์ฒ๋ฆฌํ๋ ๊ฒฝ์ฐ๋ ์ค๋ฌด์์ ๋ง์์ง ๊ถ๊ธํ๊ณ ,
์ ๋ต์ ์๋ค๊ณ ํ์ จ์ง๋ง, ๊ตฌํํ ๋ฐฉ์์ด ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ฑ์ด ๋ง๋์ง ๊ถ๊ธํฉ๋๋ค.
MV๋ฅผ ํ์ฉํ ์ฃผ๊ฐ ์๊ฐ ๋ญํน ๊ฐ์ค์น ์ ์ฉ ์ง๋ฌธ
Redis์ ZSET์ผ๋ก ์ผ๊ฐ ๋ญํน์ ๊ตฌํํ ๋์๋ ZSET score ๊ธฐ๋ฐ top ๋ญํน์ ๋ฝ๋ ๋ฐฉ๋ฒ์ผ๋ก ๊ตฌํํ์๋๋ฐ, ์ด๋ฒ ๊ณผ์ ๋ Spring Batch + MV ๋ฅผ ํ์ฉํด ์ฃผ๊ฐ, ์๊ฐ ์ง๊ณ ๋ฐ์ดํฐ๋ฅผ ์์งํ๊ณ , commerce-api์์ top 100 ๋ญํน์ ์กฐํํ๋ ๊ธฐ๋ฅ์ ๊ตฌํํด์ผ ํ๋๋ฐ,
์ ๊ฐ ๊ถ๊ธํ ์ ์ MV์ ์ ์ฅ๋๋ ๋ฐ์ดํฐ๋ ์ง๊ณ์ ๋ํ ๋ด์ฉ๋ฟ์ด๋ผ, top N ์ ๋ฝ์์ผํ๋ ๊ฒฝ์ฐ ๋ณ๋์ score ๋ฅผ ์ด๋ป๊ฒ ๊ตฌํํ๋๊ฒ ์ข์์ง ๊ถ๊ธํฉ๋๋ค.
์ ๋ ์ด๋ฒ ๊ณผ์ ์์ api๋ฅผ ์กฐํํ๋ commerce-api ์ ์ฝ๊ธฐ ์ ์ฉ ์ํฐํฐ๋ฅผ ๋ง๋ค๊ณ MV์์ ๋ฐ์ดํฐ๋ฅผ db์์ ์กฐํํ ๋ score๋ฅผ ๊ณ์ฐํด์ ์กฐํํ๋๋ก ์ฒ๋ฆฌํ์์ต๋๋ค.
์ ๊ฐ ์๊ฐํ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก๋ ๋ด๋ถ์ score๋ฅผ ๊ณ์ฐํ๋ ๋๋ฉ์ธ ๋ก์ง์ ํตํด ์ข ํฉ ์ ์๋ฅผ ๊ณ์ฐํ๋๋ก ํ๋ ๋ฐฉ๋ฒ๋ ์์ ๊ฒ ๊ฐ์๋ณด์ด๋๋ฐ, commerce-collector ์ง๊ณ ์ฒ๋ฆฌํ๋ ๋ถ๋ถ์์ ๋ฏธ๋ฆฌ score๋ฅผ ๊ณ์ฐํ๋ ๊ฒ์ด ๋ ์ข์ ๋ฐฉ๋ฒ์ธ์ง, ์๋๋ฉด ์ ๊ฐ ๊ตฌํํ ๋ถ๋ถ๋ ๊ด์ฐฎ์ ๋ฐฉ๋ฒ์ธ์ง ๊ถ๊ธํฉ๋๋ค.
์ค์ฝ์ด ๊ณ์ฐ์ repository์์ ์ฒ๋ฆฌ
๋๋ฉ์ธ ๋ก์ง์์ ์ฒ๋ฆฌํ๋ ๊ฒฝ์ฐ
โ Checklist
๐งฑ Spring Batch
๐งฉ Ranking API