SlideShare a Scribd company logo
rails services in the walled
           garden
niranjan paranjape

achamian         @niranjan_p
sidu ponnappa

kaiwren        @ponnappa
Engineering

http://github.com/c42
background
suite of 9+ services
replacing a monolithic
     legacy app
moar APIs
rails + SOA + walled garden
assumptions
structure
why SOA?
advantages!
map to biz verticals
self contained
independent evolution
independent deployment
scale out only what is in
        demand
easy to maintain
smaller, independent
     codebases
small teams
disadvantages?
chattiness
performance!
transparent
authentication
     and/or
 authorization
ACID
API versioning
continuous integration
why rails?
easy to create APIs
powerful routing
mime-type negotiation
less boilerplate code
we love Ruby
what about sinatra & co.?
walled garden?
inside the garden is easy(er)
full HATEOAS is expensive
rails does RMM 2(.5)
rails != REST
areas of interest
authentication
across services
transparent service
   orchestration
stateless
no cookies
firewall
central auth service
OAuth 2
OAuth 2?
standard
easy to implement
sample client
https://github.com/c42/wrest/tree/master/examples/facebook_auth
ActiveResource
ActiveResource

       +
monkey patching
all gardens have a gate
external auth providers
authorization
user roles
roles over HTTP
authorization at service level
centralized rules
messy, fragmented
each service is independent
solution?
centralized roles
 federated rules
chattiness
Client   Service 1   Service 2




           Auth
          Server
Client   Service 1   Service 2




           Auth
          Server
Client   Service 1   Service 2




           Auth
          Server
Client   Service 1   Service 2




           Auth
          Server
Client   Service 1   Service 2




           Auth
          Server
no silver bullet
performance build
GET request ≈ 40ms
monitor trends
smaller payloads
common-sense
caching
HTTP 304 is your friend
fragment/action caching
page caching
etags
client side caching
     RFC 2616
ActiveResource
Wrest
http://github.com/c42/wrest
covering the middle
cache expiry
expiring Squid caches
pagination
default index action:
ActiveRecord::Base.all
50k records?
pagination is important
pagination meta-data
     locations:
HTTP headers
XML tag attributes
collection resources
ActiveResource
ActiveResource
       +
 WillPaginate
PoxPaginate
http://github.com/c42/pox_paginate
local resources
user management service


Companies
 user   user   user   user


 user   user   user   user
project management service


 project 1      project 2
  user 1         user 1


 project 3      project 3
  user 2         user 2
all projects for a company
database join
http + database “in”
shared database
read only connection to db
shared database connection

       master slave
immediate consistency
easy to implement
problems
integrating services at
    database level
broken encapsulation
computed fields
assumes 1:1 mapping
between db records and
      resources
exposes internal
representations
datastore
observer pattern
post logout event
User
Management                 Time and
  Service                  Expenses
                           Tracking
                            Service




          Project       Internal
        Management   Communication
          Service       Service
callback URIs
callback hell
complex configuration
response time
async callbacks
MQ
centralized bus
register listeners
async out of the box
convention
    over
configuration
local resource cache
it’s in the db
it makes joins cheap
but...
it’s a cache
not realtime
listen to update/delete
API versioning
partially solved
in a walled garden
atomic transactions
two phase commit
offline
engineering
standardization
treat common code like any
        other library
api vs html
configuration management
DON’T commit configuration
let Chef/Puppet manage it
that’s it!
Q & 42
Niranjan Paranjape        Sidu Ponnappa

   @niranjan_p             @ponnappa

github: achamian          github: kaiwren


           C42 Engineering

More Related Content

What's hot

Kubernetes as Infrastructure Abstraction
Kubernetes as Infrastructure AbstractionKubernetes as Infrastructure Abstraction
Kubernetes as Infrastructure Abstraction
Kublr
 
Large scale stream processing with Apache Flink
Large scale stream processing with Apache FlinkLarge scale stream processing with Apache Flink
Large scale stream processing with Apache Flink
Nikolay Stoitsev
 
Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...
Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...
Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...
HostedbyConfluent
 
Technology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data CaptureTechnology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data Capture
Andrew Schofield
 
Application Portability with Kubernetes (k8)
Application Portability with Kubernetes (k8)Application Portability with Kubernetes (k8)
Application Portability with Kubernetes (k8)
Kublr
 
Kubernetes data science and machine learning
Kubernetes data science and machine learningKubernetes data science and machine learning
Kubernetes data science and machine learning
Kublr
 
Connecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL EndpointsConnecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL Endpoints
Julien Bataillé
 
Managing microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupManaging microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - Meetup
José Román Martín Gil
 
Centralizing Kubernetes Management in Restrictive Environments
Centralizing Kubernetes Management in Restrictive EnvironmentsCentralizing Kubernetes Management in Restrictive Environments
Centralizing Kubernetes Management in Restrictive Environments
Kublr
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
Guido Schmutz
 
Die große Cloud-native FaaS-Hitparade
Die große Cloud-native FaaS-HitparadeDie große Cloud-native FaaS-Hitparade
Die große Cloud-native FaaS-Hitparade
QAware GmbH
 
Scaling a backend for a big data and blockchain environment by Rafael Ríos at...
Scaling a backend for a big data and blockchain environment by Rafael Ríos at...Scaling a backend for a big data and blockchain environment by Rafael Ríos at...
Scaling a backend for a big data and blockchain environment by Rafael Ríos at...
Big Data Spain
 
Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021
Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021
Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021
StreamNative
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
Redis Labs
 
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
confluent
 
Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)
Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)
Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)
Chris Bolman
 
JCConf 2020 Observing in Microservices
JCConf 2020 Observing in MicroservicesJCConf 2020 Observing in Microservices
JCConf 2020 Observing in Microservices
Matt Ho
 
How to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thriveHow to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thrive
Natan Silnitsky
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
Joe Stein
 
Kubernetes & the 12 factor cloud apps
Kubernetes & the 12 factor cloud appsKubernetes & the 12 factor cloud apps
Kubernetes & the 12 factor cloud apps
Ana-Maria Mihalceanu
 

What's hot (20)

Kubernetes as Infrastructure Abstraction
Kubernetes as Infrastructure AbstractionKubernetes as Infrastructure Abstraction
Kubernetes as Infrastructure Abstraction
 
Large scale stream processing with Apache Flink
Large scale stream processing with Apache FlinkLarge scale stream processing with Apache Flink
Large scale stream processing with Apache Flink
 
Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...
Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...
Writing Blazing Fast, and Production-Ready Kafka Streams apps in less than 30...
 
Technology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data CaptureTechnology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data Capture
 
Application Portability with Kubernetes (k8)
Application Portability with Kubernetes (k8)Application Portability with Kubernetes (k8)
Application Portability with Kubernetes (k8)
 
Kubernetes data science and machine learning
Kubernetes data science and machine learningKubernetes data science and machine learning
Kubernetes data science and machine learning
 
Connecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL EndpointsConnecting the Dots: Kong for GraphQL Endpoints
Connecting the Dots: Kong for GraphQL Endpoints
 
Managing microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - MeetupManaging microservices with istio on OpenShift - Meetup
Managing microservices with istio on OpenShift - Meetup
 
Centralizing Kubernetes Management in Restrictive Environments
Centralizing Kubernetes Management in Restrictive EnvironmentsCentralizing Kubernetes Management in Restrictive Environments
Centralizing Kubernetes Management in Restrictive Environments
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
 
Die große Cloud-native FaaS-Hitparade
Die große Cloud-native FaaS-HitparadeDie große Cloud-native FaaS-Hitparade
Die große Cloud-native FaaS-Hitparade
 
Scaling a backend for a big data and blockchain environment by Rafael Ríos at...
Scaling a backend for a big data and blockchain environment by Rafael Ríos at...Scaling a backend for a big data and blockchain environment by Rafael Ríos at...
Scaling a backend for a big data and blockchain environment by Rafael Ríos at...
 
Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021
Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021
Function Mesh: Complex Streaming Jobs Made Simple - Pulsar Summit NA 2021
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
 
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
Using Location Data to Showcase Keys, Windows, and Joins in Kafka Streams DSL...
 
Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)
Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)
Timelines at Scale (Raffi Krikorian - VP of Engineering at Twitter)
 
JCConf 2020 Observing in Microservices
JCConf 2020 Observing in MicroservicesJCConf 2020 Observing in Microservices
JCConf 2020 Observing in Microservices
 
How to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thriveHow to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thrive
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
 
Kubernetes & the 12 factor cloud apps
Kubernetes & the 12 factor cloud appsKubernetes & the 12 factor cloud apps
Kubernetes & the 12 factor cloud apps
 

Viewers also liked

October 2015 presentation ii
October 2015 presentation iiOctober 2015 presentation ii
October 2015 presentation ii
Robert Proctor
 
MANIFESTO PARTIDO COMUNISTA
MANIFESTO PARTIDO COMUNISTAMANIFESTO PARTIDO COMUNISTA
MANIFESTO PARTIDO COMUNISTA
SoproLeve
 
Supercomputing Your Inner Microbiome
Supercomputing Your Inner MicrobiomeSupercomputing Your Inner Microbiome
Supercomputing Your Inner Microbiome
Larry Smarr
 
к уроку 20
к уроку 20к уроку 20
к уроку 20
moiaav
 
Understanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解する
Understanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解するUnderstanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解する
Understanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解する
COCOJUKU plus
 
к уроку 5
к уроку 5к уроку 5
к уроку 5
moiaav
 
софронова марина (г.сергач)
софронова марина (г.сергач)софронова марина (г.сергач)
софронова марина (г.сергач)
relikvija
 
галимова саадат (башкирия)
галимова саадат (башкирия)галимова саадат (башкирия)
галимова саадат (башкирия)
relikvija
 
Teoría de Dios
Teoría de DiosTeoría de Dios
Teoría de Dios
Yuri Serbolov
 
What does it mean to be an open book? Digiday Agency Summit, March 2017
What does it mean to be an open book? Digiday Agency Summit, March 2017What does it mean to be an open book? Digiday Agency Summit, March 2017
What does it mean to be an open book? Digiday Agency Summit, March 2017
Digiday
 
DPSE Michelle Raubenheimer 2.22.17
DPSE Michelle Raubenheimer 2.22.17DPSE Michelle Raubenheimer 2.22.17
DPSE Michelle Raubenheimer 2.22.17
Digiday
 
к уроку 8
к уроку 8к уроку 8
к уроку 8
moiaav
 
презентация
презентацияпрезентация
презентация
moiaav
 
писатели и поэты_пензенского_края
писатели и поэты_пензенского_краяписатели и поэты_пензенского_края
писатели и поэты_пензенского_края
moiaav
 
к уроку 6
к уроку 6к уроку 6
к уроку 6
moiaav
 
к уроку 9
к уроку 9к уроку 9
к уроку 9
moiaav
 
Concierto
ConciertoConcierto
Concierto
laulolis
 
Satio手机
Satio手机Satio手机
Satio手机Liu Xing
 
Innovation Equations
Innovation EquationsInnovation Equations
Innovation Equations
Ben Ullman
 

Viewers also liked (20)

October 2015 presentation ii
October 2015 presentation iiOctober 2015 presentation ii
October 2015 presentation ii
 
MANIFESTO PARTIDO COMUNISTA
MANIFESTO PARTIDO COMUNISTAMANIFESTO PARTIDO COMUNISTA
MANIFESTO PARTIDO COMUNISTA
 
Física cuántica
Física cuánticaFísica cuántica
Física cuántica
 
Supercomputing Your Inner Microbiome
Supercomputing Your Inner MicrobiomeSupercomputing Your Inner Microbiome
Supercomputing Your Inner Microbiome
 
к уроку 20
к уроку 20к уроку 20
к уроку 20
 
Understanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解する
Understanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解するUnderstanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解する
Understanding the Topic and Main Idea of Readings - 文章のトピックと主旨を理解する
 
к уроку 5
к уроку 5к уроку 5
к уроку 5
 
софронова марина (г.сергач)
софронова марина (г.сергач)софронова марина (г.сергач)
софронова марина (г.сергач)
 
галимова саадат (башкирия)
галимова саадат (башкирия)галимова саадат (башкирия)
галимова саадат (башкирия)
 
Teoría de Dios
Teoría de DiosTeoría de Dios
Teoría de Dios
 
What does it mean to be an open book? Digiday Agency Summit, March 2017
What does it mean to be an open book? Digiday Agency Summit, March 2017What does it mean to be an open book? Digiday Agency Summit, March 2017
What does it mean to be an open book? Digiday Agency Summit, March 2017
 
DPSE Michelle Raubenheimer 2.22.17
DPSE Michelle Raubenheimer 2.22.17DPSE Michelle Raubenheimer 2.22.17
DPSE Michelle Raubenheimer 2.22.17
 
к уроку 8
к уроку 8к уроку 8
к уроку 8
 
презентация
презентацияпрезентация
презентация
 
писатели и поэты_пензенского_края
писатели и поэты_пензенского_краяписатели и поэты_пензенского_края
писатели и поэты_пензенского_края
 
к уроку 6
к уроку 6к уроку 6
к уроку 6
 
к уроку 9
к уроку 9к уроку 9
к уроку 9
 
Concierto
ConciertoConcierto
Concierto
 
Satio手机
Satio手机Satio手机
Satio手机
 
Innovation Equations
Innovation EquationsInnovation Equations
Innovation Equations
 

Similar to Rails services in the walled garden

I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystemI can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
Sidu Ponnappa
 
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LMESet your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
confluent
 
Introducing Kafka's Streams API
Introducing Kafka's Streams APIIntroducing Kafka's Streams API
Introducing Kafka's Streams API
confluent
 
apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...
apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...
apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...
apidays
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
Guido Schmutz
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and Then
SATOSHI TAGOMORI
 
apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...
apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...
apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...
apidays
 
What is Apache Kafka and What is an Event Streaming Platform?
What is Apache Kafka and What is an Event Streaming Platform?What is Apache Kafka and What is an Event Streaming Platform?
What is Apache Kafka and What is an Event Streaming Platform?
confluent
 
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
apidays
 
The Role of Integration in Microservice Architecture (MSA)
The Role of Integration in Microservice Architecture (MSA)The Role of Integration in Microservice Architecture (MSA)
The Role of Integration in Microservice Architecture (MSA)
Asanka Abeysinghe
 
Introduction to hazelcast
Introduction to hazelcastIntroduction to hazelcast
Introduction to hazelcast
Emin Demirci
 
data Artisans Product Announcement
data Artisans Product Announcementdata Artisans Product Announcement
data Artisans Product Announcement
Flink Forward
 
Apache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & Partitioning
Apache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & PartitioningApache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & Partitioning
Apache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & Partitioning
Guido Schmutz
 
Openshift serverless Solution
Openshift serverless SolutionOpenshift serverless Solution
Openshift serverless Solution
Ryan ZhangCheng
 
Stateful Interaction In Serverless Architecture With Redis: Pyounguk Cho
Stateful Interaction In Serverless Architecture With Redis: Pyounguk ChoStateful Interaction In Serverless Architecture With Redis: Pyounguk Cho
Stateful Interaction In Serverless Architecture With Redis: Pyounguk Cho
Redis Labs
 
Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...
Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...
Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...
InfluxData
 
Using FLiP with influxdb for EdgeAI IoT at Scale
Using FLiP with influxdb for EdgeAI IoT at ScaleUsing FLiP with influxdb for EdgeAI IoT at Scale
Using FLiP with influxdb for EdgeAI IoT at Scale
Timothy Spann
 
Au delà des brokers, un tour de l’environnement Kafka | Florent Ramière
Au delà des brokers, un tour de l’environnement Kafka | Florent RamièreAu delà des brokers, un tour de l’environnement Kafka | Florent Ramière
Au delà des brokers, un tour de l’environnement Kafka | Florent Ramière
confluent
 
Concepts and Patterns for Streaming Services with Kafka
Concepts and Patterns for Streaming Services with KafkaConcepts and Patterns for Streaming Services with Kafka
Concepts and Patterns for Streaming Services with Kafka
QAware GmbH
 
"Wie passen Serverless & Autonomous zusammen?"
"Wie passen Serverless & Autonomous zusammen?""Wie passen Serverless & Autonomous zusammen?"
"Wie passen Serverless & Autonomous zusammen?"
Volker Linz
 

Similar to Rails services in the walled garden (20)

I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystemI can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
 
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LMESet your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
 
Introducing Kafka's Streams API
Introducing Kafka's Streams APIIntroducing Kafka's Streams API
Introducing Kafka's Streams API
 
apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...
apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...
apidays LIVE Jakarta - REST the events: REST APIs for Event-Driven Architectu...
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and Then
 
apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...
apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...
apidays LIVE Singapore 2021 - REST the Events - REST APIs for Event-Driven Ar...
 
What is Apache Kafka and What is an Event Streaming Platform?
What is Apache Kafka and What is an Event Streaming Platform?What is Apache Kafka and What is an Event Streaming Platform?
What is Apache Kafka and What is an Event Streaming Platform?
 
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
 
The Role of Integration in Microservice Architecture (MSA)
The Role of Integration in Microservice Architecture (MSA)The Role of Integration in Microservice Architecture (MSA)
The Role of Integration in Microservice Architecture (MSA)
 
Introduction to hazelcast
Introduction to hazelcastIntroduction to hazelcast
Introduction to hazelcast
 
data Artisans Product Announcement
data Artisans Product Announcementdata Artisans Product Announcement
data Artisans Product Announcement
 
Apache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & Partitioning
Apache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & PartitioningApache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & Partitioning
Apache Kafka - Event Sourcing, Monitoring, Librdkafka, Scaling & Partitioning
 
Openshift serverless Solution
Openshift serverless SolutionOpenshift serverless Solution
Openshift serverless Solution
 
Stateful Interaction In Serverless Architecture With Redis: Pyounguk Cho
Stateful Interaction In Serverless Architecture With Redis: Pyounguk ChoStateful Interaction In Serverless Architecture With Redis: Pyounguk Cho
Stateful Interaction In Serverless Architecture With Redis: Pyounguk Cho
 
Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...
Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...
Timothy Spann [StreamNative] | Using FLaNK with InfluxDB for EdgeAI IoT at Sc...
 
Using FLiP with influxdb for EdgeAI IoT at Scale
Using FLiP with influxdb for EdgeAI IoT at ScaleUsing FLiP with influxdb for EdgeAI IoT at Scale
Using FLiP with influxdb for EdgeAI IoT at Scale
 
Au delà des brokers, un tour de l’environnement Kafka | Florent Ramière
Au delà des brokers, un tour de l’environnement Kafka | Florent RamièreAu delà des brokers, un tour de l’environnement Kafka | Florent Ramière
Au delà des brokers, un tour de l’environnement Kafka | Florent Ramière
 
Concepts and Patterns for Streaming Services with Kafka
Concepts and Patterns for Streaming Services with KafkaConcepts and Patterns for Streaming Services with Kafka
Concepts and Patterns for Streaming Services with Kafka
 
"Wie passen Serverless & Autonomous zusammen?"
"Wie passen Serverless & Autonomous zusammen?""Wie passen Serverless & Autonomous zusammen?"
"Wie passen Serverless & Autonomous zusammen?"
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 

Rails services in the walled garden

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. This talk is based primarily on our experience building a suite of 9 different RESTful web services and multiple clients to manage a data center. \n
  7. These services were build to replace a monolithic app which had become a maintenance nightmare. Adding any new features to the app was painful and time consuming.\n
  8. We’ve subsequently worked on other projects that involved building APIs, but the first remains the biggest\n
  9. Let us quickly cover tour the two parts of our talk - SOA, and Rails.\n
  10. \n
  11. \n
  12. \n
  13. Service Oriented Architectures allow applications be split into several self-contained services\n
  14. along lines that match the different business verticals involved. Each such service should be usable by itself by the people of that vertical. While they provide APIs for other services to integrate in order to create organization wide workflows. \n
  15. Being focused on a business vertical helps in limiting the ripple effects caused by changes in a business requirement for a particular app as long as the API remains stable. This makes a significant difference while building complex workflows which are specific to that vertical because you no longer worry about other business verticals that you may not understand or care about. So long as your API is stable, you’re fine.\n\n
  16. This allows Independent evolution of the each service based on the needs of the corresponding vertical\n\n
  17. Services can be deployed independently - so long as APIs are respected, teams no longer need to wait on other teams to release.\n
  18. Only those services which see high traffic need to be scaled out\n
  19. \n
  20. \n
  21. Having multiple small teams working independently on separate code bases is munch better than having one big team with everyone modifying the same codebase, smoothing out both development and deployment as you have to remember significant portion of the entire app (if not whole) while incorporating change requests.\n
  22. While the list continues there are a few nuances which you should pay attention to \n
  23. Services like to talk to other services, and the graph of HTTP requests can grow very quickly. This can potentially lead to...\n
  24. ...performance bottlenecks. Every call to a service comes with all the overhead introduced by both HTTP as well as the framework.\n
  25. Managing user base across all services and granting them appropriate privileges.\n
  26. Managing ACID (Atomic, Consistent, Isolated, Durable) transactions across distributed databases is complex, even more so with distributed services.\n
  27. This comes up in almost every discussion about building APIs. While it is important, in a walled garden impact of API versioning can be curtailed as you control both producer and consumer \n
  28. continuous integration of APIs is a difficult business at best, with no existing open source infrastructure to solve this for us\n
  29. These problems are generic in nature and are common to any RESTful web services not just Rails and hence most of the gotchas we’ll discuss are generic in nature, while the solutions may be more specific to Rails. But even before we go there, why should we develop these APIs in Rails?\n
  30. Rails lends itself well to creating synchronous APIs.\n
  31. \n
  32. Rails supports transparent format negotiation using url or Accepts header and provides a mechanism to register custom formats\n
  33. \n
  34. It is a pleasure to write well engineered backend code in Ruby\n
  35. It doesn’t mater whether we are using Rails or Sinatra or any other web framework. While beautiful APIs can be built using sinatra. \n
  36. Walled garden signifies that we control both producers and consumers. Which allows us to establish conventions and potentially loosen the constraints.\n
  37. \n
  38. \n
  39. Based on what’s demanded of the APIs and how much time/money is available you can decide where to stop, RMM 2.5 is fairly easily done with Rails.\n
  40. As you might have noticed we have talking about SOA and not REST all this while. Because creating standard Rails web services does not necessarily mean creating RESTful web services.\n\nWe’ll try to be careful about this during the course of this talk, but it’s worth remembering that much of what we are talking about involves building APIs with Rails *as it is today*. This means that RMM 3 cannot be achieved without significant effort, effort that is often unnecessary inside an enterprise.\n
  41. \n
  42. Often you want to restrict access to various APIs you are building to limited set of users, even if they are internal services.\n
  43. This authentication should needs to span across multiple services in order to support SSO\n
  44. It needs to allow user to access multiple services behind the scene to manage a workflow which spans across multiple services \n
  45. \n
  46. \n
  47. Simplest way to achieve it is by restricting access to these services from a range of IPs and allowing all internal communication\n
  48. This will work as long as it doesn’t matter who within the organization is accessing the services, which is rarely the case. Next logical step is to create a centralized auth server which can be backed by any of the existing data sources such as LDAP or Active Directory\n
  49. \n
  50. \n
  51. \n
  52. OAuth2 provides a simple way to authenticate users against a centralized authentication system. There are multiple implementations of open-source OAuth2 provider. You can chose any of these providers and tweak it to suit specific requirements you might have.\n
  53. OAuth2 provides a simple way to authenticate users against a centralized authentication system. There are multiple implementations of open-source OAuth2 provider. You can chose any of these providers and tweak it to suit specific requirements you might have.\n
  54. \n
  55. \n
  56. With a decent HTTP library, an OAuth2 client can be hand-rolled in 30 minutes\n
  57. There’s an interesting catch though. ActiveResource doesn’t allow custom headers for individual request to a server out of the box and OAuth2 operates on information passed through headers.\n
  58. Which means, unless you are willing to open ActiveResource and monkey patch to set authentication information on every outbound request you might want to reconsider OAuth2, or (better yet) skip ActiveResource in favour of a friendlier library\n
  59. \n
  60. If you become an OAuth2 provider, it will be easier to provide authentication using any of the external OAuth2 providers such as Google, Twitter, Facebook.\n
  61. So now we are restricting access to our services, the next step would be to determine who can do what with these services. Two broad levels at which we might want to control the access are\n
  62. Both these areas can easily be tackled with a role based system. There are plenty of gems which allow you specify access rules.\n
  63. If we have pulled out a central authentication server it will be better to manage the user roles centrally. We can query the central server to figure out what roles user has in a context of a service.\n
  64. But let every service manage it’s own access rules based on the roles returned by the user service. It can become messy to manage the authorization across all services in a central server as every service can have custom set of rules which are tied to the data. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. Services like to talk a lot. Specifically among themselves. This can become a significant overhead. Consider following scenario with two services\n
  71. \n
  72. \n
  73. \n
  74. \n
  75. The request graph can go wild with more services thrown into the mix. While it is difficult to reduce the chattiness between services it’s impact can be reduced. \n
  76. \n
  77. It is essential to setup a performance build early in the project and track the graph as services grow in number and complexity\n
  78. Set a target for the performance. Say average GET request should not be more than 40ms.\n
  79. \n
  80. There are going to be a lot of HTTP calls with small response payload. So you might want to optimize for it.\n
  81. \n
  82. \n
  83. To reduce the time taken to serve a frequently queried and time consuming requests, we can introduce various kinds of server side caching\n
  84. Fragment or action caching can be used for optimizing response time for resources which need authorized access\n
  85. For resources publicly available page caching can be used to avoid the Rails stack entirely\n
  86. Etags can be used effectively to check if a requested resource is modified or not. The catch here is that the client has to implement caching and respect etags\n
  87. If possible you should use a client which supports client side caching. So far we haven’t come across any client which does it and started an open sources project to build one. It ended up as a Ruby Net/HTTP wrapper which implements RFC 2616.\n
  88. If you are using ActiveResource as a client, it will be difficult to achieve without monkey patching ActiveResource as it neither supports caching nor exposes request/response objects\n
  89. With any such library and ActiveModel it is possible to quickly hand-roll a simple client. It might not have lot of things ActiveResource supports out of the box, but those features can be introduced as and when needed.\n
  90. Check out Varnish or Squid to introduce caching between services.\n
  91. Introducing caching adds an overhead of figuring out when and how to expire the caches.\n
  92. Expiring caches under applications control is far more easier than expiring caches maintained by Squid or Varnish.\n
  93. Pagination of resources requires some meta data along with the array of resources such as total number of available resources, number of resources included in each page. It can be achieved by either exposing a collection resource or adding additional attributes to the root node of the array xml. The latter is a better fit for ActiveResource.\n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. If you’re using ActiveResource, what you really need is something like WillPaginate. Luckily, it so happens that we have just the thing...\n
  104. \n
  105. So far we have been talking about caching HTTP responses between services. In certain scenarios it becomes essential to have a local cache of the resources. Let’s consider following scenario\n
  106. We have a user management service which has users across multiple companies\n
  107. and a project management service which has projects for individual users\n
  108. A new user story comes in “As an admin user I want a paginated view of all projects for a given company” \n
  109. In a typical monolithic app this can be easily solved by firing a database join query.\n
  110. As we don’t have the required information locally we’ll be forced to access it over http. \n* It will involve multiple calls if the service returns paginated results. \n* It adds an overhead of serialization and deserialization.\n* If there are a lot of users for a given company, the ‘in’ clause won’t work due to limitation of the query string size\n\nSo on and so forth\n
  111. One way to solve this problem is by allowing services to share their data with other services. \n
  112. If one service starts writing in the database of the other service, it defeats the purpose of building separate services in the first place.\n
  113. We can expose a readonly copy. We don’t recommend it although it is an option to keep in mind. It works in certain scenarios as long as everyone on the team understands that it should not be abused.\n
  114. For this we can either use the same database for all our services or create master slave and read from slave\n
  115. \n
  116. \n
  117. \n
  118. As we said, sharing database connection is equivalent to integrating services at the database level and it comes with a lot of problems\n
  119. Suddenly services which share databases start relying on the internal representation of resource instead of what is exposed at the service level\n
  120. Behind the API resources might have computed fields which are not stored in the database or might be split into multiple tables etc. \n
  121. \n
  122. \n
  123. We also tie to the internal stack of the service as different services might have different kind of data stores depending on their needs\n
  124. \n
  125. Before we discuss how to tackle it let’s talk about another problem.\n\n
  126. \n
  127. Imagine these multiple services needs to be notified when a particular user logs out of the system so as to do a local cleanup.\n
  128. One way to approach this problem is by allowing services to register callback URIs with user management service, either through configuration or programmatically at bootstrap time. \n
  129. It will work as long as we have only handful of events which can be registered against. But as we keep adding more events and more services interested in listening to them...\n
  130. b. the overall complexity of managing the callback configurations grows massively.\n
  131. a. Response time for a simple action like logout increases due to increasing number of callbacks it has to invoke.\n
  132. Obviously by creating a background job for invoking callbacks we can guarantee quick response\n
  133. We can use an MQ server for that which provides an internal centralized bus for all services who want to to broadcast messages. \n
  134. It is a nice way of decoupling producers and consumers of the events. Producer can essentially fire the event and forget about it.\n
  135. Any consumer who is interested in any such events will register with the central bus for notifications and is solely responsible for acting upon those event as it sees fit.\n
  136. One thing to remember though is that these calls are asynchronous. We should not wrap make two consecutive calls to service expecting that a consumer of the first event has already received and processed it. \n
  137. Establish a few convention in terms of what will be an exchange name and a topic name used by a service to propagate a particular type of event so that consumers can easily register for such events without massive configuration. \n
  138. A few slides back we spoke about having local cache of resources to which shared database was one solution. If we implement an event system we can use it to manage local cache of resources and use local database joins.\n
  139. \n
  140. \n
  141. \n
  142. It’s a local cache and should be treated like one\n
  143. Due to asynchronous nature of the system this cache will not reflect latest data. It might have a slightly older version. It can be safely used for resources which don’t change frequently and for which eventual consistency is not a problem.\n
  144. Witch caching comes the problem of cache expiry. For which a consumer can listen to update and delete events. Not to mention, the producer has trigger these events with appropriate payload for consumer to modify the local cache. \n
  145. Services evolve over a period of time and API changes. But we still have to maintain backward compatibility as the clients depend on a contract of the API\n
  146. This is more or less a solved problem. All major APIs such as github, twitter, facebook do it.\n
  147. Only thing to keep in mind is, if we are developing both producers and consumers in a walled garden we can deterministically predict number of revisions any API needs to support.\n\nRather going a step further, we can evaluate the cost of upgrading all clients with changing API vs cost of introducing API versioning and take a call whether we want to support multiple versions or not.\n
  148. Implementing ACID transactions across multiple databases is a complex problem and having to do so over services adds to the complexity\n
  149. There’s no framework in place which does it transparently does it. Databases solve this problem by introducing two phase commit.\n
  150. It’s problem and there is one solution we have seen it working but haven’t been involved in its development. We’ll be willing to discuss it offline.\n
  151. \n
  152. \n
  153. Local gem server\n
  154. APIs are to be consumed by machines, web pages by human they have different requirements \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n