JAFKA A fast MQ. overview ● https://github.com/adyliu/jafka https://github.com/adyliu/jafka ● 271KB single jar ● 3.5MB with all dependencies and configurations.

Slides:



Advertisements
Similar presentations
Building LinkedIn’s Real-time Data Pipeline
Advertisements

Andrew Hanushevsky7-Feb Andrew Hanushevsky Stanford Linear Accelerator Center Produced under contract DE-AC03-76SF00515 between Stanford University.
MAP REDUCE PROGRAMMING Dr G Sudha Sadasivam. Map - reduce sort/merge based distributed processing Best for batch- oriented processing Sort/merge is primitive.
Socket Programming ENTERPRISE JAVA. 2 Content  Sockets  Streams  Threads  Readings.
1 Chapter 5 Threads 2 Contents  Overview  Benefits  User and Kernel Threads  Multithreading Models  Solaris 2 Threads  Java Threads.
Kafka high-throughput, persistent, multi-reader streams
Azure Services Platform Piotr Zierhoffer. Agenda Cloud? What is Azure? Environment Basic glossary Architecture Element description Deployment.
Copyright 2006 by Pearson Education 1 reading: 4.1 Cumulative sum.
Scuola Superiore Sant’Anna Project Assignments Operating Systems.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
MBS HOW TO: MBS 3.74 ENHANCEMENTS AND CUSTOMER COMMUNICATIONS Bonnie Faulkner & Terri Hunt.
Presented by: Alvaro Llanos E.  Motivation and Overview  Frangipani Architecture overview  Similar DFS  PETAL: Distributed virtual disks ◦ Overview.
An program As a simple example of socket programming we can implement a program that sends to a remote site As a simple example of socket.
Misc. Java Alittle more network programming & Using jar files to share your work.
Hypertable Doug Judd Background  Zvents plan is to become the “Google” of local search  Identified the need for a scalable DB 
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Troubleshooting Replication and Geodata Services
SelfDiagnose “who is to blame” ernest micklei, April 2007.
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
Running Kuali: A Technical Perspective Ailish Byrne - Indiana University Jay Sissom - Indiana University Foundation.
14 - Client/ServerCSC4071 Systems Architecture Client-Server Systems.
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
1 Web Based Programming Section 8 James King 12 August 2003.
Experience with the Thumper Wei Yang Stanford Linear Accelerator Center May 27-28, 2008 US ATLAS Tier 2/3 workshop University of Michigan, Ann Arbor.
Multi-Threaded Programming Design CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 22.
1 Interfacing & embedding. 2 References  Full tutorial and references Embedding and Interfacing Manual Windows - select “Documentation” from the ECLiPSe.
14 - Client/ServerCSC4071 Systems Architecture Client-Server Systems.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Indentation & Readability. What does this program do? public class Hello { public static void main ( String[] args ) { //display initial message System.out.println(
6.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Module 6: Process Synchronization Codes.
Team3: Xiaokui Shu, Ron Cohen CS5604 at Virginia Tech December 6, 2010.
Motivation Large-scale distributed application require different forms of coordination: Configuration Group membership and leader election Synchronization.
Data Communication EDA344, DIT420 Description of Lab 1 and Optional Programming HTTP Assignment Bapi Chatterjee Prajith R G.
Advanced Tools for Multi- Threads Programming Avshalom Elmalech Eliahu Khalastchi 2010.
VIRTUAL SERVERS Chapter 7. 2 OVERVIEW Exchange Server 2003 virtual servers Virtual servers in a clustering environment Creating additional virtual servers.
Event Hubs RelayMessaging A distributed, partitioned, replicated commit log service that provides for large scale low latency data ingress and enables.
Apache Kafka A distributed publish-subscribe messaging system
CMSC 491 Hadoop-Based Distributed Computing Spring 2016 Adam Shook
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Export Services Deep Dive
Sanjay Ghemawat, Howard Gobioff, Shun-Tak Leung
Jun Rao co-founder at Confluent, Inc
Data Communication EDA344, DIT420 Description of Lab 1 and Optional Programming HTTP Assignment Aras Atalar Prajith R G.
Data Loss and Data Duplication in Kafka
Samza: Stateful Scalable Stream Processing at LinkedIn
Echo Networking COMP
Introduction to Apache Kafka
Real-time Streaming and Data Pipelines with Apache Kafka
Multi Threading.
RDP Protocol Test Suite
A Messaging Infrastructure for WLCG
IBM WEBSPHERE MESSAGE QUEUE online Training | IBM WEBSPHERE MQ Training
Samza: Stateful Scalable Stream Processing at LinkedIn
(Includes setup) FAQ ON DOCUMENTS (Includes setup)
Condition Variables and Producer/Consumer
CNT 4007C Project 2 Good morning, everyone. In this class, we will have a brief look at the project 2. Project 2 is basically the same with project 1.
Evolution of messaging systems and event driven architecture
Condition Variables and Producer/Consumer
Data Communication EDA344, DIT420 Description of Lab 1 and Optional Programming HTTP Assignment Aras Atalar Prajith R G 24/01/2018.
class PrintOnetoTen { public static void main(String args[]) {
Installing and running the local check and grader projects in Eclipse
Threads in Java James Brucker.
Myrinet 2Gbps Networks (
Client-Server Systems
CS 240 – Advanced Programming Concepts
Presentation transcript:

JAFKA A fast MQ

overview ● ● 271KB single jar ● 3.5MB with all dependencies and configurations ● So simple, so fast 2jafka mq

Maven Usage com.sohu.jafka jafka 1.0-rc7 com.sohu.jafka jafka 1.0-rc7 3jafka mq

Dependencies ● Zkclient – Zookeeper ● Log4j ● Jackson ● Optional dependencies: – Mx4j-tools – jopt-simple 4jafka mq

Future ● A full kafka clone ( ● Persisten messaging with O(1) ● Constant time performance even with TB messages ● High-throughput (100k/s) ● Distributed messaging system – producers/brokers/consumers ● Auto load balancing ● Simple message format 5jafka mq

Message format (1) 6jafka mq

Message format (2) 7jafka mq

Log Implementation 8jafka mq

Architech and workflow 9jafka mq

Zookeeper nodes 10jafka mq

Offset length limit ● Long.MAX_VALUE – → 9*10 18 ● If one message size is 1k – Messages: 9*10 15 – If producing 1 billion messages per day ● Continuing days: 9*10 6 ● Continuing years: jafka mq

About Filesystem ● rpm SATA RAID-5 * – 300MB/s linear writes (300k/s 1KB per message) – 50k/s random writes 12jafka mq

sendfile() (1) ● Common data transfer 1.OS reads data from disk to pagecache 2.Application reads data from pagecache to buffer 3.Application writes data back into socket buffer 4.OS copies data from socket buffer to NIC buffer ● 4 copies + 2 system_call 13jafka mq

sendfile() (2) ● FileChannel.transferTo(long, long, WritableByteChannel) – Zero copy * 14jafka mq

Batch compression ● GZIP message compression default 15jafka mq

Sync or Async ● Both supported ● Setting at connecting ● Batch sending while using asynchronous sending 16jafka mq

Usage ● Simple & Funny 17jafka mq

Simple usage - dependencies com.sohu.suc* suc-mq ● Version >= 2.0-SNAPSHOT 18jafka mq * our inner project

Simple usage - producer Producers producers = Producers.buildProducer(); StringMessage data = new StringMessage("demo"); data.add("first message"); data.add("second message"); data.add("third message"); producers.send(data); 19jafka mq

Simple usage - consumer public static void main(String[] args) { Consumers.buildConsumer("demo", "adyliu", new IMessageListener () public void onMessage(String message) { System.out.println(message + " ==> " + new Date()); } }); } 20jafka mq

Consumer => Queue Consumers.buildConsumer("demo", "adyliu", new IMessageListener () { public void onMessage(String message) { System.out.println(message + " ==> " + new Date()); } }); Consumers.buildConsumer("demo", "adyliu", new IMessageListener () { public void onMessage(String message) { System.out.println(message + " ==> " + new Date()); } }); Client A 21jafka mq

Consumer => Topic Consumers.buildConsumer("demo", "adyliu", new IMessageListener () { public void onMessage(String message) { System.out.println(message + " ==> " + new Date()); } }); Consumers.buildConsumer("demo", "zhendong", new IMessageListener () { public void onMessage(String message) { System.out.println("[ 震子 ] ==> " + message); } }); Client A Client B 22jafka mq

Properties props = new Properties(); props.put("zk.connect", "localhost:2181"); props.put("serializer.class", StringEncoder.class.getName()); // ProducerConfig config = new ProducerConfig(props); Producer producer = new Producer (config); // StringProducerData data = new StringProducerData("demo"); for(int i=0;i<100;i++) { data.add("Hello world #"+i); } try { long start = System.currentTimeMillis(); for (int i = 0; i < 100; i++) { producer.send(data); } long cost = System.currentTimeMillis() - start; System.out.println("send message cost: "+cost+" ms"); } finally { producer.close(); } Full Producer code 23jafka mq

Full Consumer Code Properties props = new Properties(); props.put("zk.connect", "localhost:2181"); props.put("groupid", "test_group"); // ConsumerConfig consumerConfig = new ConsumerConfig(props); ConsumerConnector connector = Consumer.create(consumerConfig); // Map >> topicMessageStreams = connector.createMessageStreams(ImmutableMap.of("demo", 2), new StringDecoder()); List > streams = topicMessageStreams.get("demo"); // ExecutorService executor = Executors.newFixedThreadPool(2); final AtomicInteger count = new AtomicInteger(); for (final MessageStream stream : streams) { executor.submit(new Runnable() { public void run() { for (String message : stream) { System.out.println(count.incrementAndGet() + " => " + message); } }); } 24jafka mq

More Documents ● jafka mq25

Open source First Java open source in maven repository at groupId com.sohu. 26jafka mq

About me ● Ady Liu ● ● 27jafka mq