๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

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

ObjectMapper ์‚ฌ์šฉ List Mapping ObjectMapper ์‚ฌ์šฉํ•ด์„œ List๋ฅผ ํ•œ๋ฐฉ์— ํŠน์ • ํƒ€์ž…์˜ List๋กœ ๋งคํ•‘ ์‹œํ‚ฌ ๋•Œ list list mapping import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; ... ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); //์—ฌ๊ธฐ ์„ ์–ธ ์•Š๊ณ  Model ์ชฝ์— lombok annotation ์‚ฌ์šฉํ•ด.. 2022. 11. 28.
[GCP] VM์˜ Disk, Memory ์ˆ˜์ง‘์„ ์œ„ํ•œ Ops Agent ์„ค์น˜ ์„ค์น˜ ๊ฐœ์š” ํด๋ผ์šฐ๋“œ ์ •์ฑ… ์ƒ Memory, Disk ์ •๋ณด๋Š” ๊ธฐ๋ณธ์œผ๋กœ ์ œ๊ณต์„ ํ•˜์ง€ ์•Š๋Š”๋‹ค. AWS, Azure, GCP ๋ชจ๋‘ ๋งˆ์ฐฌ๊ฐ€์ง€์ด๋ฉฐ, ํ•ด๋‹น utilization์ด๋‚˜ ๊ธฐํƒ€ ์ถ”๊ฐ€์ ์ธ ๋ฉ”ํŠธ๋ฆญ์„ ์ˆ˜์ง‘์„ ์›ํ•˜๋ฉด ๊ฐ ๋ฒค๋” ๋งˆ๋‹ค ์ง€์›ํ•˜๋Š” agent๋ฅผ ์„ค์น˜ํ•ด์„œ ์ˆ˜์ง‘์„ ์ง„ํ–‰ํ•ด์•ผํ•œ๋‹ค. GCP๋Š” ๊ธฐ์กด์— Stack Driver Agent๋ฅผ ์„ค์น˜ํ•˜๋Š” ๋“ฏ ํ–ˆ์œผ๋‚˜ ๊ณง ์ง€์› ์ข…๋ฃŒ๋กœ ๋ณด์ด๋ฉฐ, ํ˜„์žฌ๋Š” Ops Agent ์„ค์น˜๋ฅผ ๊ถŒ์žฅํ•˜๊ณ  ์žˆ๋‹ค. ๊ณตํ†ต ๊ธฐ๋ณธ ์„ค์ • Cloud Monitoring API ์‚ฌ์šฉ ์ฒดํฌ (API ํ™œ์„ฑํ™”) https://console.cloud.google.com/apis/api/monitoring/metrics ์—ญํ•  ์ƒ์„ฑ monotoring.timeSerires.create ๊ถŒํ•œ์ด ํ•„์š”ํ•˜๋‹ค ์—ญํ•  ์ถ”๊ฐ€ ์ƒ์„ฑํ•œ ์—ญํ• ์„.. 2022. 7. 30.
A fatal error has been detected by the Java Runtime Environment. Docker Alphine Image Crashed Exception ์ด์Šˆ ํŠน์ • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ์•ŒํŒŒ์ธ ์ด๋ฏธ์ง€ ๋ฏธ์ง€์› ์ด์Šˆ๋กœ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ๋œจ์ž๋งˆ๋‹ค ๋ป—์–ด๋ฒ„๋ฆผ ์›์ธ google api๋ฅผ ์‚ฌ์šฉํ•ด์•ผํ–ˆ๊ณ , ๋ฒ„์ „ ๊ด€๋ฆฌ๋ฅผ ์ˆ˜์›”ํ•˜๊ฒŒ ํ•˜๋ ค๊ณ  bom์„ ์ถ”๊ฐ€ํ–ˆ๋Š”๋ฐ ์—ฌ๊ธฐ์•ˆ์— ์žˆ๋Š” Library์ค‘์˜ ์ผ๋ถ€๊ฐ€ Alphine ์ด๋ฏธ์ง€๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š์•„์„œ ๋ฐœ์ƒํ•˜๋Š” ์ด์Šˆ com.google.cloud libraries-bom 25.3.0 pom import ๋กœ์ปฌ์—์„œ๋Š” ๋ฐœ์ƒํ•˜์ง€ ์•Š์œผ๋ฉฐ, Docker๋กœ ์˜ฌ๋ฆฐ ๊ฐœ๋ฐœ ECS ์ปจํ…Œ์ด๋„ˆ์—์„œ๋งŒ ๋ฐœ์ƒํ–ˆ๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ๊ฐ€์žฅ ๊ฐ„๋‹จํ•˜๊ฒŒ๋Š” ๊ฑ ์ด๋ฏธ์ง€ ๊ต์ฒด ์•ŒํŒŒ์ธ์ด ๊ฐ€๋ฒผ์›Œ์„œ ์ผ๋‹ค์ง€๋งŒ ์•ˆ๋œ๋‹ค๊ธฐ์— ๋‹ค๋ฅธ slimํ•œ ์ด๋ฏธ์ง€๋กœ ๊ต์ฒด -> ๋„์ปคํŒŒ์ผ ๋‚ด image ์ถ”๊ฐ€ ๋ฐ wget์ด ์•ˆ๋œ๋‹ค๊ธฐ์— ํ•ด๋‹น ๋ช…๋ น์–ด๋„ ์ถ”๊ฐ€ (as-is image : amazoncorretto:8-alpine-jre) .... 2022. 7. 25.
Clone์œผ๋กœ ์ƒ์„ฑํ•œ ํ”„๋กœ์ ํŠธ ์ดˆ๊ธฐํ™” ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ์‹œ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ๋งŒ๋“ค๊ณ  ์ƒˆ๋กœ ๊ตฌ์„ฑํ•ด์„œ ์˜ฌ๋ฆฌ๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ์ง€๋งŒ, ๊ธฐ์กด ํ”„๋กœ์ ํŠธ๋ฅผ Clone ํ•˜์—ฌ, ๊ธฐ์กด Git ์—ฐ๊ฒฐ์„ ๋Š๊ณ  Commit๋“ค์„ ์ดˆ๊ธฐํ™” ํ•œ ํ›„ ํ•„์š” ํŒŒ์ผ๋“ค๋งŒ ์ถ”๋ ค์„œ ์ปค๋ฐ‹ ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ƒˆ๋กœ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•. Clone ๋œฌ ์›๊ฒฉ ๋ถ€ํ„ฐ ๋Š๊ธฐ git remote -v git remote remove origin ์›๊ฒฉ ์—ฐ๊ฒฐ ๋Š๊ณ  ๋‚œ ํ›„ Git ์ดˆ๊ธฐํ™” rm -rf .git git init ์ฒซ Commit ์ž‘์„ฑ git add . git commit -m "Initial Commit" ์›๊ฒฉ ์ €์žฅ์†Œ(Bitbucket, github ...)์— ์ƒˆ๋กœ์šด Repository ์ƒ์„ฑ git ์ €์žฅ์†Œ ์—ฐ๊ฒฐ ํ›„ ํ‘ธ์‰ฌ git remote add origin {remoteUrl} git push -u --force or.. 2022. 5. 28.
[Java] List ๋‚˜๋ˆ„๊ธฐ As-Is ํž˜๋“ค๊ฒŒ ๋‚˜๋ˆ„๋Š” ๋ฒ• (subList) public static void main(String[] args) { List integerList = new ArrayList(); for(int i = 0; i 2022. 5. 23.
[Java] Null String Casting Null์„ String์œผ๋กœ Castingํ•  ๋•Œ, Null Pointer Exception ์•ˆ๋ฐœ์ƒํ•จ. ์ž˜ ์บ์ŠคํŒ…๋จ 2022. 4. 29.
[Java] Map ์ œ๊ณต ๋ฉ”์„œ๋“œ๋“ค ์ •๋ฆฌ map.getOrDefault(key,0) null ์ธ ๊ฒฝ์šฐ Default ๊ฐ’ 0์œผ๋กœ ์ง€์ • map.containsKey('A') ํ‚ค ๊ฐ’์— ํ•ด๋‹น ๊ฐ’(A)๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๋Š”์ง€ ์ฒดํฌ map.size() ๋งต ํฌ๊ธฐ ์ฒดํฌ map.isEmpty() ๋งต์ด ๋น„์–ด์žˆ๋Š”์ง€ ์ฒดํฌ map.remove('A') ๋งต์—์„œ ํ‚ค๊ฐ€ A์ธ ํ•ญ๋ชฉ ์‚ญ์ œ A๋ผ๋Š” ํ‚ค์˜ value๊ฐ’ ๋ฆฌํ„ด 2022. 4. 26.
[Book] ์†Œํ”„ํŠธ์›จ์–ด ์žฅ์ธ 3๋…„์ „์— ๋นŒ๋ฆฐ ์ฑ…์ด์—ˆ๋Š”๋ฐ ์ด์ œ์„œ์•ผ ์ฝ์—ˆ๋‹ค. ์ข‹์€ ๊ฐœ๋ฐœ์ž? ๊ทธ ์ด์ƒ์ด ๋˜๊ธฐ ์œ„ํ•ด์„œ ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ•˜๋Š”๊ฐ€ ์„ค๋ช…์„ ํ•ด์ฃผ๋Š” ์ฑ…์ด์—ˆ๋Š”๋ฐ 2011๋…„ ์ฑ…์ž„์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ์š”์ฆ˜์˜ ๋‚˜, ๋‚ด ํšŒ์‚ฌ, ๋‚ด ์นญ๊ตฌ๋“ค, ํŒ€์žฅ๋‹˜์— ๋Œ€์ž…๋˜๋ฉฐ ์˜›๋‚  ์ฑ…์ด๋ผ๋Š” ์ด์งˆ๊ฐ ์—†์ด ์ž˜ ์ฝํ˜”๋‹ค. ์ข‹์€๊ฑด์ง„ ์ž˜ ๋ชจ๋ฅด๊ฒ ๋‹ค. ๋ฐœ์ „์— ํ•œ์ฐธ ๋ชป ๋ฏธ์นœ๋‹ค๋Š” ์˜๋ฏธ์ธ์ง€ ์•„๋‹˜ ๊ทธ๋•Œ๋‚˜ ์ง€๊ธˆ์ด๋‚˜ ๊ณ ๋ฏผํ•˜๋Š” ํฌ์ธํŠธ๋Š” ๋‹ค ๋˜‘๊ฐ™๋‹ค๋Š” ๊ฑด์ง€ ์ƒ๊ฐ.. ๊ทธ์น˜๋งŒ ํ™•์‹คํ•œ๊ฑด ์†”์งํžˆ 3๋…„์ „์— ์ฝ์—ˆ๋‹ค๋ฉด ์ด์ •๋„๊นŒ์ง€๋Š” ๊ณต๊ฐ ๋ชปํ–ˆ์„ ๊ฑฐ ๊ฐ™๋‹ค. ์ž˜๋ฏธ๋ค˜๋‹ค ใ…‹ใ…‹ ์ข‹๊ณ  ๊ณต๊ฐ๋˜๋Š” ๋‚ด์šฉ์ด ๋งŽ์•„ ๋”ฐ๋กœ ์ ์–ด ๋†จ์œผ๋‚˜ ๊ณต๊ฐœ์ ์œผ๋กœ ์“ฐ๊ธด ์ข€ ๊ทธ๋ž˜์„œ ์–˜๋Š” ๋”ฐ๋กœ ๋‘๊ณ ๋‘๊ณ  ์ฝ์–ด์•ผ๊ฒ ๋‹ค. ๊ฐœ์ธ์ ์œผ๋กœ ์• ์ž์ผ์˜ ์žฅ์ , ๊ทธ์น˜๋งŒ ์• ์ž์ผ๋งŒ์œผ๋ก  ํ•ด๊ฒฐ๋˜์ง€ ์•Š๋Š”๋‹ค, ์ข‹์€ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋˜๋ ค๋ฉด, ์ผํ•˜๋Š”๋ฐ ์žˆ์–ด์„œ ์ค‘์š”ํ•˜๊ฒŒ ๋‘์–ด์•ผํ•  ๊ฒƒ๋“ค, ๊ธฐ์ˆ  ๋ถ€์ฑ„ ํ•ด๊ฒฐ์„ ์œ„.. 2022. 4. 17.
OOM์˜ ์›์ธ๊ณผ ์•„์ฃผ ๊ฐ„๋‹จํ•˜๊ฒŒ OOM ๋ฐœ์ƒ ์‹œํ‚ค๊ธฐ outofmemory๊ฐ€ ๋‚˜๋Š” ์ด์œ  ์„ค์ •๋œ ๋ฉ”๋ชจ๋ฆฌ ๋Œ€๋น„ ์š”์ฒญ๋˜๋Š” ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋งŽ๊ธฐ ๋•Œ๋ฌธ์— ๋‚˜ํƒ€๋‚˜๋Š” JVM์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ ์„ค์ •์˜ ์˜ค๋ฅ˜๋‚˜ ์‚ฌ์šฉ๋Ÿ‰ ์ดˆ๊ณผ๋กœ ์ธํ•ด jdk 5 ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” jdk hotspot ๋ฒ„๊ทธ๋กœ ์ธํ•ด oom์ด ๋‚ฌ๋˜ ๊ฒฝ์šฐ๋„ ์žˆ์—ˆ์Œ oom ์˜ˆ์‹œ Application์˜ oom(์ˆœ๊ฐ„์ ) ๊ณผ๋„ํ•œ ๋ฐ์ดํ„ฐ ์กฐํšŒ(100๋งŒ๊ฑด 200๋งŒ๊ฑด์”ฉ ์กฐํšŒํ•ด์„œ ๋ฉ”๋ชจ๋ฆฌ ๋“ค๊ณ  ์žˆ๋Š” ๊ฒฝ์šฐ, ์—…๋กœ๋“œ ํŒŒ์ผ์„ ํ›„์ฒ˜๋ฆฌ ํ•˜๊ธฐ๋กœ ํ•ด์„œ ๋ฉ”๋ชจ๋ฆฌ์— ๋“ค๊ณ  ์žˆ๋Š” ๊ฒฝ์šฐ) ์ž˜๋ชป๋œ ๋ฐ์ดํ„ฐ ์กฐ์ž‘(string) ์žฅ์‹œ๊ฐ„์— ๊ฑธ์ณ์„œ ์„œ์„œํžˆ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ์žฅ์‹๋˜๋Š” ๊ฒฝ์šฐ(memory leak) Cache(์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ์—ฌ๋Ÿฌ ์“ฐ๋ ˆ๋“œ๊ฐ€ ๊ณต์œ ํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ) leak Pool(๋ฐฐํƒ€์ ์œผ๋กœ ์‚ฌ์šฉํ•  ๋•Œ) leak (oom ๊ฐ€๊ธฐ ์ด์ „์— ํ’€ ๋ถ€์กฑ์œผ๋กœ 2์ฐจ ์žฅ์• ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ๊ฒฝ์šฐ๋„ ๋งŽ์Œ.. 2022. 4. 16.