2013 년 계획

2012년 한 해가 또 이렇게 저물어 가는구나. 다행히 년초 계획[1]은 대부분 이루었고 오히려 기대보다 넘어선 것들이 많다.

2013년은 이제 그 동안 야심차게 갈아온 칼을 꺼내는 해가 되지 않을까 싶다. 몇 가지 좀 정리해보면,

  • 소득 안정화, 재테크 자산 5배 키우기
  • 하마 웹 북 완료
  • 끝내주는 하마 실제 사례

일단 요정도만 ..

음 왠지 좀 재미는 없는 것 같다. 어느덧 30대 중반. 뭐든 한참 시작할때가 재밌다. 오픈소스도 인생도 .. 내년엔 경험해보지 못한 또 다른 시작이 있기를.

1. http://blog.udanax.org/2011/10/2011-2012.html


The 4th OSS Conference of the Ministry of Knowledge Economy

This week, I was invited as a special lecturer and panel speaker at the 4th OSS Conference of the Ministry of Knowledge Economy (Korea). It was fun and here's a few pictures.


Trustin Lee (Netty), Minsuk Lee (Assistant Dean of NHN Next), Edward J. Yoon (Apache Hama)


Edward J. Yoon (윤진석 @ 공개소프트웨어데이)

Flume NG Performance

According to Flume wiki[1], it has capable of achieving approx. 70,000 events/sec on a single machine (high-end level) at the time of the test with no data loss (300 bytes per event). If you can't imagine how big 70,000 events/sec is, see this "Tweets per second"[2].

1. https://cwiki.apache.org/FLUME/flume-ng-performance-measurements.html
2. http://yearinreview.twitter.com/en/tps.html

Bioinformatics, Big Data, and MapReduce

Today suddenly someone asked me about Bioinformatics, Big Data, and MapReduce, I said "you should be more concerned about data complexity than size. And also, studying GraphLab or Hama will be helpful" ... :/

Memorise these, and you could pass yourself off as an expert.

리치스탄

미국의 슈퍼리치 전문기자 로버트 프랭크가 쓴 '리치스탄'이란 책에 이런 일화가 나온다. 엄청난 부자가 반바지에 슬리퍼 차림으로 아들과 산책을 나갔다 문득 자동차가 사고 싶어 고급차 매장에 들어갔다. 하지만 자동차 판매원은 허름한 옷차림의 이 부자를 쫓아버린다. 자신이 파는 고급차를 살만한 사람으로 보이지 않았던 거다.

이 슈퍼리치는 자동차 매장을 나오면서 아들에게 "양복은 부자들에게 고용된 사람들이나 입는 것"이란 취지의 말을 한다. 고용된 직장인들은 출근할 때 회사에서 원하는 대로 옷을 입어야 하고 남들에게 잘 보이기 위해 옷차림에 신경 써야 하는거다.

슈퍼리치들이 옷이나 보석같은 분야에 돈을 쓰지않고 여행이나 자녀교육비에 지출하는 점을 프랭크는 부자들이 "물질 사치적"이라기보다 "경험 사치적"인 소비성향을 보이고 있다고 해석했다.

경험하고 공부하는데 돈을 써라.

Running Hama Over InfiniBand

Create an SDP configuration file

Each BSP peer (task) will have its own port number for communicating with others. For example, if you set set bsp.peer.port to 61000 and set bsp.tasks.maximum to 5, BSP peers will use the port range from 61000 to 61005.

To enable SDP[1] support for BSP peers, create a configuration file like the following sample:
[edward@192.168.10.1 ~]# cat {$HAMA_HOME}/conf/sdp.conf
# Use SDP when binding to
bind 192.168.10.1 61000-61010

# Use SDP when connecting to
connect 192.168.10.0/24 61000-61010
NOTE: This configuration file must reside on every node.

Set the system property that specifies the location of the configuration file

And then, set the location of the configuration file by adding -Dcom.sun.sdp.conf to the bsp.child.java.opts property as following:
  <property>
    <name>bsp.child.java.opts</name>
    <value>-Dcom.sun.sdp.conf={$HAMA_HOME}/conf/sdp.conf -Xmx1024m</value>
  </property>
If everything is OK, you will see the following logs.
CONNECT to 192.168.10.2:61005 (socket converted to SDP protocol)
CONNECT to 192.168.10.5:61002 (socket converted to SDP protocol)
CONNECT to 192.168.10.4:61003 (socket converted to SDP protocol)
CONNECT to 192.168.10.1:61006 (socket converted to SDP protocol)
...
1. http://en.wikipedia.org/wiki/Sockets_Direct_Protocol

OSS App Hackathon @ National Information Society Agency

Yesterday, there was a OSS App Hackathon arranged by the NIA (National Information Society Agency) in Seoul. I attended as a panel of judges w/ Prof. Lee of the Next, NHN University. A lot of people were in there.


You can read more details (Korean news) here:
 - http://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=105&oid=138&aid=0001997038

Fault-tolerance in Hama

Recently, Hama core committers Suraj Menon and Thomas Jungblut are working on Fault-tolerant BSP system. And I am trying to read the source code. Their design describes the new BSP computing system and API enabling checkpoint-based recovery. Furthermore, describes the confined recovery, which can be used to improve the cost and latency of recovery.

I didn't fully understand and test yet but quite nice!

PageRank with Apache Hama

The dataset contains 5,716,808 pages and 130,160,392 links and is unzipped ~1gb large.
[oracle@bda03 hama-0.6.0-SNAPSHOT]$ hadoop dfs -ls edward
Found 1 items
-rw-r--r--   3 oracle hadoop 1058414409 2012-08-28 22:16 /user/oracle/edward/links-simple-sorted.txt

[oracle@bda03 hama-0.6.0-SNAPSHOT]$ bin/hama jar hama-examples-0.6.0-SNAPSHOT.jar pagerank /user/oracle/edward/links-simple-sorted.txt out
12/09/10 18:44:25 INFO bsp.FileInputFormat: Total input paths to process : 1
12/09/10 18:44:25 INFO net.NetworkTopology: Adding a new node: /switch1/192.168.10.3:50010
12/09/10 18:44:25 INFO net.NetworkTopology: Adding a new node: /switch1/192.168.10.5:50010
12/09/10 18:44:25 INFO net.NetworkTopology: Adding a new node: /switch1/192.168.10.16:50010
12/09/10 18:44:25 INFO net.NetworkTopology: Adding a new node: /switch1/192.168.10.14:50010
12/09/10 18:44:25 INFO net.NetworkTopology: Adding a new node: /switch1/192.168.10.15:50010
12/09/10 18:44:25 INFO net.NetworkTopology: Adding a new node: /switch1/192.168.10.8:50010
12/09/10 18:44:25 INFO net.NetworkTopology: Adding a new node: /switch1/192.168.10.11:50010
12/09/10 18:44:25 INFO bsp.FileInputFormat: Total # of splits: 17
12/09/10 18:44:25 INFO bsp.BSPJobClient: Running job: job_201209101841_0002
12/09/10 18:44:28 INFO bsp.BSPJobClient: Current supersteps number: 2
12/09/10 18:44:31 INFO bsp.BSPJobClient: Current supersteps number: 8
12/09/10 18:44:34 INFO bsp.BSPJobClient: Current supersteps number: 16
12/09/10 18:44:37 INFO bsp.BSPJobClient: The total number of supersteps: 16
12/09/10 18:44:37 INFO bsp.BSPJobClient: Counters: 10
12/09/10 18:44:37 INFO bsp.BSPJobClient:   org.apache.hama.bsp.JobInProgress$JobCounter
12/09/10 18:44:37 INFO bsp.BSPJobClient:     LAUNCHED_TASKS=17
12/09/10 18:44:37 INFO bsp.BSPJobClient:   org.apache.hama.bsp.BSPPeerImpl$PeerCounter
12/09/10 18:44:37 INFO bsp.BSPJobClient:     SUPERSTEPS=16
12/09/10 18:44:37 INFO bsp.BSPJobClient:     SUPERSTEP_SUM=272
12/09/10 18:44:37 INFO bsp.BSPJobClient:     COMPRESSED_BYTES_SENT=802984424
12/09/10 18:44:37 INFO bsp.BSPJobClient:     TIME_IN_SYNC_MS=13996
12/09/10 18:44:37 INFO bsp.BSPJobClient:     IO_BYTES_READ=1058414409
12/09/10 18:44:37 INFO bsp.BSPJobClient:     COMPRESSED_BYTES_RECEIVED=802984424
12/09/10 18:44:37 INFO bsp.BSPJobClient:     TOTAL_MESSAGES_SENT=11412446
12/09/10 18:44:37 INFO bsp.BSPJobClient:     TASK_INPUT_RECORDS=5706070
12/09/10 18:44:37 INFO bsp.BSPJobClient:     TOTAL_MESSAGES_RECEIVED=5706223
Job Finished in 12.322 seconds

Semi-clustering with Apache Hama

How do you analyze the social networks? Sentiment analysis or Text mining? I think the valuable insight can be found by analyzing the evolution of network structures or, information flows. Network science is needed.

In this post, I'm introducing the powerful graph computing package of Apache Hama and semi-clustering algorithm described Google's Pregel paper[1]. A semi-cluster in a social graph is a group of people who interact frequently with each other and less frequently with others. It is different from ordinary clustering in the sense that a vertex may belong to more than one semi-cluster.

The algorithm is a greedy algorithm. Since Apache Hama provides complete clone of Pregel, you can write a semi-clustering program and run it on large graphs in a few minutes like this:
    @Override
    public void compute(Iterator<SCMessage> messages) throws IOException {
      if (this.getSuperstepCount() == 0) {
        // In superstep 0, V enters itself in that list as a semi-cluster of
        // size 1 and score 1, and publishes itself to all of its neighbors.
      }

      // In subsequent supersteps, V circulates over the received semi-clusters
      SCMessage clusters = null;
      while ((clusters = messages.next()) != null) {
        for (SemiCluster c : clusters.getClusters()) {
          // If a semi-cluster c does not already contain V, V is added to c to
          // form c’.
        }
      }

      // The semi-clusters are sorted by their scores and the
      // best ones are sent to V’s neighbors.

      // Vertex V updates its list of semi-clusters with the
      // semi-clusters that contain V.

      boolean updated = updateLocalClusters(clusters);
      if (!updated) {
        // The algorithm terminates either when the semi-
        // clusters stop changing or the user may provide a
        // limit.

        // At that point, the list of best semi-cluster
        // candidates for each vertex may be aggregated
        // into a global list of best semi-clusters.
        
        voteToHalt();

      } else {
        // The semi-clusters are sorted by their scores and the best ones are
        // sent to V’s neighbors.
      }
    }

What do you think - easy enough to use? :-)

P.S., the implementation issue is still left open[2]. If you want to contribute your code or just want to share something with us, Please feel free to contact Hama team.

1. Pregel: a system for large-scale graph processing
2. Implementation of a Semi-Clustering algorithm, described in Pregel paper.

MapReduce and Beyond

Hi, in this post I'm going to tell you about past and near future of big data processing. In 2006, I worked as a Senior Software Engineer for web portal company, NHN, corporation. Since then, I had experienced a data explosion (the average pageview per day was one billion), and began to research distributed computing technologies.

In my early research, batch-oriented MapReduce[1] was one of interesting technology. As all of you know well now, MapReduce programming is very simple and powerful, especially, useful for the aggregation and several basic relational algebraic operations on large data-sets.

However, MapReduce is NOT good for everything. For example, graph algorithms[2], machine learning, and matrix arithmetic. SQL-like Pig, Hive, and MR-based Mahout shows well the scope and limit of MapReduce. Iterative MapReduce also has some problems such as heavy cost for task assignment and I/O overhead. A lack of ability to perform as a real-time was also issue.

Today, many MapReduce alternatives are now available to solve efficiently such problems:
  • Apache Hama[3] - BSP (Bulk Synchronous Parallel) computing engine on top of Hadoop
  • Apache Giraph - BSP (Bulk Synchronous Parallel) based graph computing framework
  • Apache S4 and Twitter Storm - Scalable real-time processing system
Wow! too many to learn, but please don't worry. Hadoop 2.0, YARN[4] will manages these new alternatives at once. 

1. MapReduce: Simplified Data Processing on Large Clusters
2. Pregel: a system for large-scale graph processing
3. Apache Hama: Bulk Synchronous Parallel Computing Framework
4. Interview with Arun Murthy on Apache YARN

Some Benchmarks of Hadoop and Hama on Oracle's BDA

The I/O performance of HDFS with TestDFSIO.
% hadoop jar hadoop-test-0.20.2-cdh3u3b.jar TestDFSIO -write -nrFiles 10 -fileSize 1000

----- TestDFSIO ----- : write
           Date & time: Thu Jul 26 18:50:11 PDT 2012
       Number of files: 10
Total MBytes processed: 10000.0
     Throughput mb/sec: 163.4360801490537
Average IO rate mb/sec: 167.77435302734375
 IO rate std deviation: 25.658150459575825
    Test exec time sec: 19.329

hadoop jar hadoop-test-0.20.2-cdh3u3b.jar TestDFSIO -read -nrFiles 10 -fileSize 1000

----- TestDFSIO ----- : read
           Date & time: Thu Jul 26 19:22:14 PDT 2012
       Number of files: 10
Total MBytes processed: 10000.0
     Throughput mb/sec: 374.6721618583739
Average IO rate mb/sec: 375.14581298828125
 IO rate std deviation: 13.625353109608241
    Test exec time sec: 17.311
The communication performance of Apache Hama with Bench tool.
% hama jar hama-examples-0.5.0.jar bench 16 100000 32
...

12/07/26 21:12:16 INFO bsp.BSPJobClient: Current supersteps number: 30
12/07/26 21:12:19 INFO bsp.BSPJobClient: Current supersteps number: 31
12/07/26 21:12:22 INFO bsp.BSPJobClient: Current supersteps number: 32
12/07/26 21:12:25 INFO bsp.BSPJobClient: The total number of supersteps: 32
12/07/26 21:12:25 INFO bsp.BSPJobClient: Counters: 8
12/07/26 21:12:25 INFO bsp.BSPJobClient:   org.apache.hama.bsp.JobInProgress$JobCounter
12/07/26 21:12:25 INFO bsp.BSPJobClient:     LAUNCHED_TASKS=162
12/07/26 21:12:25 INFO bsp.BSPJobClient:   org.apache.hama.bsp.BSPPeerImpl$PeerCounter
12/07/26 21:12:25 INFO bsp.BSPJobClient:     SUPERSTEPS=32
12/07/26 21:12:25 INFO bsp.BSPJobClient:     SUPERSTEP_SUM=5184
12/07/26 21:12:25 INFO bsp.BSPJobClient:     MESSAGE_BYTES_TRANSFERED=10404951552
12/07/26 21:12:25 INFO bsp.BSPJobClient:     TIME_IN_SYNC_MS=10300386
12/07/26 21:12:25 INFO bsp.BSPJobClient:     TOTAL_MESSAGES_SENT=1036800000
12/07/26 21:12:25 INFO bsp.BSPJobClient:     TOTAL_MESSAGES_RECEIVED=518400000
12/07/26 21:12:25 INFO bsp.BSPJobClient:     MESSAGE_BYTES_RECEIVED=10404951552
Job Finished in 93.33 seconds

Running Hama on Oracle's Big Data appliance

This post describes how to setup a Hama cluster on Oracle's Big Data appliance. Apache Hama is a "Bulk Synchronous Parallel" computing framework on top of Hadoop's HDFS.


Basically, Cloudera Manager is installed on Oracle Big Data Appliance to help you with Cloudera's Distribution including Apache Hadoop (CDH) operations. Once finished Hadoop installation, you can check the version of Hadoop as below:  
[root@bda01 ~]# hadoop version
Hadoop 0.20.2-cdh3u3b
Subversion file:///data/1/tmp/topdir/BUILD/hadoop-0.20.2-cdh3u3b -r 0560e235f226fcd7a0b8a011d4a1b78afad032e0
Compiled by root on Fri Mar 16 07:36:05 PDT 2012
From source with checksum 9257f5bf2f59f5a294e9b69f3f59283b
Now let's download latest Hama 0.5.0. You can download at here.
[root@bda01 ~]# wget https://dist.apache.org/repos/dist/release/hama/0.5.0/hama-0.5.0.tar.gz
[root@bda01 ~]# tar xvfz hama-0.5.0.tar.gz
[root@bda01 ~]# cd hama-0.5.0
Hama 0.5 version is shipped with Hadoop 1.0. So, you have to replace Hadoop and Guava jar files in lib folder.
[root@bda01 hama-0.5.0]# rm -rf ./lib/hadoop-*.jar
[root@bda01 hama-0.5.0]# cp /usr/lib/hadoop/hadoop-core-0.20.2-cdh3u3b.jar ./lib
[root@bda01 hama-0.5.0]# cp /usr/lib/hadoop/hadoop-test-0.20.2-cdh3u3b.jar ./lib
[root@bda01 hama-0.5.0]# cp /usr/lib/hadoop/lib/guava-r09-jarjar.jar ./lib
And then configure your cluster according to the "Distributed Mode" scenario described in Getting Started with Hama.
[root@bda01 hama-0.5.0]# bin/start-bspd.sh
...

[root@bda01 hama-0.5.0]# bin/hama jar hama-examples-0.5.0.jar bench 16 10000 32
12/07/05 18:34:20 INFO bsp.BSPJobClient: Running job: job_201207051757_0004
12/07/05 18:34:23 INFO bsp.BSPJobClient: Current supersteps number: 0
12/07/05 18:34:29 INFO bsp.BSPJobClient: Current supersteps number: 6
12/07/05 18:34:32 INFO bsp.BSPJobClient: Current supersteps number: 22
12/07/05 18:34:35 INFO bsp.BSPJobClient: Current supersteps number: 31
12/07/05 18:34:38 INFO bsp.BSPJobClient: Current supersteps number: 32
12/07/05 18:34:38 INFO bsp.BSPJobClient: The total number of supersteps: 32
12/07/05 18:34:38 DEBUG bsp.Counters: Adding SUPERSTEPS
12/07/05 18:34:38 INFO bsp.BSPJobClient: Counters: 8
12/07/05 18:34:38 INFO bsp.BSPJobClient:   org.apache.hama.bsp.JobInProgress$JobCounter
12/07/05 18:34:38 INFO bsp.BSPJobClient:     LAUNCHED_TASKS=90
12/07/05 18:34:38 INFO bsp.BSPJobClient:   org.apache.hama.bsp.BSPPeerImpl$PeerCounter
12/07/05 18:34:38 INFO bsp.BSPJobClient:     SUPERSTEPS=32
12/07/05 18:34:38 INFO bsp.BSPJobClient:     SUPERSTEP_SUM=2880
12/07/05 18:34:38 INFO bsp.BSPJobClient:     MESSAGE_BYTES_TRANSFERED=587404800
12/07/05 18:34:38 INFO bsp.BSPJobClient:     TIME_IN_SYNC_MS=906604
12/07/05 18:34:38 INFO bsp.BSPJobClient:     TOTAL_MESSAGES_SENT=57600000
12/07/05 18:34:38 INFO bsp.BSPJobClient:     TOTAL_MESSAGES_RECEIVED=28800000
12/07/05 18:34:38 INFO bsp.BSPJobClient:     MESSAGE_BYTES_RECEIVED=587404800
Job Finished in 18.27 seconds

Like children who playing on the seashore.

The adults digs the sand for clams, the children builds sand castles. 
Pure sentiment. Sometimes I want to live like children who playing on the seashore.

Hadoop 1.0 뽀개기 (2) : MapReduce

작성자: 윤진석 (Edward J. Yoon)

맵리듀스MapReduce는 HDFS에 분산 저장된 데이터에 스트리밍 접근을 요청하며 빠르게 분산 처리하도록 고안된 프로그래밍 모델이며, 또한 이를 지원하는 시스템을 말한다.

시스템 내부 구조는 작업Job 및 모니터링을 관리하는 잡 트래커JobTracker와 실질적인 연산 업무를 처리하는 태스크 트래커TaskTracker로 구성된다. 잡트래커는 HDFS에 의해 분할 된 각 데이터 조각의 지역 특성을 고려하여 각 태스크 트래커에 적절한 업무를 할당하는 방법으로 효과적인 분산 처리가 가능하도록 한다.

프로그래밍 모델

맵리듀스란 이름은 애초 Lisp와 같은 함수형 언어의 맵map과 리듀스Reduce 함수 모델을 차용하면서 유래되었다. 데이터의 집합에 맵 함수를 적용하여 새로운 집합intermediate data을 만들고 다시 리듀스 함수를 적용해서 하나의 결과로 취합하는 과정으로 구성된다.

일반적인 함수형 언어와의 차이점은 키밸류 데이터 집합을 또다른 키밸류 데이터 집합으로 제한된다는 점이다. 예를 들어, 다음과 같이 Map에서 한 쌍의 키밸류 데이터를 입력받아 새로운 (K2, V2) 셋을 만들고, Reduce에서 K2로 그룹핑grouping된 V2 리스트를 집계 연산한다.

      Map (K1, V1) -> (K2, V2)
      Reduce (K2, sequence of V2) -> (K3, V3)

보통 Map의 역할이 데이터를 가공해서 분류하는데 있으므로 연산가공자Filter라 하고, Reduce의 역할은 분류된 데이터를 통합하는 데 있으므로 집계 연산자Aggregator라고도 한다. 하둡의 맵리듀스 프로그램은 이와 같이 두 함수의 구현을 통해 데이터 처리를 쉽게 병렬화 할 수 있고 범용적으로 활용 가능하다. 예를 들어, 웹 문서 URL과 내부 URL 링크셋 데이터가 있고, 자신을 링크하는 역 링크 URL 셋을 얻고자 한다. 그러면 Map에서 단지 거꾸로 데이터 셋을 가공하는 것으로 복잡한 데이터 처리 없이 쉽게 역 링크 정보를 얻을 수 있는 것이다.

하둡 분산 시스템에서의 프로그램 처리 흐름은 그림 1 과 같다. 잡 트래커로부터 청크 단위의 조각 파일을 할당 받은 태스크 트래커가 각 Map 함수 프로세서를 실행하여 데이터에 스트림 접근으로 Map 연산가공 과정을 수행하고 중간 데이터 셋을 생성하면, Reduce 함수 프로세서가 최종적으로 결과를 집계 연산한다.


그림 3. 맵리듀스의 처리 흐름

작업 스케쥴러Job Scheduler

시스템으로 전송되는 맵리듀스 작업Job은 순차적으로 처리하는 방식 및 우선순위, 효율적인 자원 공유를 지원하는 다양한 스케쥴러Scheduler를 제공한다. 하둡 1.0에서 제공되는 스케쥴러는 다음과 같다.

  • FIFO 스케쥴러, 작업 대기큐에 입력된 순서대로 처리하는 하둡이 기본으로 제공하는 스케쥴러이다. Fair 스케쥴러, 페이스북에서 개발한 스케쥴러로써 우수한 클러스터 자원resource 관리 기능을 제공한다. 작업을 풀 또는 유저로 그룹핑하고 각 풀 또는 유저에 최소 자원을 할당하여 균등한 자원 분배를 보장하고, 선점 기능을 통해 자원의 밸런스를 유지하여 각 작업의 성능을 보장한다. 
  • Capacity 스케쥴러, 야후에서 개발된 Fair 스케쥴러 이전의 자원 분배 스케쥴러로써 작업 대기큐에 사용될 태스크 프로세서 슬롯 갯수를 조절하여 자원을 분배한다. Fair 스케쥴러와는 달리 선점 기능이 없다.

기본 FIFO 스케쥴러 외 다른 스케쥴러를 설정하는 방법은 conf 디렉토리 밑의 mapred-site.xml 설정파일에 설정한다. 예를 들어, Fair 스케쥴러는 mapred-site.xml 파일에 다음과 같이 값을 설정하는 것으로 완료된다.

  <property>
    <name>mapred.jobtracker.taskScheduler</name>
    <value>org.apache.hadoop.mapred.FairScheduler</value>
  </property>

그리고, fair-scheduler.xml 설정파일에 다음과 같이 각 사용자 또는 풀의 최소 자원을 할당할 수 있다.

  <?xml version="1.0"?> 
  <allocations> 
    <pool name="sample_pool"> 
      <minMaps>5</minMaps>
      <minReduces>5</minReduces>
      <weight>2.0</weight>
    </pool>
    <user name="sample_user">
      <maxRunningJobs>6</maxRunningJobs>
    </user>
    <userMaxJobsDefault>3</userMaxJobsDefault>
  </allocations>

그러면 우리는 어떤 스케쥴러를 사용해야할까?

일반적으로 실제 서비스에 맞물려 구성된 배치작업은 그 작업에 헌신적으로 몰두하는dedicated 장비 구성과 기본으로 제공되는 FIFO 스케쥴러를 사용하는것이 바람직하고, 다수 개발자들의 연구 개발에 사용되는 공용 클러스터는 균등한 자원분배를 제공하는 Fair 스케쥴러를 사용한다.

Hadoop 1.0 뽀개기

작성자: 윤진석 (Edward J. Yoon)

이번 포스트는 하둡 1.0의 핵심 구성 요소 HDFS와 맵리듀스MapReduce, 그리고 대용량 준정형 데이터semi-structured data 저장소 HBase 데이터 모델의 기본 개념을 소개하겠다.

  • 하둡 1.0 은 대용랑 파일을 저장할 수 있는 분산 파일시스템 HDFS와 이를 분산 처리 할 수 있는 맵리듀스 컴퓨팅 프레임워크로 구성되어 있다.
  • 맵리듀스 프로그래밍 모델은 복잡한 분산 컴퓨팅을 키/밸류 기반으로 단순화된 모델을 제공한다.
  • HBase는 하둡 분산 파일시스템 기반에서 대용량 비정형 데이터 관리를 할 수 있게 하는 분산 스토리지이다.
  • 칼럼 패밀리와 시계열이 추가된 다차원 테이블 모델을 갖고 있으며, HBase의 칼럼 지향 아키텍처는 빠른 랜덤 억세스와 저장의 효율성을 보장한다.
  • 위 언급된 모든 시스템은 웹 기반 관리 도구와 장애 허용 능력Fault Tolerance Capability을 갖추고 있다.

1. 하둡 분산 파일 시스템, HDFS

HDFS란?

하둡의 분산 파일 시스템, HDFSHadoop Distributed File System는 모든 기능의 밑 바탕이 되는 클러스터 기반 가상 파일 시스템이다. HDFS의 디자인은 대용량 데이터를 저가의 서버에 분산 저장하고 여러 번 읽기에 최적화된write-once-read-many 단순한 목적과 자동 복구 기능에 집중하고 있다. 이에 가장 두드러지는 특징이 바로 무한대의 선형 확장성이다. 파일과 디렉토리의 개수는 네임 노드의 메모리 크기에 제한을 받지만 최대 볼륨 크기, 파일 크기에는 제한이 없다. 그리고, 데이터를 여러 서버에 복제하여 각 서버에 고가의 RAID 구성을 필요로 하지 않고도 장애 복구Fail-over 가 가능하도록 하였다.

내부적으로 정확한 세부 사항은 상당히 다르지만 일반적인 파일 시스템의 자료구조와 상당히 유사한 구조를 지닌다. 즉 인덱스 노드와 데이터 블록이 중심 개념이며 전통적인 계층 구조의 파일시스템을 제공한다. 하둡 HDFS는 분산 환경에 매스터/슬레이브Master/Slave 구조로 파일과 디렉터리의 읽기open, 닫기close, 이름 변경rename 및 복제replication 등 파일 시스템의 네임스페이스 기능을 수행하는 네임 노드NameNode와 데이터 블록 파일을 저장하고 클라이언트가 요구하는 읽기read, 쓰기write 기능들을 담당하는 데이터 노드DataNode로 구성된다.

데이터 복제

HDFS 내 하나의 파일은 청크Chunk 단위의 작은 블록 파일들로 나뉘어 데이터 노드에 분산 저장된다. 블록 사이즈와 복제 인수는 사용자가 파일마다 설정할 수 있다. 복제를 배치하는 정책은 파일 시스템의 신뢰성, 가용성 그리고 네트워크 대역폭을 효율적으로 사용할 수 있도록 랙 인식 기능을 사용한다.

HDFS의 기본적인 복제 정책은 랙 사이의 쓰기 트래픽을 최소화하면서 신뢰성을 유지하기 위해 로컬이 포함된 랙의 데이터노드에 2개를 복제하고 다른 랙의 데이터 노드에 1개를 복제한다. 이러한 데이터 블록 복제는 디스크와 서버 장애 발생 시 파일이 안전하게 유지되고 자동으로 복구Fail-over 할 수 있도록 이용되며, 또한 데이터의 지역 특성Data locality을 고려한 효율적인 분산 컴퓨팅 구조에도 활용된다.

그림 2. 데이터 노드의 블록 배치 정책

상황에 따라 데이터의 복제를 기본 3개 씩 두는 것이 부담이 될 수 있지만 데이터의 중요성을 고려하여 복제의 수를 조절할 수 있다. 5 장 하둡 2.0 에서는 페이스북의 HDFS RAID 모듈과 패리티 블록Parity block을 통한 복제 갯수 및 클러스터 용량의 최소화 방안이 소개된다.

HDFS 파일 시스템 내 손상된 파일이 있는지 보려면 fsck 명령어를 사용하여 확인할 수 있다. 그러나 데이터 노드가 최초에 블록을 복제하는 동안 장애가 발생했다거나 복제된 모든 블록 파일이 손상된 특수한 상황이 아니라면 시스템에 의해 자동 복구 되기 때문에 일반적으로 특별한 관리는 필요 없다.

복구Fail-Over

HDFS에서 자동 복구가 되지 않는 부분은 파일 시스템 이미지FsImage와 변경로그EditLog를 관리하는 네임 노드의 파일 장애 문제이다. 가장 이상적인 접근 방법은 fs.checkpoint.dir 설정 값을 다른 서버의 로컬 파일 시스템 또는 네트워크 결합 스토리지Network-attached Storage로 설정하여 체크포인팅Checkpointing하는 방법으로 최악의 경우를 고려하고, 이와 더불어 dfs.name.dir 경로에 현재의 이미지와 변경로그를 저장하여 세컨드리 네임 노드Secondary NameNode 를 통해 파일 시스템 정보를 주기적으로 동기화 하는 것으로 다음과 같이 네임 노드의 장애를 대응하는 것이다.

  • 단순히 네임 노드가 죽고 dfs.name.dir 의 파일들이 손상되지 않은 경우엔 네임 노드를 재시작 하는 것으로 간단히 복구 된다.
  • 파일 시스템 이미지가 손상되었거나 네임 노드 서버가 물리적인 장애로 복구가 불가능한 경우에는 새로운 서버에 네임 노드를 설치하여 -importCheckpoint 옵션과 함께 재시작하는 것으로 복구 할 수 있다. 이 때, dfs.name.dir 은 반드시 비어있는 경로로 다시 정해주어야 한다.

네임 노드가 재시작 되면 안전 모드로 사용 가능한 데이터 노드로 부터 블록리포트Blockreport를 받아 데이터 블록의 메타 데이터와 복제 수를 확인하고 복제를 관리한 후 일반 모드로 빠져나간다.

접근성

HDFS에는 다양한 방법으로 응용 프로그램이 접근할 수 있게 한다. 하둡 1.0에서는 자바 및 C언어를 위한 API와 Web기반 브라우저 기능이 있으며, 또한 관리자나 스크립팅 언어에 활용될 수 있는 DFS 쉘 인터페이스를 제공한다. 이 책에서는 쉘 인터페이스를 살펴보기로 한다 (HDFS API는 하둡 공식 문서 참조).
  cat
           파일의 내용을 stdout으로 출력한다.
  chgrp
           파일의 그룹을 변경한다.
  chmod
           파일의 권한을 변경한다.
  chown
           파일의 오너를 변경한다.
  copyFromLocal
           로컬 파일 시스템에 파일을 HDFS로 복사한다.
           소스 파일이 로컬 파일로 제한되는 점을  제외하면 put 명령어와 유사하다.
  copyToLocal
           HDFS에 파일을 로컬 파일 시스템으로 복사한다.
           대상이 로컬 파일 시스템으로 제한되는점을 제외하면 get 명령어와 유사하다.
  count
           지정된 패턴과 일치하는 경로의 디렉토리, 파일 및 바이트의 수를 카운트한다.
  cp
           파일을 복사한다. 이 명령어는 여러 파일을 한꺼번에 복사 할 수 있다.
  du
           디렉토리 내 파일 크기 길이의 합, 또는 파일의 길이를 출력한다.
  dus
           파일 길이의 요약을 표시한다.
  expunge
           휴지통을 비운다. (휴지통 기능에 대한 자세한 내용은 4장 HDFS 아키텍처를 참조).
  get
           파일을 로컬 파일 시스템에 복사한다. CRC 검사에 실패하는 파일은 
           -ignorecrc 옵션으로 복사할 수 있다. 파일 및 CRC 파일은 -CRC 옵션을 사용하여 
           복사할 수 있다.
  getmerge
           소스 디렉터리 내 파일을 대상 파일로 병합한다. addnl 옵션은 각 파일의 끝에 
           개행 문자를 추가할 수 있도록 설정할 수 있다.
  ls
           파일인 경우에는 퍼미션, 복제된 수, 유저아이디, 그룹아이디, 파일 사이즈와 변경된 
           날짜 및 파일 이름을 보여준다. 디렉토리는  퍼미션, 유저아이디, 그룹아이디, 변경된 
           날짜 및 디렉토리 이름과 디렉토리 내 파일 또는 하위디렉토리 목록을 보여준다.
  lsr
           디렉토리 하위의 모든 파일과 디렉토리에 목록을 재귀적으로 보여준다. 
           유닉스의 ls -R 명령과 유사하다.
  mkdir
           경로 uri를 인자값으로 받아 디렉토리를 생성한다. 
           유닉스의 mkdir -p 명령어로 상위 디렉토리까지 모두 만드는 것과 같이 작동한다.
  moveFromLocal
           복제된 이후 localsrc가 삭제되는것을 제외하고 put 명령어와 유사하다.
  moveToLocal
           하둡 1.0 버전에서는 구현되어있지 않다.
  mv
           소스에서 대상지로 파일을 이동한다. 이 명령은 대상지가 디렉토리인 경우 다수의 
           소스를 입력하는 것이 허용된다. 다른 파일 시스템과의 파일 이동은 허용되지 않는다.
  put
           로컬 파일 시스템의 단일 또는 다수의 소스를 대상 파일 시스템에 복사한다. 
           또한 STDIN의 입력을 읽어 대상 파일 시스템에 기록하는 것이 가능하다.
  rm
           인자로 지정된 파일을 삭제한다. 오직 비어있지 않은 디렉토리와 파일을 삭제한다. 
           휴지통 기능이 활성화된 경우 -skipTrash 옵션을 사용하면 무시되어 지정된 파일을 
           즉시 삭제한다. 이것은 디렉토리에 불필요하게 큰 파일을 삭제하는 데 필요한 때 유용하다. 
           재귀적인 삭제는 rmr을 참조.
  rmr
           재귀적으로 delete 명령어를 수행한다. -skipTrash 옵션은 rm 명령어와 동일하게 작동한다.
  setrep
           파일의 복제 개수를 변경한다. -R 옵션은 재귀적으로 디렉토리 내 파일들의 복제 개수를 
           증가하는데 사용된다.
  stat
           경로의 상태 정보를 보여준다.
  tail
           STDOUT으로 파일의 마지막 킬로 바이트를 보여준다. 유닉스와 같이 -f 옵션을 
           사용할 수 있다.
  test
           경로를 받아 -[ezd] 옵션으로 파일이 존재하는지, 파일 크기가 0인지, 
           그리고 디렉토리인지를 확인한다.
  text
           파일을 가져와서 텍스트 형식으로 파일을 출력한다. 허용되는 형식은 
           zip TextRecordInputStream 이다.
  touchz
           크기가 0 바이트인 파일을 생성한다.

이제 로컬 파일 시스템의 파일을 copyFromLocal 명령어로 하둡 분산 시스템에 다음과 같이 복사해보자.

 % bin/hadoop dfs -copyFromLocal /tmp/my.txt /tmp
 % bin/hadoop dfs -ls /tmp
 Found 1 items
 drwxr-xr-x   - edward supergroup        36134204   2012-03-08 19:38 /tmp/my.txt


HDFS로 복사된 데이터는 ls 명령어 또는, 앞서 소개된 fsck 명령어를 통해 다음과 같이 보다 상세한 파일의 상태 및 블록 정보 및 실제 블록 파일 위치 등을 확인 해볼 수 있다.

% bin/hadoop fsck /tmp/my.txt -files -locations -blocks
FSCK started by edward from /192.168.123.198 for path /tmp/my.txt at Mon Mar 26 10:35:35 KST 2012
/tmp/my.txt 36134204 bytes, 1 block(s):  Under replicated blk_-3900174264464062459_1046. Target Replicas is 3 but found 1 replica(s).
0. blk_-3900174264464062459_1046 len=36134204 repl=1 [192.168.123.198:50010]
Status: HEALTHY
 Total size:    36134204 B
 Total dirs:    0
 Total files:   1
 Total blocks (validated):      1 (avg. block size 36134204 B)
 Minimally replicated blocks:   1 (100.0 %)
 Over-replicated blocks:        0 (0.0 %)
 Under-replicated blocks:       1 (100.0 %)
 Mis-replicated blocks:         0 (0.0 %)
 Default replication factor:    3
 Average block replication:     1.0
 Corrupt blocks:                0
 Missing replicas:              2 (200.0 %)
 Number of data-nodes:          1
 Number of racks:               1
FSCK ended at Mon Mar 26 10:35:35 KST 2012 in 1 milliseconds

The filesystem under path '/tmp/my.txt' is HEALTHY

IT crowd

"If you're stuck on programming something, Call BBQ (chicken) store manager for technical details."

This is a joke between korean developers. Who should make the best use of their TALENT and taking full advantage of it?


급발진은 불가능하다.

요즘 급발진 뉴스가 많던데 .. 이거 정말 가능할까? 왜 모든 급발진 사고는 브레이크를 밟는 타이밍에 발생하는건가?

스로틀이 와이어식인건 기계 결함없는 급발진이 아예 불가능하고, 그래 전자식인 경우는 소프트웨어 버그로 RPM 급상승이 가능은 해보인다. 근데 그와 동시에 브레이크가 동작 안 한다는건 상식적으로 이해가 안가는 부분. ECU라는게 컴퓨터 PC처럼 모든 기능을 중앙관리하는게 아니고 윈도우 미러나 브레이크 등 모두 분할된 독립 모듈로 구성되있다. 각종 전가기기의 전자파 영향 얘기도 나오는데 전자파보다는 오히려 자기장에 더 관련있을것 같네.

여튼 ECU 버그로 RPM이 레드존까지 치고 올라가더라도 브레이크를 밟으면 튀어나가지 않는다. 더하여 사이드 브레이크도 있고. 소나타가 헐크로 변한다? 연료가 아무리 과하게 주입되어도 토크는 상승하지 않는다. 물론 브레이크가 노후된거면 조금씩 밀릴 수는 있겠고 울컥울컥할 땐 그냥 밟아도 서지만 한번 가속된거면 양발로 강하게 푸쉬해야 된다.

그럼 또, 당황하면 브레이크 못 밟을 수도 있지 않은가? 절대 네버 노! 뒤에서 광속 질주해오는 차들 무시하고 고속도로 한복판에 차 세우고 전화받는 김여사를 보라. 우리네 브레이크 본능은 무시하기 힘들지. 오히려 안밟고 컨트롤 하면 될 것을 브레이크 밟아서 더 큰 사고 발생하는 이유가 뭐겠어. 물론 협소한 곳에서 그러면 당황할테지만 어딘가에 바로 박을 테고. 뻥뚫린 도로에서 그러면 국산 승용차로는 제로백 8초도 못 찍을텐데 시간적으로 충분하지. 영상들 보면 차 스스로인지는 몰겠으나 악셀링하면서 변속도 타이밍 맞춰 잘하고 그러던데 ㅋ

결국 아마 악셀을 브레이크로 착각하고 밟으면서 튀어나간 경우가 태반일 것이고, ..

한가지 의심되는게 있다라 하면, 스포츠카 같은 류에는 브레이크와 악셀을 같이 밟고 몇 초 대기하면 급발진 모드로 전환하는 이른바 런치 컨트롤 시스템이라는게 있는데, .. 현대차나 기아차가 펌웨어 해외에서 사다가 커스터마이징하면서 지들도 모르던 런치 컨트롤 같은 기능을 숨겨논거 아닌가 몰러? 런치 스타트 처음해볼 땐 나도 알면서도 매우 공포스러웠긴 함.

여튼 급발진 통계를 살펴보면 고령 운전자가 대부분이고 해외에서 급발진 피해자 주행 습관 분석 결과를 보면 100% 운전 과실이다. 브레이크를 밟아야 변속되는 Shift lock 기능이 추가되면서 현격이 줄어들기도 하였고. 순식간에 일어난 사고의 기억을 자신도 모르게 정당화하는 심리도 한 몫하지. 양재동에서 불법야매로 ECU 소프트웨어 해킹하고 다니는 폭주족들이 급발진을 당했으면 당했지 도대체 왜 점잖은 어르신들의 승용차가 그리 말썽인가?

결론은 제어불가능한 급발진은 존재할 수가 없다.

Be a Doer

There are two type of regret.

1. regret on already happening
2. regret on not done things

The latter is more terrible, because it's unjustifiable.

Big Data, Why Matrix is important?

We feels the beauty of harmony and convenience of order from regular array that can be found in the Library or Parking lot. Like this, the matrix is applied not only to mathematical problems but also to problems in our real life as a useful concept. For examples, account book, items or goods management, encryption and decryption, population analysis, statistical data analysis, quantitative business analysis, and the transportation network analysis, ..., etc.

The matrix is everywhere, it is all around us.

The same is true of the Cyber world. The matrix is an essential part of information management and analysis. Just think of Amazon bookstore, Foursquare, Google Maps/Places, Social network services and its traffic flow networks or user in/out flows, ..., etc. Log data. The only difference is scale, Local Vs. World-wide. In shortly, Big Data! Do you love this term?

Wait! What is Matrix?

In mathematics, the matrix is an rectangular array of numbers or letters arranged in rows and columns. An m x n matrix has m rows and n columns. If m = n, we call it a square matrix. Two matrices are equal if they have the same number of rows and columns, and the corresponding entries in every position are equal. We usually represent a matrix as follows:


Let assume the A and B  be both m x n matrices, then A + B is defined by [aij + bij]. The product of matrices A and B is de ned if A is m x k and B is k x n matrices. In other words, AB is de fined if the column number of A is the same as the row number of B. The dimensionality of AB is m x n. The entries in AB are de fined by cij = ai1b1j + ai2b2j + ... + aikbkj.

What is use of matrix arithmetic in real world? Maybe we've already learned in high school e.g., gets the total cost from the product of matrices.

BigTable

The Google's BigTable was born for this reason or to store huge semi-structured (WWW) data. I'm mentioning this for one reason: how to store a very large matrix?

When I looked at their paper for the first time, I thought that is a sparse matrices storage for large link graph data or spatial data. I may be wrong or right. However, I'm still think it's good one for matrix storing. Because, it allows random access read/write and its column oriented design allows to read one specific column vector effectively, to store sparse matrix data efficiently. Certainly, there are many advantages than using of flat files.

Here's good news, there are BigTable clone open source software: HBase, Cassandra, and Accumulo.

Matrix computations on Big Data

When people does talk about Big Data, It is always - "extract value from the data". What's the meaning of this? In the past, we relied on intuition and luck. But now, to forecast and re-act more scientific and correct, we should have to extract valuable patterns and information, previously hidden within Big Data! That's all.

As you already know, there's a many good open source solutions for Big Data such as Hadoop, Hive, HBase..., etc. So then, how does Big Data solutions extract valuable patterns and information? Well, the value is relative. You should use your own math. MapReduce may be enough or not.

The math or mining tool is still in the beginning stages in the Big Data world. The matrix is everywhere from simple statistics analysis to more complex machine learning algorithms or recommendation systems, but there is not suitable computing engine for Matrix (and also graph) computations yet. WTF!?

With this, I can't mining anything. 

Recently, the message passing stuffs like BSP (Bulk Synchronous Parallel) and MPI are came back again because of limited MapReduce capacity.

A notable example is the Apache Hama, which is a pure BSP(Bulk Synchronous Parallel) computing framework on top of HDFS (Hadoop Distributed File System) for massive scientific computations such as matrix, graph and network algorithms.

Oh, It's time to go to check out the Hama.

Pregel clone package on top of Apache Hama

Today, I finished testing new Graph package and its examples of Apache Hama on 2 rack 512 cores fully distributed cluster.

The new Graph APIs is the completely clone of Google's Pregel and its performance  is also quite good. Hama-0.5 release will provide really powerful BSP computing engine and lot of new features. :D

 Here's full source code of Single Source Shortest Path:
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.hama.examples;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hama.HamaConfiguration;
import org.apache.hama.bsp.HashPartitioner;
import org.apache.hama.bsp.SequenceFileInputFormat;
import org.apache.hama.bsp.SequenceFileOutputFormat;
import org.apache.hama.graph.Edge;
import org.apache.hama.graph.GraphJob;
import org.apache.hama.graph.Vertex;
import org.apache.hama.graph.VertexArrayWritable;
import org.apache.hama.graph.VertexWritable;

public class SSSP {
  public static final String START_VERTEX = "shortest.paths.start.vertex.name";

  public static class ShortestPathVertex extends Vertex<IntWritable> {

    public ShortestPathVertex() {
      this.setValue(new IntWritable(Integer.MAX_VALUE));
    }

    public boolean isStartVertex() {
      String startVertex = getConf().get(START_VERTEX);
      return (this.getVertexID().equals(startVertex)) ? true : false;
    }

    @Override
    public void compute(Iterator<IntWritable> messages) throws IOException {
      int minDist = isStartVertex() ? 0 : Integer.MAX_VALUE;

      while (messages.hasNext()) {
        IntWritable msg = messages.next();
        if (msg.get() < minDist) {
          minDist = msg.get();
        }
      }

      if (minDist < this.getValue().get()) {
        this.setValue(new IntWritable(minDist));
        for (Edge e : this.getOutEdges()) {
          sendMessage(e, new IntWritable(minDist + e.getCost()));
        }
      }
    }
  }

  private static void printUsage() {
    System.out.println("Usage: <startnode> <input> <output> [tasks]");
    System.exit(-1);
  }

  public static void main(String[] args) throws IOException,
      InterruptedException, ClassNotFoundException {
    if (args.length < 3)
      printUsage();

    // Graph job configuration
    HamaConfiguration conf = new HamaConfiguration();
    GraphJob ssspJob = new GraphJob(conf, SSSP.class);
    // Set the job name
    ssspJob.setJobName("Single Source Shortest Path");

    conf.set(START_VERTEX, args[0]);
    ssspJob.setInputPath(new Path(args[1]));
    ssspJob.setOutputPath(new Path(args[2]));

    if (args.length == 4) {
      ssspJob.setNumBspTask(Integer.parseInt(args[3]));
    }

    ssspJob.setVertexClass(ShortestPathVertex.class);
    ssspJob.setMaxIteration(Integer.MAX_VALUE);
    ssspJob.setInputFormat(SequenceFileInputFormat.class);
    ssspJob.setInputKeyClass(VertexWritable.class);
    ssspJob.setInputValueClass(VertexArrayWritable.class);

    ssspJob.setPartitioner(HashPartitioner.class);
    ssspJob.setOutputFormat(SequenceFileOutputFormat.class);
    ssspJob.setOutputKeyClass(Text.class);
    ssspJob.setOutputValueClass(IntWritable.class);

    long startTime = System.currentTimeMillis();
    if (ssspJob.waitForCompletion(true)) {
      System.out.println("Job Finished in "
          + (double) (System.currentTimeMillis() - startTime) / 1000.0
          + " seconds");
    }
  }
}

Received new car as compensation

I was having (engine stalls) problem with ma car 2011 Z4 sDrive30i, finally received new one as compensation from the BMW. Yahoo!

The model of my new car is 2012 new Z4 sDrive 35i with twin turbo, 7-speed dual clutch transmission, alpine white body, red seats, full sound package ..., etc. options.

I dislike turbo engine (more precisely, turbo-lag) but this is quite good, except crackable alloy wheels (you must watch out for all potholes nervously) and rough engine braking (the car behind might kick your ass if you take off the gas pedal suddenly).

This car has an awesome performance, unbelievable quick response, new +/- paddle shifts, and back-fire sounds like beast... (If you listen very closely, you may hear the sound of Benz SLS amg). Overall, ☆.

Compared to (1st generation) older model Z4, this car got convenience and enough output but lost sparky and sprinter's explosive power. Shortly, this is a sporty-daily car. If you're looking for hardcore machine, you should have to buy Lotus or, Porsche.

Additionally, this car is very fit for people who live in a mountainous area. Because, the cornering is fantastic. In (my) S. Korea case, 70% of the area is mountainous. There are all the winding roads (Even in the winter, I drive this). If you live in big country, you'll be friends with spine specialists soon.

Cassandra 책 속에 내 이름


아 못난이같지만 자랑질 좀 하자.
카싼드라 책 속에 내이름이 있음을 오늘 처음 발견했다. ㅋ

기다려봐.
내가 글로벌 최대 출판사와 IT전문서적을 publish한 최초의 한국인이 될테니.

Stability equals death

Biologically, being alive means keeping instability. Our cells pump out sodium (Na) and take in potassium (K) until they die. Between start and end of all things, there's only instability.

Why don't we have to pursue more instable life?
.
.
.
.
.
(But, ... I seems not ready to give up my stable life yet.)

빅데이터는 노하우의 내재화가 핵심이다.

내가 지금껏 IT 업계에서 봐온 짜증-류의 작업은 크게 3개 정도 있다.

1) 첫째가 새벽에 출근해서 DB 만지는 것.

 가령, 블로그 서비스에 (사소할지언정) 어떤 기능이 하나 추가되거나 기획자들이 리포트를 원할 때면 필연적으로 RDBMS 스키마를 변경하거나 묵직한 쿼리를 날려야 되는 문제가 따라온다. 그러면 그냥 새벽에 ‘임시점검’ 띄워놓고 DB 작업하는 거다. 데이터가 증가하거나 장애가 뜨면 또 어떤가. 바로 이런 짜증스런 문제에서 Schema-free, ad-hoc query processing, fault tolerant 요구가 나오고 NoSQL 기술이 진화하는 것이다.

2) 두 번째, 웹 서버에 웹 로그 파일 4GB 짜리가 수십 개씩 뚝뚝 떨어진다.

 로그파일 떨어지는걸 감당못해 바로바로 압축하고 테이프에 떠서 지워가는 곳도 있을거다. 이 때, 어떤 장애가 발생하면 당근 과거 로그는 뒤져볼 수 가 없겠고, 로그레벨을 debug로 맞춰서 재현될 때까지 멍청하게 눈팅 하는거다. 그래서 거대한 분산 파일시스템, 로그 마이닝 같은 기술에 열광하는게 아닐까. 잡설 1, 미국 어느 주에서는 Facebook, Twitter 타임라인가지고 crime prediction 하기도 하고 (왠지 자살같은것도 미연에 방지할 수 있겠고) 그런다던데 ... 한국은 왠지 알바생들이 나꼼수 트위터 눈팅할 듯.

3) 세 번째, 의사결정권자는 언제나 근거자료를 원한다.

 어떤 문제나 서비스/상품을 기획해서 에스컬레이션 올리면 의사결정권자는 근거를 원한다. 그 근거는 수치로 말하는 것이 확실하다. Shut up and use the math. 이런 통계를 내려고 MySQL 깔아서 데이터 입력해놓고 쿼리문으로 조지던 개발자들 많을거다.

 뭐 여튼, 빅데이터 기술 진화는 사실 이렇게 필연적이었다고 말할 수 있겠다. 이게 뭐 꼭 오늘날 직면하게된 문제는 아니고 5년 전부터 그 증상들이 이곳저곳에서 나타나고 있었지. 양키들이 NoSQL만들때 우리는 무얼했나? 뭐든 빨리빨리 아웃풋 내놓으라고 쪼아대던 관리자가 주범이다. 그들은 x잡고 반성해야되며, 우리 개발자들의 무능함을 탓하지 말라.

.. 간혹 킬러앱으로 소셜 데이터를 분석해서 서비스 퀄러티를 높인다는 둥 .. 내 생각에 요건 한계가 있다.

검색엔진이 페이지랭크로 추천해주는 문서보다는 그냥 물어보고 직접 사람이 답하는 Q&A 서비스가, 암만 뉴스 개인화 추천시스템이 훌륭해봐야 트위터 친구들이 끊임없이 물어다주는 뉴스들이 더 감칠맛나는 것처럼, ... 빅데이터 분석을 응용하면 서비스의 퀄러티가 높아진다는건 좀 .. (물론 가능성은 있지만) 시만틱웹처럼 뭔가 애매~ 합니다잉.

여튼 뭘 하든지 간에, 결국은 빅데이터는 노하우의 내재화가 핵심인거다. 외부 솔루션 들여와서 자 이제 뭘 할건데?

Terminate AWS instances with Java SDK

    BasicAWSCredentials awsCredentials = new BasicAWSCredentials(
        AWSAccessKeyId, SecretAccessKey);

    AmazonEC2Client ec2Client = new AmazonEC2Client(awsCredentials);
    ec2Client.setEndpoint("ec2.us-east-1.amazonaws.com"); // Zone

    List<String> instancesToTerminate = new ArrayList<String>();
    
    DescribeInstancesResult result = ec2Client.describeInstances();
    List<Reservation> reservations = result.getReservations();
    for (Reservation reservation : reservations) {
      List<Instance> instances = reservation.getInstances();
      for (Instance instance : instances) {
        System.out.println("Terminating: " + instance.getInstanceId());
        instancesToTerminate.add(instance.getInstanceId());
      }
    }

    TerminateInstancesRequest term = new TerminateInstancesRequest();
    term.setInstanceIds(instancesToTerminate);
    ec2Client.terminateInstances(term);

Mother Nature is harsh

When I saw the documentary, "남극의 눈물", I was deeply shocked by the scene where giant petrel attacked a baby penguin.


Mother Nature is harsh.

[O'Reilly Radar] 빅데이터란 무엇인가?

* You can see the original post here.

빅데이터는 전통 데이터베이스의 연산 수용능력을 초과한 "너무 크고, 빠르게 변하거나 데이터베이스에 구조화하기 힘든" 데이터를 말한다. 이런 데이터에서 가치를 얻으려면 대안을 찾는 수 밖에.

2012년 핫키워드 빅데이터는 거대한 데이터 3Vsvolume, velocity and variability를 싼 값에 다룰 수 있는 형태로 실용화되고 있다. 이런 빅데이터 내에 의미있는 패턴과 정보가 묻혀 있는데, 추출하는 일은 결코 쉽지 않아 예전엔 그냥 그대로 묻혀 있었다. 구글이나 월마트같은 소수의 선두기업만이 막대한 비용을 들여 빅데이터 처리 능력을 갖추고 있었지. 그러나 오늘날의 하드웨어, 클라우드, 그리고 오픈소스는 이제 싼 값에 클라우드를 렌트하여 사업하는 벤처기업마저도 빅데이터를 처리할 수 있게 도와준다.

빅데이터의 가치는 분석 용도와 신규 제품 개발에 활용되는 두 개의 분야로 나뉘는데, 빅데이터 분석은 그간 막대한 비용 뒷켠에 꽁꽁 숨어있던 인사이트를 찾는데 사용된다. 예를 들면, 쇼핑몰 고객의 거래내역, 사회적 지역적 데이터를 분석함으로서 고객들의 영향력을 분석한다. 또, 빠른 시간내 모든 데이터를 연산하는게 가능하여 샘플링하는 번거로움이 없고 사전 정의된 질의에 대한 정기적인 리포트를 뽑아내는 기존의 다소 정적인 방식 대신 새로운 데이터 분석과 교정작업을 필요할때 즉각 처리할 수 있다역자주: SQL 리포트 서비스나 비지니스 인텔리전스 Predefined or ad-hoc reports 참고.

지난 십여년 간 성공한 신생 웹 기업의 신규 사업과 서비스가 바로 이런 빅데이터를 잘 활용한 사례인데, 예를 들면, 페이스북은 사용자 행태와 친구관계를 분석함으로써 고급스럽게 개인화된 UX와 새로운 형태의 광고 사업을 만들어낸 것이다. 빅데이터 대부분의 아이디어와 솔루션이 구글, 야후!, 아마존 그리고 페이스북 등 기업에서 나온 것은 결코 우연히 아닌 것이다.

기업에 빅데이터 출현은 민첩함을 필연적 과제로 안겨다 준다. 빅데이터에서 성공적으로 가치를 얻으려면 연구와 실험을 필요로한다. 신규 사업을 개발하든 시장에서 경쟁 우위를 점할 방법을 찾든 호기심과 기업적 전망이 필요한 것이다.


What does big data look like?


"빅데이터"는 포괄적인 용어로 꽤 모호하다. "클라우드"가 다양한 기술을 커버하는것처럼 말이지. 빅데이터 시스템에 인풋이 되는 데이터는 웹로그, 위성 이미지, 트래픽 로그, 소셜 네트워크, 인터넷뱅킹 거래내역, 웹 컨텐츠, 금융 관련 데이터 등 헉헉! 보시는바와 같이 다양하거든?

의미가 좀 더 명확하게 표현하기 위해, 3Vs (volume, velocity and variety) 라는 것이 있다. 이는 일반적으로 빅데이터의 각기 다른 면을 표현하고자 사용되는데, 데이터의 본질과 그에 맞는 플랫폼을 확인하고 이해하는데 도움주는 잣대로 쓰면 된다.

Volume


거대한 정보를 연산처리할 수 있는 능력이 빅데이터 분석의 주된 매력이다. 사실 좋은 모델보다는 그냥 데이터셋이 많은게 좋거든. 단지 팩터가 늘어난다고 보다 정확한 수요예측이 가능해지진 않고, 거대한 데이터셋에 간단한 수학이 오히려 효과적일때가 있다.

이런 빅 volume은 기존의 IT 구조에 즉각 도전장을 던지지. 확장가능한 스토리지와 분산 쿼리 접근을 요구하니까. 많은 회사들은 이미 많은 데이터를 보유하고 있겠지만, 연산처리할 엄두를 못 내고 있는게 현실일게다.

기존의 관계형 데이터베이스에 안맞는 거대한 볼륨이 있다면, 데이터웨어하우스나 Greenplum 같은 데이터베이스 또는 Apache Hadoop 기반 솔루션들과 같은 분산처리시스템을 골라야할게다. 이 선택에는 3Vs 중에서 "variety"를 갖다 대면 된다. 일반적으로 데이터웨어하우징은 사전 정의된 스키마와 일정하고 느리게 변화하는 데이터셋에 적합한 반면, Apache Hadoop은 요런 데이터 구조에 문제가 없다.

Hadoop은 다수의 서버를 묶어 분산처리하는 플랫폼인데, 분산처리하는 "map" 단계와 결과를 취합하는 "reduce" 단계로 이루어진 구글의 MapReduce 모델을 본떠 만든 프로젝트로써 야후!의 더그커팅에 의해서 처음 개발되고 배포되었다.

데이터 저장은 자체 분산 파일시스템인 HDFS를 활용하는데 Hadoop의 일반적인 사용 패턴은 다음과 같다:
  • HDFS로 데이터를 로딩
  • MapReduce로 연산처리
  • HDFS에 결과 저장

이 과정은 배치 연산이기때문에 분석이나 비대화식 컴퓨팅에 적합하다. 이 때문에 Hadoop이 데이터베이스 또는 데이터웨어하우스 솔루션은 아니지만 분석 보조자의 역할을 수행할 수 있다는 말씀.

Hadoop을 이러한 패턴으로 사용하는 가장 잘 알려진 사용자로는 페이스북이 있는데, MySQL 데이터베이스에 실데이터를 저장하고 Hadoop에 백업해서 친구 추천같은 작업을 MapReduce로 처리하고 다시 결과를 MySQL로 업데이트한다고 하지.

Velocity


데이터의 velocity의데이터를 처리하는 속도 중요성은 volume과 비슷한 패턴을 갖고 있다. 금융쪽과 같이 일부 특수 산업 분야에만 제한되어있던 문제들이 이제는 훨씬 광범위한 분야로 나타나고 있다. 요거 이제 우리 모두가 겪을 차례다.

왜냐? 인터넷과 모바일의 시대는 곧 우리 모두 서비스를 이용하면서 서비스 제공자에게 데이터를 꾸준히 만들어냄을 의미하니까. 쇼핑몰 사업자들은 단순 판매만이 아니라 고객의 클릭 로그나 행태를 모두 수집하면서 신속하게 그러한 정보를 활용하여 추가 구매를 추천하는 등의 방식으로 경쟁력을 얻을 수 있다. 스마트폰의 시대는 지형정보 이미지나 음성같은 데이터들로 유입량이 더 많아졌지.

단순히 유입되는 데이터의 속도만이 문제는 아니다. 배치 작업으로 스토리지에 밀어넣으면 되니까. 중요한건 들어온 데이터를 빠른 속도로 처리하여 결과를 얻는데 달려있다. IBM에 광고를 예로, 5분 전의 트래픽 정보 처리 결과 가지고는 도로를 못건넌다는. 즉, Hadoop 배치 job 완료될 때까지 못기다리겠다는 경우가 있다는것.

이렇게 빠른 속도로 유입되는 데이터를 처리하는 것을 공돌이 용어로는 "스트리밍 데이터" 또는 "컴플렉스 이벤트 프로세싱"이라고 한다. 먼저 일반적으로 사용된건 "스트리밍 프로세싱"이고, 뒤에 나온 용어는 제품용에다 갖다 붙이면서 탄생한 용어다.

스트리밍 프로세싱을 고려하는 이유는 크게 두 가지로 생각할 수 있는데, 첫번째로는 빠르게 들어오는 인풋데이터 전부를 스토리지에 때려넣기 버겁고 스토리지를 어떤 분석 가능한 형상으로 계속 유지하려는 경우다역자주: 극단적인 예로 초대형 입자가속기 얘기가 잠깐 나오는데 유용한 정보 안지웠길 희망한다네. 스트리밍을 고려하는 두 번째 이유는 어플리케이션이 즉각 반응해야하는 경우다. 모바일 어플리케이션과 온라인 게임의 출현 덕분에이 점점 더 일반적인 상황이지.

스트리밍 데이터를 처리하기위한 제품은 IBM의 InfoSphere Streams, 그리고 아직은 덜 익은(?) 트위터의 Storm과 야후!의 S4가 있다역자주: Apache Hama Realtime Processing도 참고하시라.

앞서 언급했듯, 비단 인풋 데이터에 대한 얘기만은 아니다. 시스템의 아웃풋 결과 처리 속도 또한 마찬가지라는 말씀. 예를 들면, 결과를 곧바로 페이스북의 추천 서비스에 반영하거나 의사결정 대쉬보드에 올려줘야 경쟁력을 갖춘다는 이야기.

특히 key-value 저장소나 column-oriented 데이터베이스같은 NoSQL 기반에 미리 요약된 정보를 빠르게 조회하도록 만든 웹서비스가 이러한 빠른 스트리밍 프로세싱이 필요하다!

Variety


데이터가 연산 가공하기 편하게 잘 준비된 형태를 갖추는 경우는 매우 드물다. 빅데이터 시스템은 관계형 구조에 안맞는 다양한 데이터를 다루는 것이 일반 주제다. 소셜 네트워크, 이미지, 센서의 raw 데이터에서 나온 텍스트같은 것들 말이지. 이것들은 개발자 어플리케이션에 쏙 들어갈 준비가 안 되어있다.

웹에서도, 컴퓨터간의 통신이 이뤄져야하는 경우 데이터는 매우 지저분하다. 다른 브라우저가 전송한 각 데이터, 정보를 제대로 입력안하는 유저들, 각기 다른 버전의 소프트웨어로 접근하지. 게다가 이런 과정에 사람 손을 타는 작업이 있으면, 오류와 모순 투성일게다.

빅데이터 프로세싱의 일반적인 사용은 비정형 데이터를 가지고 사람 또는 어플리케이션에 정형화된 인풋용으로  요구된 의미를 찾는것이다. 개체명 식별을 예로텍스트 마이닝에 Name/Entity resolution, "런던"이 영국의 "런던"을 가리키는지 텍사스의 "런던"을 가리키는지 파악할 수 있다.

원본 데이터에서 필요한 데이터로 전환하는 과정에 정보의 손실이 있을수 있다. 다 끝나고 작업자가 원본을 지워버릴수 있겠지. 빅데이터의 핵심이니까 지금부터 밑줄 쫙~. "보관할 수 있을때, 보관해라". 지워버린 데이터에 유용한 정보가 또 숨겨져 있을 수 있다. 지워버리면 되돌릴 수가 없으니.

관계형 데이터베이스가 인기있고 친숙하더라도 언제나 사용해야하는건 아니다. 특정 데이터 형식은 그에 걸맞는 데이터베이스에 잘 맞다. 예를 들어, XML로 인코딩된 문서는 MarkLogic같은 XML 특화된 저장소에 저장하는게 좋다. 소셜 네트워크 그래프는 Neo4j같은 그래프 데이터베이스에 저장하는것이 더 간단하고 효과적이다.

근본적으로 데이터 형식에 문제가 없더라도, 관계형 데이터베이스의 단점은 정적인 스키마다. 더 많은 시그널을 탐지하고 발견하면서 계산 결과는 계속 진화하니까. NoSQL 이놈들은 데이터를 구성하기에 충분한 구조를 제공하지만, 저장하기 전에 고정된 스키마를 필요하지 않거든.


--
빅데이터 = 말 그대로 '크고 많은 양'의 데이터들. 스마트폰, 스마트패드 등 단말기가 많아지고 소셜네트워크서비스(SNS) 등 정보채널이 확대되면서 이용자들이 생산, 유통하는 정보 양이 기하급수적으로 증가했다. 형태가 각기 다른 정보들을 수집하고 분석해 이용하는 방법이 중요하다.