지식 그래프 어플리케이션
TheLouvre에 작품이 있는 작
가들은?
모나리자를 그린 사람은?
Alice가 Paris에 있는 동안 방문
할 museums 들은?
8.
글로벌 조세 정책웹 탐색
“Our customers are increasingly required to navigate a complex web of global tax policies and r
egulations. We need an approach to model the sophisticated corporate structures of our largest
clients and deliver an end-to-end tax solution. We use a microservices architecture approach for
our platforms and are beginning to leverage Amazon Neptune as a graph-based system to quic
kly create links within the data.”
said Tim Vanderham, chief technology officer, Thomson Reuters Tax & Accounting
9.
Challenges Building Appswith Highly Connected Data
상호 연결성이 높은 데이터의 관계형 데이터베이스 처리 어려움
그래프 쿼리의
부자연스러움
그래프 프로세싱의
비효율성
데이터 변경에 유연하지 않
은 고정된 스키마
10.
상호 연결성이 높은데이터에 대한 다른 접근 방법
비지니스 프로세스에 적합한 구조
관계 파악에 적합한 구조
AMAZON NEPTUNE –완전 관리형 그래프 데이터베이스
뛰어난 성능 높은 가용성 오픈 그래프
수십억개의 관계를
밀리초 단위 지연시간
으로 쿼리
3개 가용영역 6 개 복제
백업 및 복구
Gremlin 및 SPARQL
를 통한 강력한 쿼리
손쉽게 작성
Apache TinkerPop 및
W3C RDF 그래프 모델
완전 관리형
NEW!
A property graphis a set of vertices and edges with respective properties (i.e.
key/value pairs)
• Vertex represents entities/domains
• Edge represents directional relationship
between vertices.
• Each edge has a label that denotes the
type of relationship
• Each vertex & edge has a unique identifier
• Vertex and edges can have properties
• Properties express non-relational information about the vertices and edges
프로퍼티 그래프
FRIENDname: Bi
ll
name: Sara
h
UserUser
Since 11/29/16
18.
• Apache TinkerPop
Opensource graph computing framework for Property
Graph
• Gremlin
Graph traversal language used to analyze the graph
프로퍼티 그래프 및 APACHE TINKERPOP
Amazon Neptune is fully compatibility with Tinkerpop Gremlin 3.3.0 (latest v
ersion released August 2017) and provides optimized query execution engine
for Gremlin query language.
19.
//Connect to Neptuneand receive a remote graph, g.
user1 = g.addVertex (id, 1, label, "User", "name", "Bill");
user2 = g.addVertex (id, 2, label, "User", "name", "Sarah");
...
user1.addEdge("FRIEND", user2, id, 21);
TINKERPOP 그래프 생성
Gremlin (Apache TinkerPop 3.3)
FRIEND
name: Bi
ll
name: Sara
h
User
User
20.
• RDF Graphsare described as a collection of triples: subject, predicate, and object.
• Internationalized Resource Identifiers (IRIs) uniquely identify subjects.
• The Object can be an IRI or Literal.
• A Literal in RDF is like a property and RDF supports the XML data types.
• When the Object is an IRI, it forms an “Edge” in the graph.
RDF 그래프
<http://www.socialnetwork.com/person#1>
rdf:type contacts:User;
contact:name: ”Bill” .
subject
predicate
Object (literal)
name: Bi
ll
User
<http://www.socialnetwork.com/person#1>IRI
<http://www.socialnetwork.com/person#1>
contacts:friend
<http://www.socialnetwork.com/person#2> .
subject
predicate
Object (IRI)
FRIEND
#1 2#2
21.
그래프 VS. 관계형데이터베이스 모델링
* Source : http://www.playnexacro.com/index.html#show:article
관계형 모델 그래프 모델
CompanyName:
Acme
…
Customers
OrderDate: 8/1/
2017
…
Order
PURCHASED
HAS_DETAILS
UnitPrice: $179.9
9
…
Order D
etailsProductName: “E
cho”
…
Product
HAS_PRODUCT
CompanyName:
“Amazon”
…
SupplierSUPPLIES
22.
SELECT distinct c.CompanyName
FROMcustomers AS c
JOIN orders AS o ON /* Join the customer from the order */
(c.CustomerID = o.CustomerID)
JOIN order_details AS od /* Join the order details from the order */
ON (o.OrderID = od.OrderID)
JOIN products as p /* Join the products from the order details */
ON (od.ProductID = p.ProductID)
WHERE p.ProductName = ’Echo'; /* Find the product named ‘Echo’ */
관계형 데이터베이스 SQL 쿼리
‘Echo’를 구매한 회사의 이름 조회
/* All productsnamed ”Echo” */
g.V().hasLabel(‘Product’).has('name',’Echo')
.in(’HAS_PRODUCT') /* Traverse to order details */
.in(‘HAS_DETAILS’) /* Traverse to order */
.in(’HAS_ORDER’) /* Traverse to Customer */
.values(’CompanyName’).dedup() /* Unique Company Name */
GREMLIN IMPERATIVE 그래프 탐색
‘Echo’를 구매한 회사의 이름 조회
그리고 친구의 친구를검색
g = graph.traversal()
g.V().has('name','Terry').as('user').
both('FRIEND').aggregate('friends').
both('FRIEND').
where(neq('user')).where(neq('friends')).
groupCount().by('name').
order(local).by(values, decr)
user
friend
fof
FRIEND
FRIEND
35.
... TERRY가 아니면서TERRY의 친구가 아닌
g = graph.traversal()
g.V().has('name','Terry').as('user').
both('FRIEND').aggregate('friends').
both('FRIEND').
where(neq('user')).where(neq('friends')).
groupCount().by('name').
order(local).by(values, decr)
user
friend
fof
X
FRIEND
FRIEND
완전 관리형 서비스
콘솔에서손쉽게 구성 가능
Multi-AZ 고가용성
최대 15개 읽기 복제
저장 시 암호화
전송 시 암호화 (TLS)
백업 및 복구, 특정 시점으로 복원(point-i
n-time recovery)
장 점 들
38.
AMAZON NEPTUNE: VPC배포
• VPC 내에 보안성 높은 배포
• 복수 가용 영역에 걸친 서로 다른
서브넷에 배포를 통한 가용성 향상
• 클러스터의 볼륨은 항상 3개의 가용
영역에 확장되어 내구성 높은 스토리지
• VPC 구성 상세 - Amazon Neptune
Documentation
39.
클라우드 네이티브 스토리지엔진 개요
데이터는 3개의 가용 영역에 걸쳐 6개의 복제
Amazon S3에 연속 백업 (11 9s 내구성 설계)
노드 및 디스크 보수를 위한 지속적 모니터링
복구 및 핫스팟 재밸런스를 위한 단위로
10GB 세그먼트
읽기 및 쓰기를 위한 쿼럼 시스템 및 낮은
응답속도 유지
쿼럼 멤버십 변경에도 쓰기 영향 없음
스토리지 볼륨은 자동으로 64TB 까지 증가
AZ 1 AZ 2 AZ 3
Amazon S3
Amazon
Neptune
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Monitoring
40.
AMAZON NEPTUNE 고가용성및 안정성
장애 가능 요소
세그먼트 장애 (디스크)
노드 장애(머신)
AZ 장애 (네트워크 및 데이터센터)
최적화
4 / 6 쓰기 쿼럼
3 / 6 읽기 쿼럼
복구를 위한 Peer-to-peer 복제
AZ 1 AZ 2 AZ 3
Caching
Amazon Nep
tune
AZ 1 AZ 2 AZ 3
Caching
Amazon Nep
tune
41.
AMAZON NEPTUNE 읽기복제
가용성
• 데이터베이스 노드 장애는 자동
감지 및 복구
• 데이터베이스 프로세스 장애는
자동 감지 및 재시작
• 읽기 복제는 필요 시 자동으로
프라이머리로 승격 (페일오버)
• 페일-오버 순서 사용자 지정
AZ 1 AZ 3AZ 2
Primary
Node
Primary
Node
Primary
Master
Node
Primary
Node
Primary
Node
Read Replic
a
Primary
Node
Primary
Node
Read Replic
a
Cluster
and Instance
Monitoring
성능
• 사용자 어플리케이션은 읽기
트래픽을 읽기 복제에 분산
• 읽기 복제에 읽기 부하 밸런싱
42.
AMAZON NEPTUNE 신속한페일 오버 (통상 <30초)
복제본-인지 어플리케이션 실행
장애 탐지 DNS 전파
복구
데이터베이스
장애
1 5 - 2 0 s e c 3 - 1 0 s e c
어플리케이션
실행
43.
AMAZON NEPTUNE 지속적백업
• 각 세그먼트의 주기적 스냅샷을 병렬로 수행 및 로그를 Amazon S3에
스트리밍 전송
• 백업은 지속적으로 발생하며 성능 및 가용성 영향 없이 수행
• 복구 시, 적절한 세그먼트 스냅샷을 반환 및 스토리지 노드에 로그 스트리밍
• 로그 스트림 적용은 병렬 및 비동기식 수행
Segment snapshot Log records
Recovery point
Segment 1
Segment 2
Segment 3
Time
44.
AMAZON NEPTUNE 온라인중 특정 시점으로 복원
온라인 특정 시점 복원(Online point-in-time restore)을 통해 백업으로부터
복구하지 않고 데이터베이스를 특정 시점으로 되돌리는 역할
• 데이터베이스를 신속하게 되돌리기
• 원하는 특정 시점으로 데이터베이스 상태 복구를 위하여 여러 차례
되돌리기
t0 t1 t2
t0 t1
t2
t3 t4
t3
t4
Rewind to t1
Rewind to t3
Invisible Invisible
45.
• Amazon Neptune은 완전 관리형 그래프 데이터베이스
• Apache TinkerPop 및 W3C RDF 그래프 모델 지원
• Gremlin 및 SPARQL 쿼리 언어 지원
• 콘솔에서 손쉽게 구성 가능
• Multi-AZ 고가용성
• 최대 15개 읽기 복제
• 저장 시 암호화 및 전송 시 암호화 (TLS)
• 백업 및 복구, 특정 시점으로 복원(point-in-time recovery)
체크포인트
46.
1. AWS re:Invent2017: NEW LAUNCH! Amazon Neptune Overview
and Customer Use Cases (DAT319) -
https://youtu.be/9pmQXua9LWA
2. AWS re:Invent 2017: NEW LAUNCH! Deep dive on Amazon
Neptune (DAT318) - https://youtu.be/6o1Ezf6NZ_E
3. Amazon Neptune 평가판 가입하기 -
https://pages.awscloud.com/NeptunePreview.html
본 강연이 끝난 후…