KrakenD API Gateway Product overview @devopsfaith Microservices - - PowerPoint PPT Presentation

β–Ά
krakend api gateway
SMART_READER_LITE
LIVE PREVIEW

KrakenD API Gateway Product overview @devopsfaith Microservices - - PowerPoint PPT Presentation

KrakenD API Gateway Product overview @devopsfaith Microservices are challenging The need for agility and scalability has driven Microservices adoption, but: 91% of Internet businesses are using or have plans to use microservices 86% expect


slide-1
SLIDE 1

KrakenD API Gateway

Product overview

@devopsfaith

slide-2
SLIDE 2 2019 KrakenD API Gateway 2

Microservices are challenging

The need for agility and scalability has driven Microservices adoption, but: 91% of Internet businesses are using or have plans to use microservices 86% expect microservices to be the default architecture within five years

* Independent research study conducted by Dimensional Research, April 2018

99% report challenges in using microservices

slide-3
SLIDE 3 2019 KrakenD API Gateway 3

What problem do we solve?

Consume use-cases in a microservice-based ecosystem

slide-4
SLIDE 4 2019 KrakenD API Gateway 4

Catalog Promotions Basket Payments Orders Pricing Stock Authentication

Android iOS SPA

?

slide-5
SLIDE 5 2019 KrakenD API Gateway 5

KrakenD offloads shared needs

Catalog Basket Orders Promotions Stock Payments Pricing Authentication Manipulation Filtering Circuit Breaker Metrics/Tracing Aggregation Security Authorization Service Discovery Encoding Logging Rate Limit Monitoring Load Balancer Pub/Sub Transport adapter Stub Data Traffic Mirroring Queues Serverless functions Lambda Bot detection I/O validation

slide-6
SLIDE 6 2019 KrakenD API Gateway 6
slide-7
SLIDE 7

Use cases

Common scenarios for KrakenD

slide-8
SLIDE 8 2019 KrakenD API Gateway 8

MONOLITH

Database

Catalog Promotions Basket Payments Orders Pricing Stock Authentication

Transition to microservices

slide-9
SLIDE 9 2019 KrakenD API Gateway 9

1 2

JWT

Authentication

3

Service 1

Aggregate

Service 2

slide-10
SLIDE 10 2019 KrakenD API Gateway 10

"endpoint": "/basket", "extra_config": { "github.com/devopsfaith/krakend-jose/validator": { "alg": "HS256", "audience": ["http://api.example.com"], "roles_key": "roles",

"roles": ["user", "admin"],

"jwk-url": "https://monolith/jwk/symmetric.json" } }, "output_encoding": "no-op", "headers_to_pass": ["Authentication"], "backend": [{ "url_pattern": "/bar", "encoding": "no-op" }]

Authorization granularity

krakend.json

slide-11
SLIDE 11 2019 KrakenD API Gateway 11

Authentication

/checkout JWT token

Catalog Promotions Basket Payments Orders Pricing Stock

MONOLITH

slide-12
SLIDE 12 2019 KrakenD API Gateway 12

MONOLITH

Orders Pricing Stock Basket Payments Promotions Catalog

MONOLITH

🎊

slide-13
SLIDE 13 2019 KrakenD API Gateway 13

Event-driven architecture

Notifications

/notify

QUEUE

Azure Service Bus Topic

4

slide-14
SLIDE 14 2019 KrakenD API Gateway 14

Client Apps (consume a use-case)

Catalog Promotions Basket Payments Orders Pricing Stock Authentication

/frontpage { "catalog": {}, "promos": {}, "pricing": {} }

slide-15
SLIDE 15 2019 KrakenD API Gateway 15

Aggregation

<id_product>2</id_product> <name>Wireless Headset</name> <date fmt="Y-m-d">2019-06-04</date> { "code": "PromoChristmas", "discount": 0.15, "products": [1,2,15] }

+

{ "id_product": 2, "name": "Wireless Headset", "date": "2019-06-04", "code": "PromoChristmas", "discount": 0.15, "products": [1,2,15] }

Aggregated

}

Catalog Promotions

slide-16
SLIDE 16 2019 KrakenD API Gateway 16

KrakenD as a 3rd party provider

{ "3dparty": {}, "internal": {} } 3rd party services Company services

slide-17
SLIDE 17 2019 KrakenD API Gateway 17

Transformation API

rename id_user => user_id rename alias => username remove password add static_data Services

slide-18
SLIDE 18 2019 KrakenD API Gateway 18

Manipulation/Filtering/Grouping/Transformation

<id_product>2</id_product> <name>Wireless Headset</name> <date fmt="Y-m-d">2019-06-04</date>

Catalog

{ "code": "PromoChristmas", "discount": 0.15, "products": [1,2,15] }

Promotions +

{ "catalog": { "id_product": 2, "name": "Wireless Headset", "date": "2019-06-04", }, "promotions": { "code": "PromoChristmas", "savediscount": 0.15, "products": [1,2,15], } }

Aggregated

}

slide-19
SLIDE 19 2019 KrakenD API Gateway 19

TL;DR - Instant creation of high-performance API

through a configuration file

slide-20
SLIDE 20 2019 KrakenD API Gateway 20

More components and features… (open source)

https://github.com/devopsfaith/krakend-contrib

Enterprise components

  • KrakenD Studio
  • KrakenD Developer Portal
  • KrakenD Management Portal
  • KrakenD Enterprise Plugins
  • KrakenD gRPC plugin generator
  • KrakenD Dashboard
slide-21
SLIDE 21 2019 KrakenD API Gateway 21
slide-22
SLIDE 22

Differences

With similar products

slide-23
SLIDE 23 2019 KrakenD API Gateway 23

Photo by @voyagefervor, Instagram

Service Mesh API Gateways Proxies with GW GraphQL API Managers

slide-24
SLIDE 24 2019 KrakenD API Gateway 24

Proxy with GW 1:1 mapping endpoint-backends - No business logic - Offload cross-cutting

  • concerns. No aggregation

Products with overlapping features

GraphQL HTTP only - Single Endpoint - Allows the client to choose exactly the data in the response. ~BFF. E.g: you provide an API to developers out of your

  • rganization

API Gateway Services aggregation - Business logic - API Contract - No coupling to backend - Offload cross-cutting concerns. Can implement the BFF pattern. Service Mesh Internal communication between services (not for the end-user). No business logic API Managers Access management (generate API Keys), billing, developer portal, usage statistics

slide-25
SLIDE 25 2019 KrakenD API Gateway 25

API GW API GW: North-south traffic Mesh: east-west traffic

slide-26
SLIDE 26 2019 KrakenD API Gateway 26

Proxy with API Gateway capabilities

Catalog Promotions Basket Payments Orders Pricing Stock Authentication

Android iOS SPA

PROXY

slide-27
SLIDE 27

Stateless vs Stateful

slide-28
SLIDE 28 2019 KrakenD API Gateway 28

Stateful

slide-29
SLIDE 29 2019 KrakenD API Gateway 29

Stateless

slide-30
SLIDE 30 2019 KrakenD API Gateway 30

A gateway is not the new monolith

β˜… Coordination required β˜… Data synchronization β˜… Datastore as source of truth β˜… Complexity β˜… Multi-region lag β˜… Mutable configuration NON-LINEAR SCALABILITY

Stateless Stateful

β˜… No node coordination β˜… No synchronization β˜… Zero complexity β˜… No challenges for Multi-region β˜… Declarative configuration β˜… Immutable infrastructure LINEAR SCALABILITY

DB-LESS != stateless

slide-31
SLIDE 31

Deployment

slide-32
SLIDE 32 2019 KrakenD API Gateway 34

Simple deployment (stateless)

FROM devopsfaith/krakend COPY krakend.json \ /etc/krakend/krakend.json

+ ≃

70MB

Dockerfile
slide-33
SLIDE 33 2019 KrakenD API Gateway 35

Deploy anywhere

Orchestration Platforms

slide-34
SLIDE 34 2019 KrakenD API Gateway 36

Assign a KrakenD to each team (client type)

Catalog Promotions Basket Payments Orders Pricing Stock Authentication

Android iOS SPA
slide-35
SLIDE 35 2019 KrakenD API Gateway 37

Assign a KrakenD to each team (micro frontends)

} } }

slide-36
SLIDE 36 2019 KrakenD API Gateway 38

Not necessarily the single point of entry

Catalog Promotions Payments Orders Pricing Stock Authentication

slide-37
SLIDE 37

Performance

slide-38
SLIDE 38 2019 KrakenD API Gateway 40

Benchmarks

slide-39
SLIDE 39 2019 KrakenD API Gateway 41

Benchmark Overview

# Hardware specs Requests second Average response 1. Amazon EC2 (c4.2xlarge) 10126.1613 reqs/s 9.8ms 2. Amazon EC2 (c4.xlarge) 8465.4012 reqs/s 11.7ms 3. Amazon EC2 (m4.large) 3634.1247 reqs/s 27.3ms 4. Amazon EC2 (t2.medium) 2781.8611 reqs/s 351.3ms 5. Amazon EC2 (t2.micro) 2757.6407 reqs/s 35.8ms 6. MacBook Pro (Aug 2015) 2,2 GHz Intel Core i7 18157.4274 reqs/s 5.5ms

slide-40
SLIDE 40 2019 KrakenD API Gateway 42

18.000 reqs/sec

On a raspberry 2

slide-41
SLIDE 41 2019 KrakenD API Gateway 43

Without KrakenD

slide-42
SLIDE 42 2019 KrakenD API Gateway 44

With KrakenD (concurrence=3)

slide-43
SLIDE 43

Observability

Visualize the entire ecosystem from a central place

slide-44
SLIDE 44 2019 KrakenD API Gateway 46

1-click export of logging, metrics and traces

slide-45
SLIDE 45 2019 KrakenD API Gateway 47

Enable monitoring

slide-46
SLIDE 46 2019 KrakenD API Gateway 48

Metrics and Tracer exporters for every taste

slide-47
SLIDE 47 2019 KrakenD API Gateway 49
slide-48
SLIDE 48

KrakenD in production

slide-49
SLIDE 49 2019 KrakenD API Gateway 51

KrakenD Users

slide-50
SLIDE 50 2019 KrakenD API Gateway 52

Open-source adoption

slide-51
SLIDE 51 2019 KrakenD API Gateway 53

120,000 KrakenD sessions (12mo)

1 session = 1 cluster with at least 12 hours uptime

slide-52
SLIDE 52 2019 KrakenD API Gateway 54

Takeaways

βž” Automatic API generation and integration βž” Consumers (iOS, Android, Web, Server devs) in control

  • f the API

βž” Homogeneous consumption

  • f data formats and

encodings βž” Reduced bandwidth and errors βž” Increased speed βž” Better quality of service

slide-53
SLIDE 53 2019 KrakenD API Gateway 55

Questions?

Let’s have a beer!

@devopsfaith | @alombarte

Photo by Patrick Fore