지금부터 스파크의 작동 방식을 이해하는 데 도움이 될 만한 몇 가지 기술적 개념을 살펴본다.
성능 극대화에 관심이 있는 개발자라면 이 주제를 자세히 살펴보길 바란다. 일반 독자 여러분
에게는 이 자료가 스파크 기반 애플리케이션을 설계하고 구축할 때 의사 결정을 내리는 데 필
요한 판단의 기준이 되기를 바란다.
3.1
병렬처리, 동시성과 분산 컴퓨팅
먼저 몇 가지 용어를 정의해보자.
프로세스
process
는 실행 중인 프로그램으로 생각할 수 있다.
프로세스는
메모리 공간
memory
space
이라고도 하는 할당된 메모리 부분을 사용하여 코드를 실
행한다.
스레드
thread
는 운영체제가 스케줄링할 수 있는 프로세스 내의 일련의 실행 단계 순서
다. 프로세스 간에 데이터를 공유하려면 일반적으로 각 프로세스의 서로 다른 메모리 공간
에 데이터를 복사해야 한다. 자바 또는 스칼라 프로그램이 실행될 때는
자바 가상 머신
Java
Virtual
Machine
(
JVM
)
이 프로세스다. 프로세스의 스레드는 동일한 메모리 공간에 대한 접근
access
을 공
유하며
동시에
접근한다. 다만 데이터의 동시 접근은 까다로울 수 있다. 예를 들어 단어 개수를
생성한다고 가정해보자. 이 프로세스에서 두 개의 스레드가 작동한다면 잘못된 총계를 얻을 수
있다.
다음 프로그램을 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.