Server๐Ÿงค/QueryDsl

Server๐Ÿงค/QueryDsl

[Querydsl] ๋ฌดํ•œ ์Šคํฌ๋กค ๊ธฐ๋Šฅ ๊ตฌํ˜„ ( Offset vs No Offest )

Soptmakers์—์„œ, ๋๋ง์ž‡๊ธฐ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ๋‹ค. ์ฒ˜์Œ MVP๋Š” ๋ชจ๋“  ํšŒ์ฐจ์˜ ๋๋ง์ž‡๊ธฐ ๋ชฉ๋ก์„ ๋ณด์ด๋„๋ก ํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค. ๋ฌดํ•œ ์Šคํฌ๋กค์„ ๊ตฌํ˜„ํ• ๋•Œ๋Š” limit, cursor, hasNext์™€ ๊ฐ™์€ ํ•„๋“œ๊ฐ€ ํ•„์š”ํ•˜๋‹ค. limit : ํŽ˜์ด์ง€ ์‚ฌ์ด์ฆˆ cursor: ์ฝ๊ณ  ์‹ถ์€ ํ–‰์˜ ๋ฐ์ดํ„ฐ ๊ฐœ์ˆ˜ hasNext: ์Šคํฌ๋กค ์ดํ›„ ๊ทธ ๋’ค์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ๋‚จ์•„์žˆ๋Š”์ง€ ์—†๋Š”์ง€ ํŒ๋‹จํ•˜๋Š” ํ•„๋“œ ๋ฌธ์ œ์  ๋ฐœ์ƒ ์ „์ฒด ์กฐํšŒํ•˜๋Š” ๊ฒฝ์šฐ์—, ์ค‘๋ณต๋˜๋Š” ๋ฐ์ดํ„ฐ๊ฐ€ ๋ณด์ด๊ฒŒ๋จ limit์€ 10 cursor๋Š” 10, 20, 30~ ์˜ ๊ฐ’์œผ๋กœ ์š”์ฒญ ์ด ๊ณผ์ •์—์„œ, (0 ~ 10) (10 ~ 20) (20 ~ 30) ์ค‘๊ฐ„์˜ ๊ฐ’๋“ค์ด ์ค‘๋ณต๋˜๋Š” ํ˜„์ƒ ๋ฐœ์ƒ ๐Ÿ“Offest Based Pagination @Repository @RequiredArgsConstructor publi..

Server๐Ÿงค/QueryDsl

[QueryDsl] ํŽ˜์ด์ง€๋„ค์ด์…˜ ์ฒ˜๋ฆฌ (Offset based, Cursor based)

Offset Offset์˜ ๋ฌธ์ œ์  ์˜ˆ) offset์ด 50000, limit 20 20์˜ offset๊ฐ€ ์žˆ๋‹ค๋ฉด, 50020 rows๋ฅผ ์š”์ฒญํ•ด์˜ค๊ณ , ๋‚˜๋จธ์ง€ 50000๊ฐœ์˜ row๋ฅผ ๋ฒ„๋ฆฌ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋Š๋ฆฐ offset ์ฟผ๋ฆฌ๋ฅผ ์ตœ์ ํ™”ํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ• Offset์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๋ฐฉ๋ฒ• Offset์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ , Unique ํ•œ ๊ฐ’์„ bookmark ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜์—ฌ, ๋งˆ์ง€๋ง‰์— fetch ๋‹ค์Œ row๋กœ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก where clause๋กœ ์ ์„ ์ˆ˜ ์žˆ๋‹ค. ์ˆœ์„œ๊ฐ€ ํŽ˜์ด์ง€ ๊ฐ„์— ํ•ญ์ƒ ๋™์ผํ•˜๊ฒŒ ์œ ์ง€๋˜๋„๋ก, ๊ณ ์œ ํ•œ ์—ด์„ ๊ธฐ์ค€์œผ๋กœ ์ˆœ์„œ๋ฅผ ์ง€์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. https://www.eversql.com/faster-pagination-in-mysql-why-order-by-with-limit-and-offset-is-slow/

Server๐Ÿงค/QueryDsl

[Querydsl] Jmeter๋ฅผ์ด์šฉํ•œ ์†๋„ ํ…Œ์ŠคํŠธ / Entity ์กฐํšŒ์™€ id ์กฐํšŒ ์„ฑ๋Šฅ ์ฐจ์ด

๋ฌธ์ œ ์ƒํ™ฉ 1000๋ช… ์ •๋„ ๋˜๋Š” ์œ ์ €์˜ ๋ฉค๋ฒ„ ๋ฆฌ์ŠคํŠธ ์กฐํšŒํ•˜๋Š” ๊ณผ์ •์—์„œ ์ฟผ๋ฆฌ๊ฐ€ ์ด 2๋ฒˆ ๋‚˜๊ฐ€์•ผํ•˜๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒํ–ˆ์–ด์š”. 1. ๋ฉค๋ฒ„ ์ •๋ณด๋ฅผ ์ „์ฒด ์กฐํšŒํ•˜๋Š” ์ฟผ๋ฆฌ + ํ•„ํ„ฐ๋ง ํฌํ•จ 2. ํ•„ํ„ฐ๋ง์— ํฌํ•จ๋˜๋Š” ๋ฉค๋ฒ„๋ฅผ countํ•˜๋Š” ์ฟผ๋ฆฌ ๋ฐ์ดํ„ฐ๊ฐ€ ๋Š˜์–ด๋‚จ์— ๋”ฐ๋ผ์„œ, ์ฟผ๋ฆฌ ์†๋„๊ฐ€ ๋Š˜์–ด๋‚˜๋Š” ๊ฒƒ์— ๋ถ€๋‹ด์„ ๋Š๋ผ๊ฒŒ ๋˜์–ด์„œ jMeter๋กœ ๊ฒ€์ƒ‰ ์†๋„ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ธฐ๋กœ ํ•˜์˜€์Šต๋‹ˆ๋‹ค. jMeter ์‚ฌ์šฉ๋ฐฉ๋ฒ• ๋‹ค์šด https://jmeter.apache.org/download_jmeter.cgi Apache JMeter - Download Apache JMeter Download Apache JMeter We recommend you use a mirror to download our release builds, but you must ver..

yujindonut
'Server๐Ÿงค/QueryDsl' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก