๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ96

[Linux] OOM Killer๋ž€? Kill ๋Œ€์ƒ์—์„œ ์ œ์™ธ์‹œํ‚ค๊ธฐ ํšŒ์‚ฌ์—์„œ ๋‹ค๋ฅธ ํŒ€๋“ค๊ณผ ๊ณต์šฉ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ์„œ๋ฒ„๊ฐ€ ์žˆ๋Š”๋ฐ ์ž๊พธ ์ด์œ ์—†์ด ๋ฌด์ž‘์œ„๋กœ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ฃฝ๋Š” ํ˜„์ƒ์ด ๋ฐœ์ƒํ–ˆ๋‹ค. ๊ฐ ํ”„๋กœ์ ํŠธ์˜ ๋กœ๊ทธ๋ฅผ ๋ด๋„ ํŠน๋ณ„ํ•˜๊ฒŒ ๋‚จ์•„์žˆ๋Š”๊ฒŒ ์—†์—ˆ๊ณ .. ์›์ธ์€ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋ถ€์กฑํ•˜์—ฌ ๋ฆฌ๋ˆ…์Šค ์ปค๋„์ด OOM Killer ์ž‘์—…์„ ์‹คํ–‰ํ•œ ๊ฒƒ! OOM Killer๋ž€ ? OOM : Out of Memory ๋ฉ”๋ชจ๋ฆฌ ๋ถ€์กฑ์‹œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ™•๋ณดํ•˜๊ธฐ ์œ„ํ•œ ๊ฒƒ์œผ๋กœ ํ”„๋กœ์„ธ์Šค์˜ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น์‹œ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋ถ€์กฑํ•œ ์ƒํ™ฉ์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด linux kernel์ด OOM Killer๋ฅผ ์‹คํ–‰ํ•œ๋‹ค. (์ ์ˆ˜๋ฅผ ๋งค๊ฒจ ๋†’์€ ์ ์ˆ˜๋ฅผ ๋ฐ›์€ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ฃฝ์—ฌ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ™•๋ณดํ•จ) ํ”„๋กœ์„ธ์Šค๋ฅผ ์ข…๋ฃŒ์‹œํ‚ค๋Š” ์ˆœ์œ„ oom_badnesss() ๋ฉ”์†Œ๋“œ์—์„œ ํ”„๋กœ์„ธ์Šค๋ณ„ ์ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•˜์—ฌ ์„ ํƒ OOM Killer๋Š” ์ ์ˆ˜๋ฅผ ๋งค๊ฒจ ๊ฐ€์žฅ ๋†’์€ ์ ์ˆ˜๋ฅผ ๋ฐ›์€ ํ”„๋กœ์„ธ์Šค๋ถ€ํ„ฐ kill.. 2022. 1. 18.
[DB] UUID๋ฅผ PK(Primary Key)๋กœ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ ? UUID๋ž€? Universally unique identifier ๋„คํŠธ์›Œํฌ ์ƒ์—์„œ ๊ณ ์œ ์„ฑ์ด ๊ณ ์žฅ๋˜๋Š” ID๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ ํ‘œ์ค€ ๊ทœ์•ฝ์œผ๋กœ ๋žœ๋คํ•˜๊ฒŒ ์ƒ์„ฑ๋˜๋Š” ๊ฐ’์ด๋ฉฐ, ์ค‘๋ณต๋  ํ™•๋ฅ ์ด 0%๋Š” ์•„๋‹ˆ์ง€๋งŒ ๋งค์šฐ ํฌ๋ฐ•ํ•˜๋‹ค. DB ๊ด€๋ จ ์„œ์ ์„ ๋ณด๊ฑฐ๋‚˜ ์„œ์น˜๋ฅผ ํ•˜๋ฉด PK๋ฅผ auto_increment๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๊ณ , ์ด๋ ‡๊ฒŒ ์‚ฌ์šฉํ•˜๋Š”๊ฒŒ ์ข‹๋‹ค๊ณ ๋“ค ์–˜๊ธฐํ•œ๋‹ค. PK๋ฅผ auto_increment๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ์ข‹์ง€๋งŒ ์ด PK๊ฐ’์ด URL ํ˜น์€ ๊ณต๊ฐœ๋œ ๊ณณ์— ๋…ธ์ถœ๋œ๋‹ค๋ฉด? ์ด ๊ฐ’์€ ๋‹จ์ˆœํ•˜๊ฒŒ ์ฆ๊ฐ€ํ•˜๋Š” ๊ฐ’์ด๋ผ ์œ ์ถ”ํ•˜๊ธฐ ์‰ฝ๊ณ , ์ด๋กœ ์ธํ•ด ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ์— ์‰ฝ๊ฒŒ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋‹ค. ์ฆ‰, ์˜ˆ์ธก ๊ฐ€๋Šฅํ•œ ๋ชจ๋ธ์ด ๋˜๋ฏ€๋กœ ํฌ๋กค๋ง์ด๋‚˜ ์ธ์ ์…˜ ๊ณต๊ฒฉ์— ๋” ์ทจ์•ฝํ•˜๋‹ค. ๋”ฐ๋ผ์„œ ์‰ฝ๊ฒŒ ์œ ์ถ”ํ•  ์ˆ˜ ์—†๋„๋ก UUID๋ฅผ PK๋กœ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋Š” ๊ฒƒ! 2022. 1. 17.
[Spring] @Transactional์ด ์ ์šฉ๋˜์ง€ ์•Š์„ ๊ฒฝ์šฐ(๋กค๋ฐฑ์ด ์•ˆ๋˜๋Š” ์ด์œ ) 1. Checked Exception์ผ ๊ฒฝ์šฐ ์‚ฌ์‹ค ์ด ํ•ญ๋ชฉ์— ๋Œ€ํ•œ ์„ค๋ช…์„ ์œ„ํ•ด ์–ด์ œ java์˜ error์™€ exception์— ๋Œ€ํ•ด ํฌ์ŠคํŒ…์„ ํ–ˆ๋‹ค. Checked Exception์ด ๋ญ”์ง€ ๋ชจ๋ฅธ๋‹ค๋ฉด ๋จผ์ € ์•„๋ž˜ ํฌ์ŠคํŒ…์„ ๋ณด๊ณ  ์˜ค๋Š” ๊ฒƒ์„ ์ถ”์ฒœ! [Java] Error, Checked Exception, Unchecked Exception ๋น„๊ต ์ž๋ฐ”์—์„œ๋Š” ์˜ˆ์™ธ๋ฅผ ํฌ๊ฒŒ Error์™€ Exception์œผ๋กœ ๊ตฌ๋ถ„ํ•˜๊ณ , Exception์€ RuntimeException ์ƒ์† ์—ฌ๋ถ€์— ๋”ฐ๋ผ Checked Exception, Unchecked Exception์œผ๋กœ ๊ตฌ๋ถ„๋œ๋‹ค. Error ์‹œ์Šคํ…œ์— ๋น„์ •์ƒ์ ์ธ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•œ ๊ฒฝ.. ynzu-dev.tistory.com Checked Exception๋Š” ์˜ˆ์™ธ์ƒํ™ฉ ๋ฐœ์ƒ์‹œ ๋กค๋ฐฑ์ฒ˜๋ฆฌ๋ฅผ ํ•˜.. 2022. 1. 13.
[JAVA] Error, Checked Exception, Unchecked Exception ๋น„๊ต ์ž๋ฐ”์—์„œ๋Š” ์˜ˆ์™ธ๋ฅผ ํฌ๊ฒŒ Error์™€ Exception์œผ๋กœ ๊ตฌ๋ถ„ํ•˜๊ณ , Exception์€ RuntimeException ์ƒ์† ์—ฌ๋ถ€์— ๋”ฐ๋ผ Checked Exception, Unchecked Exception์œผ๋กœ ๊ตฌ๋ถ„๋œ๋‹ค. Error ์‹œ์Šคํ…œ์— ๋น„์ •์ƒ์ ์ธ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ๋กœ ์‹œ์Šคํ…œ ๋ ˆ๋ฒจ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์‹ฌ๊ฐํ•œ ์ˆ˜์ค€์˜ ์˜ค๋ฅ˜๋ฅผ ์˜๋ฏธํ•˜๋ฉฐ, ๊ฐœ๋ฐœ์ž๊ฐ€ ์—์ธกํ•  ์ˆ˜ ์—†๊ธฐ์— ๋ฏธ๋ฆฌ Handlingํ•  ์ˆ˜ ์—†๋‹ค. Exception ๊ฐœ๋ฐœ์ž๊ฐ€ ๊ตฌํ˜„ํ•œ ๋กœ์ง์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋ฏธ๋ฆฌ ์˜ˆ์ธกํ•˜์—ฌ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์–ด์„œ ์ƒํ™ฉ์— ๋งž๊ฒŒ Handling ํ•ด์•ผํ•œ๋‹ค. ์•„๋ž˜๋Š” Checked Exception๊ณผ Unchecked Exception์„ ๋น„๊ตํ•œ ํ‘œ์ด๋‹ค. Checked Exception Unchecked Exception ๋กœ์ง์—์„œ ์˜ˆ์™ธ์ฒ˜๋ฆฌ ์—ฌ.. 2022. 1. 12.
[JAVA] ์ƒ์„ฑ์ž ๋Œ€์‹  ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๋ฅผ ๊ณ ๋ คํ•ด์•ผ ํ•˜๋Š” ์ด์œ ! ๋จผ์ € ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๊ฐ€ ๋ญ”์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ์œผ๋ฉด ์•„๋ž˜ ํฌ์ŠคํŒ…์„ ๋ณด๊ณ  ์˜ค์ž! [Java] ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๋ž€? (static factory method) ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ ์ •์ (static), ํŒฉํ† ๋ฆฌ(factory), ๋ฉ”์„œ๋“œ(method) GoF๋ผ๋Š” ๋””์ž์ธ ํŒจํ„ด ์ค‘ ํŒฉํ† ๋ฆฌ ํŒจํ„ด์—์„œ ์œ ๋ž˜ํ•œ ๋‹จ์–ด๋กœ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์—ญํ• ์„ ๋ถ„๋ฆฌํ•˜๊ฒ ๋‹ค๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค. (ํ•˜์ง€๋งŒ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ” ynzu-dev.tistory.com 1. ์ด๋ฆ„์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋‹ค. BigInteger ํด๋ž˜์Šค๋ฅผ ์˜ˆ๋ฅผ ๋“ค์–ด ๋ณด๋ฉด ์ƒ์„ฑ์ž์ธ BigInteger(int, int, Random)๊ณผ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ์ธ probablePrime(int, Random) ์ค‘ ํ›„์ž๊ฐ€ ๋ฉ”์†Œ๋“œ ๋ช…๋•๋ถ„์— '๊ฐ’์ด ์†Œ์ˆ˜์ธ BigInteger๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค'๋ผ๋Š” ์˜๋ฏธ๋ฅผ ํŒŒ์•…ํ•˜๊ธฐ ์‰ฝ๋‹ค.. 2022. 1. 12.
[JAVA] ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๋ž€? (static factory method) ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ ์ •์ (static), ํŒฉํ† ๋ฆฌ(factory), ๋ฉ”์„œ๋“œ(method) GoF๋ผ๋Š” ๋””์ž์ธ ํŒจํ„ด ์ค‘ ํŒฉํ† ๋ฆฌ ํŒจํ„ด์—์„œ ์œ ๋ž˜ํ•œ ๋‹จ์–ด๋กœ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์—ญํ• ์„ ๋ถ„๋ฆฌํ•˜๊ฒ ๋‹ค๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค. (ํ•˜์ง€๋งŒ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ์™€ ํŒฉํ† ๋ฆฌ ํŒจํ„ด์€ ๋ช…ํ™•ํ•˜๊ฒŒ ๋‹ค๋ฅด๊ณ , ๋””์ž์ธ ํŒจํ„ด ์ค‘์— ์ด์™€ ์ผ์น˜ํ•˜๋Š” ํŒจํ„ด์ด ์—†๋‹ค๊ณ  ํ•œ๋‹ค. ์ด ๋ถ€๋ถ„์— ๋Œ€ํ•ด์„  ๊ณต๋ถ€๋ฅผ ํ•ด๋ด์•ผ๊ฒ ๋‹ค..) ์ข€ ๋” ์‰ฝ๊ฒŒ ์„ค๋ช…ํ•˜์ž๋ฉด ์ƒ์„ฑ์ž๋ฅผ ํ†ตํ•ด ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ ๋ณ„๋„ ๋ฉ”์†Œ๋“œ๋ฅผ ์ •์˜ํ•ด์„œ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ฐ์ฒด ๋‚ด์— ์ •์  ๋ฉ”์†Œ๋“œ๋ฅผ ์ •์˜ํ•ด๋†“์€ ๊ฒƒ! ์ •ํ™•ํžˆ ์–ด๋–ค ๋ฉ”์†Œ๋“œ๋ฅผ ์–˜๊ธฐํ•˜๋Š” ๊ฑด์ง€ ์˜ˆ์‹œ๋ฅผ ๋“ค์–ด๋ณด๊ฒ ๋‹ค. java.time ํŒจํ‚ค์ง€์— ํฌํ•จ๋œ LocalDateTime ํด๋ž˜์Šค์˜ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ๋ฅผ ์‚ดํŽด ๋ณด๋ฉด ์ƒ์„ฑ์ž๋ฅผ ํ†ตํ•ด ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ of ๋ฉ”์†Œ.. 2022. 1. 10.
[Web] redirect์‹œ ๋ฐ์ดํ„ฐ ์ „๋‹ฌํ•˜๋Š” ๋ฐฉ๋ฒ• - RedirectAttributes ๊ฒฐ๋ก  : RedirectAttributes ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค! @Controller class TestController { @PostMapping("/buy") public String buy(@ModelAttribute("testForm") TestVo vo , HttpServletRequest request , RedirectAttributes redirectAttributes){ // ๊ฒฐ์ œ ์ฒ˜๋ฆฌ ๋กœ์ง //์ฒซ๋ฒˆ์งธ ๋ฐฉ๋ฒ• redirectAttributes.addAttribute("param", param); //๋‘๋ฒˆ์งธ ๋ฐฉ๋ฒ• redirectAttributes.addFlashAttribute("param", param); return "redirect:/buy-result"; } } addAttrib.. 2022. 1. 7.
[Web] PRG ํŒจํ„ด (Post - Redirect - Get) PRG ํŒจํ„ด์ด๋ž€? Post -> Redirect -> Get ํŒจํ„ด์œผ๋กœ ๋งŒ๋“ค์–ด์ง€๋Š” ๊ฒƒ์„ ๋งํ•˜๋ฉฐ, ๊ถŒ์žฅ๋˜๋Š” ๋””์ž์ธ ํŒจํ„ด ์ค‘ ํ•˜๋‚˜๋‹ค. PRG ํŒจํ„ด์˜ ํ•„์š”์„ฑ ์˜ˆ๋ฅผ ๋“ค์–ด ์ƒํ’ˆ ํŒ๋งค ์„œ๋น„์Šค๋ฅผ ์šด์˜ํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ํ•˜์ž. ์ฃผ๋ฌธ ํŽ˜์ด์ง€๋ฅผ ํ˜ธ์ถœํ•˜๊ณ , Post ๋ฐฉ์‹์œผ๋กœ ๊ฒฐ์ œ๋ฅผ ์ฒ˜๋ฆฌํ•  ๊ฒฝ์šฐ ๊ฒฐ์ œ ์™„๋ฃŒ ํŽ˜์ด์ง€์—์„œ ์‹ค์ˆ˜ ํ˜น์€ ์˜๋„์ ์œผ๋กœ ์ƒˆ๋กœ๊ณ ์นจ์„ ํ•˜๊ฒŒ ๋˜๋ฉด ์„œ๋ฒ„์— ์ „์†กํ–ˆ๋˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค์‹œ ์ „์†กํ•˜๊ฒŒ ๋˜์–ด ์ค‘๋ณต ๊ฒฐ์ œ ์ฒ˜๋ฆฌ๊ฐ€ ๋  ์ˆ˜ ์žˆ๋‹ค. ์ž์„ธํ•œ ํ”„๋กœ์„ธ์Šค๋Š” ์•„๋ž˜ ํฌ์ŠคํŒ…์„ ์ฐธ๊ณ ํ•˜์ž [WEB] PRGํŒจํ„ด PRG(Post-Redicet-Get)ํŒจํ„ด์€ ์›น ๊ฐœ๋ฐœ์‹œ ์‚ฌ์šฉ ๊ถŒ์žฅ๋˜๋Š” ๋””์ž์ธ ํŒจํ„ด์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž์˜ ๋’ค๋กœ๊ฐ€๊ธฐ, ์ƒˆ๋กœ๊ณ ์นจ์œผ๋กœ ์ธํ•œ ์ค‘๋ณต์ž…๋ ฅ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. EX) ์ƒํ’ˆ์ฃผ๋ฌธ PRGํŒจํ„ด ์ ์šฉ ์ „ ์‚ฌ์šฉ์ž๊ฐ€ ์ƒํ’ˆ ์ฃผ๋ฌธ juinor.tistory... 2022. 1. 7.
728x90
๋ฐ˜์‘ํ˜•