Slide 1

Slide 1 text

@riferrei | #oraclecodeone | @CONFLUENTINC Keep your caches hot with apache kafka® and the connector api [dev1346] @riferrei | @oraclecodeone | @CONFLUENTINC

Slide 2

Slide 2 text

KS19Meetup. CONFLUENT COMMUNITY DISCOUNT CODE 25% OFF*

Slide 3

Slide 3 text

About Us: ● Ricardo Ferreira ❑ Developer Advocate @ Confluent ❑ Ex-Oracle, Red Hat, IONA Tech ❑ [email protected] ❑ https://riferrei.net ● Alexa (amazon echo) ❑ The voice behind Amazon ❑ Ex-Raspberry Pi, Arduino ❑ She is a female in character! @riferrei @alexa99

Slide 4

Slide 4 text

@riferrei | @oraclecodeone | @CONFLUENTINC Data is only useful if it is fresh and contextual

Slide 5

Slide 5 text

Airbag systems are made out of three key components: ● The bag itself ● The sensors which detects when there is a collision probability based on speed ● The inflation system, which does combine the chemical compounds (sodium azide and potassium nitrate) to make gas to inflate the bag What if the airbag deploys 30 seconds after the collision?

Slide 6

Slide 6 text

@riferrei | @oraclecodeone | @CONFLUENTINC Caches are great to keep data fresh

Slide 7

Slide 7 text

Apis need to access large amounts data freely and easily ● Data should never be the scarce resource of apis ● Latency should be kept as minimal as possible ● Data should not be static: keep data always updated ● Find ways to handle large amounts of data easily Cache API Read Write Read Write

Slide 8

Slide 8 text

Caches can be built-in or distributed caches Cache API Built-in Caches Cache API Distributed Caches Cache Cache Read Write Read Write ● If data can fit into the api memory space, use built-in ● Use distributed caches for large amounts of data ● Some cache implementations provide both options ● For distributed caches, make sure to use one that has o(1) retrieval time

Slide 9

Slide 9 text

@riferrei | @oraclecodeone | @CONFLUENTINC Why apache kafka?

Slide 10

Slide 10 text

10 01 Messaging done right 02 Stream processing 03 Persistent storage @riferrei | @oraclecodeone | @CONFLUENTINC

Slide 11

Slide 11 text

Time for fun

Slide 12

Slide 12 text

@riferrei | @oraclecodeone | @CONFLUENTINC

Slide 13

Slide 13 text

@riferrei | @oraclecodeone | @CONFLUENTINC Caching patterns

Slide 14

Slide 14 text

Caching pattern: refresh ahead ● Proactively keep the cache updated with the last state ● Keep the entries always in- sync for better consistency ● Ideal for latency sensitive use cases such as apis ● Ideal for when the data is costly to get from backend ● It may need data loading Kafka Connect Cache Kafka Connect API

Slide 15

Slide 15 text

Caching pattern: refresh ahead/adapt ● Proactively keep the cache updated with the last state ● Keep the entries always in- sync for better consistency ● Ideal for latency sensitive use cases such as apis ● Ideal for when the data is costly to get from backend ● It may need data loading Kafka Connect Cache Kafka Connect Transform and adapt records before delivery Schema Registry for canonical models API

Slide 16

Slide 16 text

Caching pattern: write behind ● Removes i/o pressure from the api, allowing scalability ● True horizontal scalability ● Ensures event ordering and persistence (replayability) ● Minimizes database code complexity from the api ● Handles database failures beautifully via replication Kafka Connect Cache Kafka Connect API

Slide 17

Slide 17 text

Caching pattern: write behind/adapt ● Removes i/o pressure from the api, allowing scalability ● True horizontal scalability ● Ensures event ordering and persistence (replayability) ● Minimizes database code complexity from the api ● Handles database failures beautifully via replication Kafka Connect Cache Kafka Connect Transform and adapt records before delivery API Schema Registry for canonical models

Slide 18

Slide 18 text

Caching pattern: event federation ● Replicates data across regions across the globe ● Keep multiple regions in-sync ● Great to improve rto / rpo ● Handles network slowness ● While keeping disparate clusters in-sync, it also allows the caches to be global as well Confluent Replicator

Slide 19

Slide 19 text

@riferrei | @oraclecodeone | @CONFLUENTINC Kafka connect implementation strategies

Slide 20

Slide 20 text

Kafka connectors for popular caches ● Connector for redis and is available on confluent hub ● Connector for Memcached is available on confluent hub ● Connector for gridgain and apache ignite are available ● Connector for infinispan is available for red hat users Kafka Connect Kafka Connect Kafka Connect Kafka Connect

Slide 21

Slide 21 text

some caches may need different strategies ● Oracle provides hotcache for golden gate and coherence ● Hazelcast has the jet sdk which supports connect ● Pivotal gemfire and apache geode has the spring data ● Good news: you can always write your own connectors using the connector api Golden gate Hazelcast Jet Spring data Connect Framework Any Cache

Slide 22

Slide 22 text

Want to convert your database to streams? ● Meet debezium: a plataform to perform database cdc ● Works in a log level, which means true cdc behavior for your projects ● Open-source and maintained by red hat. Has a broad set of connectors available ● It is built on kafka connect

Slide 23

Slide 23 text

@riferrei | #oraclecodeone | @CONFLUENTINC

Slide 24

Slide 24 text

No content