16
Netflix SURO Begins [email protected] netflix suro 대해서 소개하도록 하겠습니다.

Netflix suro begins

Embed Size (px)

DESCRIPTION

팀 내 발표 자료. 새벽에 급하게 만드느라 형편없지만, 버리긴 아까워서;;;

Citation preview

Page 1: Netflix suro begins

Netflix����������� ������������������  ����������� ������������������  SURO����������� ������������������  Begins����������� ������������������  

[email protected]

netflix suro 에 대해서 소개하도록 하겠습니다.

Page 2: Netflix suro begins

SURO����������� ������������������  ?

• Apache����������� ������������������  Chukwa����������� ������������������  를����������� ������������������  기반으로����������� ������������������  구현����������� ������������������  

• Netflix’s����������� ������������������  distributed����������� ������������������  Data����������� ������������������  Pipeline����������� ������������������  service����������� ������������������  

• 많은����������� ������������������  데이터����������� ������������������  소스를����������� ������������������  처리하는데����������� ������������������  보다����������� ������������������  쉬운����������� ������������������  구성과����������� ������������������  운영에����������� ������������������  초점을����������� ������������������  맞춰����������� ������������������  디자인된

Page 3: Netflix suro begins

SURO����������� ������������������  ?

그냥... 로그 수집기

• Apache����������� ������������������  Chukwa����������� ������������������  를����������� ������������������  기반으로����������� ������������������  구현����������� ������������������  

• Netflix’s����������� ������������������  distributed����������� ������������������  Data����������� ������������������  Pipeline����������� ������������������  service����������� ������������������  

• 많은����������� ������������������  데이터����������� ������������������  소스에����������� ������������������  대해����������� ������������������  보다����������� ������������������  쉬운����������� ������������������  구성과����������� ������������������  운영에����������� ������������������  초점을����������� ������������������  맞춰����������� ������������������  디자인된

Page 4: Netflix suro begins

특징

• SURO����������� ������������������  Client����������� ������������������  is����������� ������������������  Not����������� ������������������  an����������� ������������������  Agent����������� ������������������  !����������� ������������������  

• Static����������� ������������������  /����������� ������������������  Dynamic����������� ������������������  Client-Side����������� ������������������  Load����������� ������������������  Balancing����������� ������������������  (Netflix����������� ������������������  OSS����������� ������������������  eureka)����������� ������������������  

• Dynamic����������� ������������������  Configuration����������� ������������������  without����������� ������������������  server����������� ������������������  restart����������� ������������������  (Netflix����������� ������������������  OSS����������� ������������������  Archaius)����������� ������������������  

• 메시지에����������� ������������������  포함된����������� ������������������  routingKey����������� ������������������  로����������� ������������������  목적지����������� ������������������  결정����������� ������������������  (sink)����������� ������������������  

• Message����������� ������������������  Filtering,����������� ������������������  multiple����������� ������������������  destinations����������� ������������������  

• 수평적����������� ������������������  확장의����������� ������������������  분산����������� ������������������  시스템����������� ������������������  

• 사용자����������� ������������������  정의����������� ������������������  Serde를����������� ������������������  통한����������� ������������������  임의의����������� ������������������  데이터����������� ������������������  형식을����������� ������������������  지원����������� ������������������  

• async,����������� ������������������  sync����������� ������������������  전송

Page 5: Netflix suro begins

구성

• Collector����������� ������������������  Server • Producer����������� ������������������  Client

• Status����������� ������������������  Server����������� ������������������  

• Thrift����������� ������������������  Server����������� ������������������  

• Message����������� ������������������  Process����������� ������������������  Queue����������� ������������������  

• Message����������� ������������������  Router����������� ������������������  

• Sink����������� ������������������  plugin

• Suro����������� ������������������  client����������� ������������������  api����������� ������������������  

• Suro����������� ������������������  log4j����������� ������������������  appender����������� ������������������  

• Suro����������� ������������������  log4j����������� ������������������  formatter

Page 6: Netflix suro begins

SURO-Server

1. 클라이언트로 부터 메시지 셋을 요청받음 2. Thrift Server를 통해 데이터를 전달

1. Non-blocking (Java NIO) 멀티 쓰레드 서버 구현 2. THsHAServer :

1. TNonblockingServerTransport 를 상속받아 구현되었음 2. Half-sync/Half-async 방식의 스레드 관리함.

1. 쓰레드 풀 구성하는 방법 2. IO : 비동기, 데이터 처리 : 동기, 둘 사이에 큐 존재하는 방식 성능에 좋다.

3. 메시지 셋 프로세스 큐에 등록 1. memory queue 2. file-backed queue : 첫번째로 파일에 쓰기 때문에 데이터 유실이 없음

4. 메시지 라우터에서 메시지를 가져와 1. routingKey와 Filtering Rule에 따라 Sink에 메시지 전달 2. 하나의 router에 두개 이상의 Sink 가 연결된 경우 한쪽에만 데이터가 전달 될 가능성이 있어 보임- 좀 더 분석 필요)

5. Sink : 데이터의 목적지 1. 각 Sink는 메시지 큐를 가지고 있음. 2. 현재 Opensource 로 공개된 Sink

1. localFileSink

Page 7: Netflix suro begins

SURO-Server����������� ������������������  Routing����������� ������������������  Map데이터의����������� ������������������  목적지를����������� ������������������  결정����������� ������������������  where����������� ������������������  ����������� ������������������  filter

1. 기본적으로 routingKey를 통해 sink가 결정 되며, 2. filter 절에 의해 필터링 된다. 3. type은 regex와 x-path를 지원 4. routingKey 에 대한 filtering은 regex 만 제공

Page 8: Netflix suro begins

SURO-Server����������� ������������������  Sink.json{! "default": {!! ! "type": "local",!! ! "outputDir": "/tmp/suroserver/default",!! ! "writer": {!! ! ! "type": "text"!! ! }!! },!! "textFile": {!! ! "type": "local",!! ! "outputDir": "/tmp/suroserver/textFile_sink",!! ! "writer": {!! ! ! "type": "text"!! ! },!! ! "rotationPeriod": "PT1h"!! },!! "sequenceFile": {!! ! "type": "local",!! ! "outputDir": "/tmp/suroserver/sequenceFile_sink",!! ! "writer": {!! ! ! "type": "sequence"!! ! },!! ! "rotationPeriod": "PT1m"!! },!! "kafkaTest": {!! ! "type": "Kafka",!! ! "metadata.broker.list": "localhost:9092",!! ! "request.required.acks": 1,!! ! "client.id": "kafkaTest"!! }!}

default����������� ������������������  설정은����������� ������������������  반드시����������� ������������������  등록해야함����������� ������������������  없으면����������� ������������������  Start����������� ������������������  up����������� ������������������  시����������� ������������������  오류����������� ������������������  발생����������� ������������������  !routing����������� ������������������  map����������� ������������������  에서����������� ������������������  해당����������� ������������������  하는����������� ������������������  것이����������� ������������������  ����������� ������������������  없을����������� ������������������  경우����������� ������������������  default로����������� ������������������  전송

1. Sink.json 작성법 소개 2. filter

1. regex 2. x-path

3. 로테이트 시간 iso-8601 , ms

Page 9: Netflix suro begins

SURO-STATUS����������� ������������������  Server

• ����������� ������������������  Suro����������� ������������������  Monitoring����������� ������������������  Server����������� ������������������  

• http://suro-server:7103/healthcheck����������� ������������������  

• response����������� ������������������  =>����������� ������������������  SuroServer����������� ������������������  -����������� ������������������  Ok����������� ������������������  ㅠㅠ����������� ������������������  

• http://suro-server:7103/sinkstat����������� ������������������  

• response����������� ������������������  =>����������� ������������������  Sink����������� ������������������  별����������� ������������������  데이터����������� ������������������  처리����������� ������������������  정보����������� ������������������  출력

Page 10: Netflix suro begins

SURO-Client

• synchronous����������� ������������������  /����������� ������������������  asynchronous����������� ������������������  전송����������� ������������������  방법����������� ������������������  제공����������� ������������������  

• asynchronous����������� ������������������  타입의����������� ������������������  경우����������� ������������������  memory����������� ������������������  queue/����������� ������������������  file-backed����������� ������������������  queue����������� ������������������  제공����������� ������������������  

• memory����������� ������������������  queue����������� ������������������  25%����������� ������������������  처리량����������� ������������������  높음����������� ������������������  ����������� ������������������  

• bigqueue����������� ������������������  사용����������� ������������������  (https://github.com/bulldog2011/bigqueue)����������� ������������������  

• Singleton����������� ������������������  Connection����������� ������������������  pool����������� ������������������  제공

1. sync : 동기적으로 하나의 메시지를 보내고 ACK 가 올때까지 블락됨 2. async :

1. 내부 queue에 메시지 등록 2. queue에서 메시지를 꺼내서 전송 3. batch process 4. batch size 설정 가능 5. 메시지에 대한 최대 대기시간 설정 가능 6. batch size 에 상관 없이 최대 대기 시간이 경과한 경우 전송.

3. Connection 1. Thrift client 는 NOT thread safe, 따라서 Sender의 수가 suro-server 보다 클 경우 여분의 concoction을 만든다.

Page 11: Netflix suro begins

Netflix����������� ������������������  OSS����������� ������������������  Eureka

1. 동적 load balancing을 위해 사용함 2. netflix OpenSource Software 중 하나 3. SURO의 동적 Load Balancing을 위해 사용됨. 4. Rest based service 5. middle tier 인스턴스 검색에 사용 6. 장애 복구 및 load balance 용도로 주로 사용됨 7. 기능 :

1. load balancing 2. deployment 3. automation 4. data storage 5. caching

8. Eureka-server / Eureka-client 로 구성 됨 1. JavaBased 2. Round-Robin load balancing 제공

Page 12: Netflix suro begins

Netflix����������� ������������������  OSS����������� ������������������  Archaius

• 구성����������� ������������������  관리����������� ������������������  라이브러리����������� ������������������  

• 여러����������� ������������������  저장소로����������� ������������������  부터����������� ������������������  동적����������� ������������������  구성����������� ������������������  변경����������� ������������������  기능����������� ������������������  제공

1. 동적 설정 변경을 위해 사용. 2.

Page 13: Netflix suro begins

SURO����������� ������������������  Dynamic����������� ������������������  Configuration

vm����������� ������������������  option����������� ������������������  설정����������� ������������������  !

-Darchaius.dynamicPropertyFactory.registerConfigWithJMX=true -Dcom.sun.management.jmxremote.port=10403

-Dcom.sun.management.jmxre.ssl=false

-Dcom.sun.management.jmxremote.authenticate=false

-Djava.rmi.server.hostname=localhost

1. 사용법 소개 2. vm 옵션 등록 3. jconsole 실행 4. 값 변경 5.

Page 14: Netflix suro begins

SURO����������� ������������������  Dynamic����������� ������������������  ConfigurationaddProperty����������� ������������������  !routing����������� ������������������  map����������� ������������������  ����������� ������������������  key����������� ������������������  :����������� ������������������  SuroServer.routingMap����������� ������������������  Sink����������� ������������������  config����������� ������������������  key����������� ������������������  :����������� ������������������  SuroServer.sinkConfig

Page 15: Netflix suro begins

Demo

• 데이터����������� ������������������  흐름����������� ������������������  확인����������� ������������������  

• /sinkstat����������� ������������������  

• hdfs����������� ������������������  

• kafka����������� ������������������  

• 동적����������� ������������������  routingMap����������� ������������������  /����������� ������������������  Sink����������� ������������������  확인

1. hdfs 비우고.. 1. ~download/hadoop/bin/hadoop fs -rmr /tmp/suroserver

2. suro server 실행 3. hdfs web ui 로 디스크 생성된것 확인 4. 클라이언트 실행 5. 카프카 토픽 목록

1. ~/download/kafka_2.8.0-0.8.0/bin/kafak-list-topic.sh —zookeeper localhost:2181 6. 카프카 콘솔 컨슈머

1. ~/download/kafka_2.8.0-0.8.0/bin/kafka-console-consumer.sh —zookeeper localhost:2181 —topic kafkaTest from-beginning 7. /sinkstat 확인 8. 동적 설정 확인

1.

Page 16: Netflix suro begins

Reference• https://github.com/Netflix/suro����������� ������������������  

• https://github.com/Netflix/suro/wiki����������� ������������������  

• https://groups.google.com/forum/#!forum/suro-users����������� ������������������  

• http://techblog.netflix.com/2013/12/announcing-suro-backbone-of-netflixs.html����������� ������������������  

• https://github.com/Netflix/archaius/wiki����������� ������������������  

• https://github.com/Netflix/eureka/wiki