Slide 1

Slide 1 text

GILMOUR MICRO-SERVICE ARCHITECTURES USING

Slide 2

Slide 2 text

SOA (VS SERVERS) SERVICES ▸ Logical Entities ▸ Independent ▸ Comprised of more services ▸ Multiple servers for load and tolerance ▸ Scalability ▸ Flexibility

Slide 3

Slide 3 text

TO ERR IS HUMAN, TO BLAME IT ON SOMEONE IS MANAGEMENT POTENTIAL. - Someone on Internet WHY?

Slide 4

Slide 4 text

WHO DUN IT? WHY? ▸ Software Problem ▸ Function Point Scalability ▸ Management Problem ▸ Authority ▸ Responsibility.

Slide 5

Slide 5 text

DESIGN PATTERNS

Slide 6

Slide 6 text

ASYNC (SIGNALS & SLOTS)

Slide 7

Slide 7 text

ASYNC: SIGNALS AND SLOTS Slots Signal item.buy.500 item.buy.* item.buy.* item.buy.* group: push_msg FP scaling Push Message Server Push Message Server Web GILMOUR Email notifier SMS notifier Push Message server Item purchased VIP Item purchased item.buy.420

Slide 8

Slide 8 text

ASYNC: SLOTS func main() { redis := backends.MakeRedis("127.0.0.1:6379", "pass") g := G.Get(redis) g.Slot("example.log", func(req *G.Request, _ *G.Message) { var msg string req.Data(&msg) log.Println(req.Sender(), "->", msg) }, nil) g.Start() } line := "Filtering out stop words" g.Signal("example.log", G.NewMessage().SetData(line)) ASYNC: SIGNALS

Slide 9

Slide 9 text

REQUEST RESPONSE

Slide 10

Slide 10 text

REQUEST RESPONSE Caller Service Hello? Aloha! Wrong Number type Message struct { Data interface{} `json:"data"` //Actual Payload Code int `json:"code"` //Response code if this is a response. This uses HTTP error codes Sender string `json:"sender"` //Origin of the request (unique for each request) } SENDER_ID CODE

Slide 11

Slide 11 text

REQUEST data := G.NewMessage().SetData("hello?") opts := G.NewRequestOpts().SetTimeout(200) g.Request("echo", data, func(req *G.Request, resp *G.Message) { var msg string req.Data(&msg); fmt.Println("Echoclient: received", msg) }, opts) opts := G.NewHandlerOpts().SetGroup("exclusive") g.ReplyTo("echo", func(req *G.Request, resp *G.Message) { var msg string req.Data(&msg) resp.SetData(fmt.Sprintf("Pong %v", msg)) }, opts) RESPONSE

Slide 12

Slide 12 text

SIGNAL-SLOT VS. REQUEST-RESPONSE

Slide 13

Slide 13 text

ERRORS: DETECTION AND HANDLING

Slide 14

Slide 14 text

GILMOUR ERRORS ERROR DETECTION ▸ timeouts ▸ server side - execution timed out. ▸ client side - response too late ▸ confirm_subscribers

Slide 15

Slide 15 text

ERRORS: SIGNALS & SLOTS Web GILMOUR Email notifier SMS notifier Push message notifier Slots Error reporter Signal

Slide 16

Slide 16 text

GILMOUR ERRORS Caller Service Hello? Wrong Number SENDER_ID CODE Error reporter type gilmourError struct { topic string //topic to which the request was sent requestData string //request payload userData string //implementation dependent information sender string //sender from the request timestamp string //timestamp of error backtrace interface{} //backtrace of the error code int //response code (non-200) }

Slide 17

Slide 17 text

GILMOUR ERRORS ERROR HANDLING ▸ Ignore ▸ Publish ▸ Queue func main() { redis := backends.MakeRedis("127.0.0.1:6379", "pass") g := G.Get(redis) //g.SetErrorPolicy(protocol.ErrorPolicyQueue) //g.SetErrorPolicy(protocol.ErrorPolicyIgnore) g.SetErrorPolicy(protocol.ErrorPolicyPublish) }

Slide 18

Slide 18 text

GILMOUR ERRORS ERROR SAMPLE

Slide 19

Slide 19 text

OPS: MONITORING

Slide 20

Slide 20 text

OPS: MONITORING SERVERS ▸ Log forwarding & aggregation ▸ Error Reporting ▸ Server and Health Monitoring

Slide 21

Slide 21 text

OPS: MONITORING SERVICES ▸ Are the services servicing? ▸ Do services have spare capacity? ▸ Do services respond in time?

Slide 22

Slide 22 text

OPS: MONITORING HEALTH BULLETIN Feb 23 12:25:14 qa-next-backend-manager0.datascale.io gilmour_health: D, [2016-02-23T06:55:12.930435 #22111] DEBUG -- : Ensuring topics have at least one subscriber Feb 23 12:25:14 qa-next-backend-manager0.datascale.io gilmour_health: D, [2016-02-23T06:55:12.931160 #22111] DEBUG -- : Ensuring that gilmour servers respond to health ping Feb 23 12:26:14 qa-next-backend-manager0.datascale.io backend_manager: D, [2016-02-23T06:56:12.932775 #9605] DEBUG -- : Executing handler for gilmour.health.ip-10-0-0-146-pid-9605- uuid-9d0484dd-08e5-4ec3-a3e4-9a109634712b from 2881867d41f24228b462b9eff0b7e88e

Slide 23

Slide 23 text

OPS: MONITORING HEALTH BULLETIN

Slide 24

Slide 24 text

OPS: MONITORING HEALTH BULLETIN

Slide 25

Slide 25 text


 COMPOSITION

Slide 26

Slide 26 text

COMPOSITION ▸ compose - service1 | service2 | composition3 ▸ andand - service1 && service2 && composition3 ▸ oror - service1 || composition2 || service3 ▸ batch ▸ (service1; service2; service3) > out ▸ service1; composition2; service3 > out ▸ parallel

Slide 27

Slide 27 text

COMPOSITION popular := g.NewParallel( g.NewRequestComposition("example.popular3"), g.NewRequestComposition("example.popular4"), ) batch := g.NewPipe( g.NewRequestComposition("example.fetch"), g.NewRequestComposition("example.words"), g.NewRequestComposition("example.count"), popular, ) data := G.NewMessage() data.SetData("https://s3.amazonaws.com/ds-data-sample/test.txt") msg := <-batch.Execute(data)

Slide 28

Slide 28 text

COMPOSITION popular := g.NewParallel( g.NewRequestComposition("example.popular3"), g.NewRequestComposition(“example.popular4"), g.NewRequestComposition("example.popular5"), ) batch := g.NewPipe( g.NewRequestComposition("example.fetch"), g.NewRequestComposition("example.words"), g.NewRequestComposition("example.stopfilter"), g.NewRequestComposition("example.count"), popular, &MyComposer{}, ) 
 data := G.NewMessage() data.SetData("https://s3.amazonaws.com/ds-data-sample/test.txt") msg := <-batch.Execute(data)

Slide 29

Slide 29 text


 EXAMPLES

Slide 30

Slide 30 text

EXAMPLES: ECHO SERVERS & CLIENT

Slide 31

Slide 31 text

SAMPLE TEXT

Slide 32

Slide 32 text

EXAMPLES: COMPOSITION

Slide 33

Slide 33 text

GILMOUR RECAP ▸ Library only; no external process. ▸ No Load Balancer ▸ No Service Discovery ▸ Async - Signal, Slots ▸ Sync - Request, Reply ▸ Scaling - Exclusion groups. ▸ Error and Health Monitoring - HealthBulletin. ▸ Failure Detection ▸ Composition - Real micro-services. ▸ No message persistence.

Slide 34

Slide 34 text

GILMOUR CREDITS & LINKS ▸ Aditya Godbole ▸ [email protected] ▸ Datascale.IO ▸ datascale.io ▸ Repository ▸ github.com/gilmour-libs