soa doing right

33
SOA DOING RIGHT

Upload: cake-labs

Post on 12-Jan-2017

1.449 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: SOA Doing Right

SOA DOING RIGHT

Page 2: SOA Doing Right

Microservices

the trendy BUZZword

Page 3: SOA Doing Right

WTC

• ONE electricity supply

• ONE water supply• ONE elevator

Page 4: SOA Doing Right

Monolithic Architecture

• Single SW application with ALL functionalities implemented/deployed

• Each floor a dedicate service (HR, Marketing ++) • Monolithic SOA

• Coarse-grained (depend on others. Eg. Shipping service waiting for approval from Admin service)

• Wider scope (manages many business cases)• Complex message formats

Monolithic Architecture : Layered Architecture

Page 5: SOA Doing Right

Monolithic Architecture

Shipping : API Logic Dao

Page 6: SOA Doing Right

98 Acres

• OWN refrigerator• OWN water supply• OWN power

generator• Tiny bit services are

bundled

CAN function INDEPENDANTLY

Page 7: SOA Doing Right

Microservices Architecture

Online retail store : ebay

Page 8: SOA Doing Right

Microservices

• Microservice • Develop single application• Fine-grained manner• Independent of other services• Deploy independently

• Misconceptions• Line of Codes• “Micro” (how small it is :O)• Team Size

Page 9: SOA Doing Right

Design Consideration

• Single Responsibility Principle(SRP) : limited and focused business scope. (IMPORTANT : righted sized services)

• Service boundaries + business capabilities

• Microservices = few Operations/Functionalities, simple Message Formats

• Evolving process – Micro service might decomposed into future.

Page 10: SOA Doing Right

Messaging in Microservices

• Monolithic Architecture• Function calls/ Language level methods• SOA : SOAP, WS* with HTTP, JMS ++• ESB

• Micro Services• Simple• Light weight• ESB Killer

Page 11: SOA Doing Right

Messaging in Microservices

• Synchronous Messaging• Client waits for response from service• REST, Thrift

• Async Messaging• NO or least expect a response• Light weight• AMQP, MQTT, STOMP

Page 12: SOA Doing Right

Integrating Microservices

• ESB Killer• Monolithic SOA – client connections are forward to different APIs• Microservices do not use ESB (different wiring mechanism)

• Microservices• Smart Endpoints – Moves business logic to services and clients• Dumb pipes – To connect services

Page 13: SOA Doing Right

Integrating Microservices

• Point to Point – Invoke service directly

Page 14: SOA Doing Right

Integrating Microservices

• API Gate-Way style

Page 15: SOA Doing Right

Integrating Microservices

• Message Broker style

Micro service can publish it’s service, as well as subscribe to services of others

Page 16: SOA Doing Right

Deployment & Orchestration

• Each MS – deploy as separate Docker(to deploy services) image

• Scaling - # of containers• Early days – minor change in

one, deploy total• Kubernetes - #Google

(Stratos)• Orchestration

Page 17: SOA Doing Right

Security & Governance

Page 18: SOA Doing Right

Pulse Security

• Salesforce Authorization• Federated authorization• OAuth

• Pulse Agent• Which POS Device

Page 19: SOA Doing Right

Microservices Security

• Central user repository store• OAuth 2.0

• Authorization• Token Sharing

• OpenId Connect• Authentication• OAuth + ID token (user info)

Page 20: SOA Doing Right

Daham

Page 21: SOA Doing Right

Asynchronous Processingin

Asynchronous Language

Page 22: SOA Doing Right

Is Node.js Really Single Threaded?

Page 23: SOA Doing Right

Is Node Actually Single Threaded?

Page 24: SOA Doing Right

Possible Task Strategies

• Possible Task Strategies

• Foreground (In-line)

• Parallel

• Local Messages (Forking)

• Queues

Page 25: SOA Doing Right

Foreground (in-line)

caterRequest (req, res, next) {  doTask(function(err, data) {       if (err) {           return res.send(‘fail');       } else {           return res.send(’success');       }   });}

Page 26: SOA Doing Right

Foreground (in-line)

• Good side

• Gives chance to other requests.

• Bad Side

• Using server resources to other tasks (e.g. email sending, AWS calls)

• Timeout to client for partially success.

Page 27: SOA Doing Right

Parallel

caterRequest(req, res, next) {

  doTask(function(err, data) {

   

   });

return res.send(’success');

}

Just ignore the callback

Page 28: SOA Doing Right

Parallel

• Good side

• Very fast.

• No extra codes needed for thread life cycle manipulation.

• Bad Side

• 0 callbacks 0 data. No idea about what happened.

Page 29: SOA Doing Right

Local Messages (Forking)

Page 30: SOA Doing Right

Local Messages (Forking)

• Good side

• Web server process is completely independent of task process.(i.e. email sender , AWS caller)

• Error handling, throttling and retrying can be achieved.

• Bad Side

• Only suitable for single host environment.

Page 31: SOA Doing Right

Queues

Page 32: SOA Doing Right

Queues

Page 33: SOA Doing Right

Advantages of Queues

• Decoupling work producers and work consumers

• Making retry logic easier to implement

• Distributing work load throughout time

• Distributing work load throughout space (nodes)

• Making asynchronous work

• Making external systems easier to integrate