f_
frhyme.code
•others•โฑ ์•ฝ 8๋ถ„ ์†Œ์š”

Polyglot persistence

๐Ÿ“‘ ๋ชฉ์ฐจ (Contents)

Polyglot persistence is the concept of using different data storage technologies to handle different data storage needs within a given software application. Polyglot programming, a term coined by Neal Ford in 2006, expresses the idea that computer applications should be written in a mix of different programming languages, in order to take advantage of the fact that different languages are suitable for tackling different problems.

  • Polyglot persistence(๋‹ค์–‘ํ•œ ์–ธ์–ด์— ๋Œ€ํ•œ ๊ณ ์ง‘)์€ ์ฃผ์–ด์ง„ ์†Œํ”„ํŠธ์›จ์–ด ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์—์„œ ๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐ ์ €์žฅ์†Œ์— ๋Œ€ํ•œ ํ•„์š”๋ฅผ ์ปจํŠธ๋กคํ•˜๊ธฐ ์œ„ํ•ด์„œ, ๋‹ค์–‘ํ•œ ์ €์žฅ ๊ธฐ์ˆ ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๋งํ•ฉ๋‹ˆ๋‹ค.
  • polyglot programming์€ Neal Ford๊ฐ€ 2006๋…„์— ๋‹ค์–‘ํ•œ ๋ฌธ์ œ๋ณ„๋กœ ์ž˜ ์ž‘๋™ํ•˜๋Š” ์–ธ์–ด๋“ค์ด ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์—, ์ด๋ฅผ ํšจ๊ณผ์ ์œผ๋กœ ์ด์šฉํ•˜๊ธฐ ์œ„ํ•ด, ์ปดํ“จํ„ฐ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์ด ๋‹ค์–‘ํ•œ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์˜ ์กฐํ•ฉ์œผ๋กœ ์“ฐ์—ฌ์ง€๋Š” ๊ฒƒ์ด ํ•„์š”ํ•˜๋‹ค๋Š” ๊ฒƒ์„ ๋งํ•ฉ๋‹ˆ๋‹ค.

Complex applications combine different types of problems, so picking the right language for each job may be more productive than trying to solve all aspects of the problem using a single language. This same concept can be applied to databases, that an application can communicate with different databases, using each for what it is best at to achieve an end goal, hence the term polyglot persistence.

  • ๋ณต์žกํ•œ ํ”„๋กœ๊ทธ๋žจ(application)์€ ๋‹ค์–‘ํ•œ ์œ ํ˜•์˜ ๋ฌธ์ œ๋“ค์ด ํ˜ผํ•ฉ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ, ํ•„์š”์— ๋”ฐ๋ผ, ๊ฐ ๋ฌธ์ œ๋ณ„๋กœ ์ ํ•ฉํ•œ ์–ธ์–ด๋ฅผ ์„ ์ •ํ•˜๋Š” ๊ฒƒ์ด, ๋ชจ๋“  ๋ฌธ์ œ๋ฅผ ํ•˜๋‚˜์˜ ์–ธ์–ด๋กœ ํ‘ธ๋Š” ๊ฒƒ๋ณด๋‹ค ํ›จ์”ฌ ํšจ๊ณผ์ ์ž…๋‹ˆ๋‹ค.
  • ์ด๋Ÿฌํ•œ ๊ฐœ๋…์€ ์–ธ์–ด๋ฟ๋งŒ ์•„๋‹ˆ๋ผ, database์—๋„ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ์ ์šฉ๋  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์„œ๋กœ ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ํ†ต์‹ ํ•จ์œผ๋กœ ์ธํ•ด, ์šฐ๋ฆฌ์˜ ์ตœ์ข… ๋ชฉํ‘œ๋ฅผ ์„ฑ์ทจํ•˜๊ธฐ์— ๊ฐ€์žฅ ์ ํ•ฉํ•˜๊ฒŒ ํ•˜๋Š” ๊ฒƒ, ์ด๊ฒƒ์ด ๋ฐ”๋กœ polyglot persistenc์ž…๋‹ˆ๋‹ค.

There are numerous databases available to solve different problems. Using a single database to satisfy all of a programโ€™s requirements can result in a non-performant, โ€œjack of all trades, master of noneโ€ solution. Relational databases, for example, are good at enforcing relationships that exist between various data tables. To discover a relationship or to find data from different tables that belong to the same object, an SQL join operation can be used.

  • ์ด๋ฏธ, ๋‹ค์–‘ํ•œ ๋ฌธ์ œ๋“ค์— ์ ์šฉํ•  ์ˆ˜ ์žˆ๋Š” database๊ฐ€ ์กด์žฌํ•œ๋‹ค. ๋ชจ๋“  ํ”„๋กœ๊ทธ๋žจ์˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋งŒ์กฑํ•˜๊ธฐ ์œ„ํ•œ ํ•˜๋‚˜์˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€, ์„ฑ๋Šฅ๊ธฐ์ค€์— ๋งž์ง€ ์•Š์Šต๋‹ˆ๋‹ค. โ€œ๋ชจ๋“  ๊ฒƒ์„ ์ž˜ํ•˜๋ฉด, ์ž˜ํ•˜๋Š” ๊ฒƒ์€ ์—†๋‹ค(jack of all trades, master of none)โ€. ๊ด€๊ณ„ํ˜• ๋””๋น„์˜ ๊ฒฝ์šฐ, ์˜ˆ๋ฅผ ๋“ค๋ฉด, ๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐ ํ…Œ์ด๋ธ” ์‚ฌ์ด์— ์กด์žฌํ•˜๋Š” ๊ด€๊ณ„๋ฅผ ์ œํ•œํ•˜๋Š” ๊ฒƒ์— ๋Œ€ํ•ด์„œ๋Š” ๋งค์šฐ ํšจ๊ณผ์ ์ž…๋‹ˆ๋‹ค. ํ•˜๋‚˜์˜ ๊ฐœ์ฒด(object)์— ๋Œ€ํ•œ ์„œ๋กœ ๋‹ค๋ฅธ ํ…Œ์ด๋ธ”์— ์กด์žฌํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ฐพ๊ฑฐ๋‚˜, ๊ด€๊ณ„๋ฅผ ๋ฐœ๊ฒฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š”, SQL join์ด ์‚ฌ์šฉ๋  ์ˆ˜๋„ ์žˆ์ฃ .

This might work when the data is smaller in size, but becomes problematic when the data involved grows larger. A graph database might solve the problem of relationships in case of Big Data, but it might not solve the problem of database transactions, which are provided by RDBM systems. Instead, a NoSQL document database might be used to store unstructured data for that particular part of the problem. Thus different problems are solved by different database systems, all within the same application.

  • ์ด๊ฒƒ์€ ๋ฐ์ดํ„ฐ๊ฐ€ ์ž‘์„ ๋•Œ๋Š” ๋ฌธ์ œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜, ๋ฐ์ดํ„ฐ๊ฐ€ ์ปค์งˆ ์ˆ˜๋ก ์ ์ฐจ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒจ๋‚˜๊ธฐ ์‹œ์ž‘ํ•˜์ฃ . graph db์˜ ๊ฒฝ์šฐ ๋Œ€์šฉ๋Ÿ‰ ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•ด์„œ, ๊ด€๊ณ„๊ฐ„์— ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๋“ค์„ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, ์ด๋Š” ๋˜ํ•œ, database transaction์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ์ ๋“ค์„ ํ•ด๊ฒฐํ•  ์ˆ˜ ์—†์ฃ . ์ด๋Š” RDBMS์—์„œ ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค. ๋Œ€์‹ ์—, NoSQL document dtabase์˜ ๊ฒฝ์šฐ ํŠน์ • ๋ถ„์•ผ์˜ ๋น„๊ตฌ์กฐ์ ์ธ ๋ฐ์ดํ„ฐ(Unstructured data)๋ฅผ ์ €์ •ํ•˜๋Š” ๊ฒƒ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ํ•˜๋‚˜์˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด๋ผ๋„, ์„œ๋กœ๋‹ค๋ฅธ ๋ฌธ์ œ๋“ค์ด ์„œ๋กœ ๋‹ค๋ฅธ ์‹œ์Šคํ…œ์— ์˜ํ•ด์„œ ์ฒ˜๋ฆฌ๋  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด์ฃ .

wrap-up

  • ์ €์˜ ์ฃผ์š” ์–ธ์–ด๋Š” python์ž…๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  javascript์™€ ๋ช‡ ๊ฐœ์˜ ๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ฃ . ๋Œ€ํ•™์› ์กธ์—…์‹œ์— ํ•„์š”ํ•ด์„œ, python์œผ๋กœ ๋ฐฑ์—”๋“œ์—์„œ ๋Œ์•„๊ฐ€๋Š” ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ํ”„๋กœ๊ทธ๋žจ์„ ๋งŒ๋“ค๊ณ , javascript๋ฅผ ์‚ฌ์šฉํ•ด์„œ(chart.js, d3.js), ์›น ์ƒ์—์„œ ๋ฟŒ๋ ค์ง€๋Š” ์‹œ๊ฐํ™”๋ฅผ ๋งŒ๋“ค์—ˆ์ฃ .
  • ์‚ฌ์‹ค ์ธํ„ฐ๋„ท์ด๋ผ๋Š” ๊ฒƒ์ด ๊ฒฐ๊ตญ ๊ธฐ๋ณธ์ ์œผ๋กœ ํ…์ŠคํŠธ๋ฅผ ์ฃผ๊ณ  ๋ฐ›๋Š” ๊ฒƒ์ด๋ผ๊ณ  ๋ดค์„ ๋•Œ(์›น๋ธŒ๋ผ์šฐ์ €๋Š” ํ…์ŠคํŠธ๋ฅผ ๋ฐ›์•„์„œ, ๊ทธ๋ฆผ์„ ๊ทธ๋ ค์ฃผ๋Š” ๊ฒƒ์ด๋‹ˆ๊นŒ์š”), ํŒŒ์ด์ฌ๋งŒ์œผ๋กœ ๋ชจ๋“  ํ…์ŠคํŠธ๋ฅผ ๋‹ค ๋งŒ๋“ค์–ด์„œ ์ œ์–ดํ•  ์ˆ˜๋„ ์žˆ๊ธฐ๋Š” ํ•ฉ๋‹ˆ๋‹ค. ์‹ค์ œ๋กœ ์ œ๊ฐ€ ๋งŒ๋“  ํ”„๋กœ๊ทธ๋žจ์—์„œ๋„, ์ดˆ๊ธฐ์—๋Š” ์ข€ ๋” ๋งŽ์€ ๋ฌธ์ž์—ด์„ ๋ฐฑ์—”๋“œ์—์„œ ๋งŒ๋“ค์–ด ๋„˜๊ฒผ๋‹ค๋ฉด, ์ดํ›„, ์ ์ฐจ ์ž๋ฐ” ์Šคํฌ๋ฆฝํŠธ์— ์ต์ˆ™ํ•ด์ง์— ๋”ฐ๋ผ์„œ, ์ตœ์†Œํ•œ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋„˜๊ธฐ๊ณ , ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ ์ง์ ‘ ๋” ์ง๊ด€์ ์œผ๋กœ ์ฝ”๋”ฉํ•˜๊ธฐ๋„ ํ–ˆ์ฃ .
  • ๋ฌผ๋ก , ์ง€๊ธˆ ์ œ๊ฐ€ ๋งํ•œ ๊ฒƒ์€ ๊ทธ๋ƒฅ poly-glot programming์ผ ๋ฟ์ž…๋‹ˆ๋‹ค๋งŒ, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ๊ฒฝ์šฐ์—๋„ ๊ฒฐ๊ตญ ๋งˆ์ฐฌ๊ฐ€์ง€์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์‚ฌ๋žŒ๋“ค์ด NoSQL์ด ๋‚˜์˜ค๊ณ , ๋งˆ์น˜ ๊ด€๊ณ„ํ˜• DB๋Š” ํ•„์š”์—†๋‹ค๋Š” ์‹์œผ๋กœ ๋งค๋„๋ฅผ ๋‹นํ•˜๊ธฐ๋„ ํ–ˆ์ง€๋งŒ, ๊ฐ๊ฐ์˜ ์„ฑ์งˆ์€ ๋‹ค๋ฅด์ฃ . ๊ทธ๋ž˜์„œ ํ•„์š”ํ•œ ๊ณณ์— ํ•„์š”ํ•œ ๊ฒƒ์„ ์“ฐ๋Š” ๊ฒƒ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  • ๋‹ค๋งŒ, ์‚ฌ์‹ค ์ด๊ฒŒ ์ œ์ผ ์–ด๋ ต์ฃ . ์–ด๋–ค ๋ฌธ์ œ๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ์ด ๋ฌธ์ œ๋ฅผ ์ •๋ง ์ •ํ™•ํ•˜๊ฒŒ ์ดํ•ดํ•˜๊ณ , ๊ทธ ๋ฌธ์ œ๋“ค ์„ธ๋ถ€ ์„œ๋ธŒ ๋ฌธ์ œ๋กœ ์ชผ๊ฐœ๊ณ , ๊ทธ๋ฆฌ๊ณ  ๊ทธ ์„œ๋ธŒ ๋ฌธ์ œ๋ฅผ ํ’€๊ธฐ์— ๊ฐ€์žฅ ์ ํ•ฉํ•œ ๊ฒƒ์€ ๋ฌด์—‡์ธ์ง€, ์ •ํ™•ํ•˜๊ฒŒ ๋งคํ•‘์„ ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์•„๋‹ˆ, ์ด๊ฒŒ ๋ง์ด ๋˜๋‚˜์š”. ๊ด€๊ณ„ํ˜•DB๋ฅผ ์ž˜ ์•„๋Š” ๊ฒƒ๋„ ์–ด๋ ค์šด๋ฐ, ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒƒ๋„ ๋‹ค ์•Œ๋ผ๋‹ˆ์š” ํํํํํ‘
  • ๋ญ, ๊ทธ๋ž˜๋„, ๊ฒฐ๊ตญ ์—ฌ๊ธฐ์„œ ๋งํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์€ ํ•˜๋‚˜์˜ ์–ธ์–ด, ํ•˜๋‚˜์˜ ํ•™๋ฌธ์— ๋Œ€ํ•œ ์•„์ง‘์„ ๋ฒ„๋ฆฌ๋Š” ๊ฒƒ์ด ํ•„์š”ํ•˜๋‹ค, ์ •๋„์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
๐Ÿ”— ์—ฐ๊ด€ ์ง€์‹ ํ—ˆ๋ธŒ:๐Ÿ“‚ others ์นดํ…Œ๊ณ ๋ฆฌ#database#nosql#polyglot

๐Ÿ’กRELATED ARTICLES ยท ํ•จ๊ป˜ ์ฝ์œผ๋ฉด ์ข‹์€ ์—ฐ๊ด€ ํฌ์ŠคํŠธ

๊ธ€ ์ฃผ์†Œ๊ฐ€ ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.