Top Banner
Job Queue in B2B with Akka long version Yasuki Okumura
18

Job queue in b2b with Akka

Nov 27, 2014

Download

Software

Yasuki Okumura

Job queue in b2b with Akka
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Job queue in b2b with Akka

Job Queue in B2Bwith Akka

long versionYasuki Okumura

Page 2: Job queue in b2b with Akka

● Shanon, Inc. - Marketing company

● Scala developer for 2 years

twitter: @busterdayogithub: https://github.com/buster84

About me

Page 3: Job queue in b2b with Akka

Shanon hiring Scala developers

Page 4: Job queue in b2b with Akka

● Job Queueing manager● https://github.com/Shanon/Malba

Malba

Page 5: Job queue in b2b with Akka

● Most problematic thing in B2B is job order.● Most of B2B service cases, normal FIFO or

priority Queue don’t fit their business model.

● We need our own Custom Queue.

Motivation

Page 6: Job queue in b2b with Akka

Example - Email service

1. A attempt to send 100,000 emails.2. B attempt to send 100 emails.

Does B have to wait until finishing to send 100,000 emails?

Page 7: Job queue in b2b with Akka

Balancing Queue

A’s 100,000 emails

FIFO

B’s 100 emails

1

32

4

100,001

100,100

Balancing Queue

1 2

100,100

200

4

199

3

Page 8: Job queue in b2b with Akka

● Breadth-first search -> FIFO Queue● Depth-first search -> FILO Queue● A* search -> Priority Queue

Inspired by Graph search

What makes difference among the algorithms is Queue.

Page 9: Job queue in b2b with Akka

● Premium users can send mails faster than normal users.

● It is guaranteed that sending less than 1,000 mails finish in 1 hour.

Other cases

Page 10: Job queue in b2b with Akka

How we use

Page 11: Job queue in b2b with Akka

1. AddTaskhttps://github.com/Shanon/Malba/blob/master/Malba-protocol/src/main/scala/jp/co/shanon/malba/worker/MalbaProtcol.scala#L9-L17

2. AddWorkerhttps://github.com/Shanon/Malba/blob/master/Malba-

protocol/src/main/scala/jp/co/shanon/malba/worker/MalbaProtcol.scala#L151-L158

3. GetTaskhttps://github.com/Shanon/Malba/blob/master/Malba-protocol/src/main/scala/jp/co/shanon/malba/worker/MalbaProtcol.scala#L56-L63

Structure + Protocol

Page 12: Job queue in b2b with Akka
Page 13: Job queue in b2b with Akka
Page 14: Job queue in b2b with Akka
Page 15: Job queue in b2b with Akka

Demo

Page 17: Job queue in b2b with Akka

● CI environment● Make and Publish Packages● Support HTTP● Tests● Documents● Take snapshots● GUI - using PersistentView

TODO

Page 18: Job queue in b2b with Akka

We welcome your PR or comments.https://github.com/Shanon/Malba

Thank you