service-oriented architecture

24
Service-oriented architecture @H2Russia internal workshop

Upload: shaliko-usubov

Post on 18-Jul-2015

335 views

Category:

Technology


1 download

TRANSCRIPT

Service-oriented architecture

@H2Russia internal workshop

Monolithic Rails applications

End user

Domain logic

Database

Issues monolithic applications

• Complexity

• Hard deploy

• Hard use new tools (DB, languages, etc.)

• Scale team size

• Changes are typically expensive

What is it SOA?

• A modular style to software development is based on the use of distributed, loosely coupled, replaceable components.

• The fundamental concept of an SOA is that each component of the system is broken up into network-accessible services, which are integrated to make a functioning application.

Rails application with multiple services

End user

High level domain logic

Service 1

Domain logic

Database

Service 2

Domain logic

Database

Service N

Domain logic

Database

Service-Oriented Design with Ruby

SOA advantages over monolithic application

• Isolation

• Robustness

• Scalability

• Agility

• Interoperability

• Reuse

Isolation

• Object-oriented design

• Business logic

• System Isolation

Robustness

• Implementation can be changed without the API consumer’s knowledge.

• Example: Changing libraries, database or even languages.

Scalability

• Easy to scale portions of application individually.

• Can be handled on a case-by-case instead of requiring optimization of a single database for all cases.

• Easier to scale team size.

Agility

• New services can be implemented outside the full architecture.

• Service interface should be versioned. “/api/v1/users/:id”

• Design includes the ability to run multiple versions of a service simultaneously. “/api/v1/users/:id” and “/api/v2/users/:id”

Interoperability

• Prevents being tied to a specific implementation.

• Services ease interoperation with internal and external systems and with systems written in languages other than Ruby.

Reuse

• Service-oriented design enables reuse of components across multiple applications or clients.

• If services are created for internal use, they can be exposed later to the public.

Converting to Services

• Partitioning on Iteration Speed

• Partitioning on Logical Function

• Partitioning on Read/Write Frequencies

• Partitioning on Join Frequency

What we need to learn

• RESTful-Oriented Architecture

• HTTP Methods

• HTTP Caching

• MIME types

• I/O, Threading, and Parallelism

• Amazon AWS

• Create clients

• Testing and Mocking Service Calls

• Load Balancing

• Security

• Web Hooks

• Chef

• Typhoeus

Load Balancing

• Weighted Balance

• Round-Robin

• Least-Connections

• URI-Based

• Priority

• Lowest Latency

Caching

• HTTP cache (cache-control, ETag, last-modified, expires)

• Memcached

• Squid and Varnish

Debug

• Efficiency 2.0 Ops Middleware - track distributed transactions across its Ruby-based service oriented architecture

• Monitoring tool.

Development

• Use stub mode in clients in development environment.

• Disable stub mode when develop service.

Tests

• Test client with service

• Test application with stubbed service

• Test the full stack