Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TME Introduction at OSDC.tw 2012

TME Introduction at OSDC.tw 2012

Trend Message Exchange realtime big data processing platform by Trend Micro. Now it is open sourced at http://trendmicro.github.com/tme/

lunastorm

April 18, 2012
Tweet

Other Decks in Programming

Transcript

  1. TME Highlight • Not another MQ middleware • A new

    breed of message bus • Easy as hell integration model • Modeled after Unix's pipeline (pipe and filter) • Chain processes by file I/O (typically stdio streams)
  2. Example • Word count in a Unix shell • $

    cat log | wc -w • Distributed word count, producer(s) side: • $ cat log | mist-sink OPTIONS • Distributed word count, consumer(s) side: • $ mist-source OPTIONS | wc -w
  3. Example • By distributing load to consumers, you get: •

    Application load balancing • Application high availability • For free
  4. Key Features • Highly scalable and available • At least

    once delivery • Topology oriented routing (TME Graph) • No endpoint specific routing by design • No message ordering • Favors stateless processing • Enables failover in scale
  5. Agenda • Introduction to the TME Ecosystem • Messaging Integration

    STandard (MIST) • TME Graph (Workflow Management) • Related Work • Future Work
  6. 4-Byte Network Order Integer Length Message Streaming Format message MessageBlock

    { required string id = 1; required bytes message = 2; optional int64 ttl = 3; repeated KeyValuePair properties = 4; } 4-Byte Network Order Integer Length Message Block Message Block
  7. 曾幾何時... #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include

    <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int main(void){ struct sockaddr_in stSockAddr; int SocketFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); memset(&stSockAddr, 0, sizeof(stSockAddr)); stSockAddr.sin_family = AF_INET; stSockAddr.sin_port = htons(5566); stSockAddr.sin_addr.s_addr = INADDR_ANY; bind(SocketFD,(const void *)&stSockAddr, sizeof(stSockAddr)) listen(SocketFD, 10) int ConnectFD = accept(SocketFD, NULL, NULL); //do something }
  8. You do not have to implement the protocol! • We

    have a set of command line tools • Use simple file IO for everything!
  9. MIST Tools • A set of command line tools to

    get / send messages from TME • In the UNIX world... • ls | grep "something" | wc -l • With MIST, we can also... • mist-source | some_filter | mist-sink
  10. MIST Tools • Hides all complexity of connecting to message

    brokers • Just specify what queue you would like to subscribe, and your output message IDs
  11. MIST Tools • Dump messages to a file • mist-source

    > messages.dump • Send the messages from a file • mist-sink < messages.dump
  12. MIST Tools • Easy to test application logic • From

    • mist-source | foo | mist-sink -> TME -> mist-source | bar • To • foo | bar
  13. One-Linerholic • src_id=$(mist-session) && sink_id=$(mist- session) && mist-source $src_id --mount

    apache_log && mist-source $src_id --attach | mist-decode --line | sed -e '/404/!d' | mist- encode --wrap 404_request --line | mist-sink $sink_sid --attach ; mist-session --destroy $src_id ; mist-session --destroy $sink_id
  14. Future Work #include<iostream> #include<string> using namespace std; void main(){ string

    line; while(getline(cin, line)){ // do something with the message if(line.find("法轮大法好") != string::npos){ cout << line << endl; } } } import sys, java.lang from org.apache.hadoop.hbase import HBase Configuration, client.HTable table = HTable(HBaseConfiguration.create(), 'gold_shield') while True: line = sys.stdin.readline() if not line: break table.incrementColumnValue(row_key, family , log_dict[family], 1) table.close() Web IDE for cloud!
  15. Contribute? • Issue tracker on GitHub • Fork & Exec

    • Pull requests!! • Easy enough, huh?