SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Advanced Clojure Microservices
Tobias Bayer Hamburg, 30.09.2016
Clojure, Java, Cloud
tobias.bayer@inovex.de
https://github.com/tobiasbayer
2
Tobias Bayer
Senior Developer / Software Architect
inovex GmbH
3
(defroutes app
(GET "/messages/:name" [name] {:body {:message (str "Hello World" " " name)}})
(route/resources "/")
(route/not-found "Not Found"))
(defn -main [& args]
(run-jetty app {:port 3000 :join? false }))
Microservices with Clojure is easy!
4
~ 20 Microservices
High Availability
Polyglot
About 30% of services in Clojure
Running on AWS
5
Project
6
Resource Modeling
Fault Tolerance
Monitoring and Metrics
Cloudability
...
Real World Problems
7
Resource Modeling with Liberator
8
Resource Modeling with Liberator
9
Decisions
Resource Modeling with Liberator
10
Actions
Resource Modeling with Liberator
11
Handlers
Resource Modeling with Liberator
12
Resource Modeling with Liberator
(defroutes app
(ANY "/api/users" [] r/users)
(ANY "/api/users/:userhandle" [userhandle] (r/user userhandle))
(ANY "/api/authentication" [] r/authentication))
13
Resource Modeling with Liberator
(defresource users
:available-media-types ["application/user-v1+json"]
:allowed-methods [:post]
:malformed? (fn [ctx] (s/validate-user (body ctx)))
:handle-malformed (fn [ctx] (ring-response {:status 400
:body
{:message (str (s/validate-user (body ctx)))})}))
:post! (fn [ctx] (if (user-exists? (body ctx))
{:conflict true}
{:created-entity (create-user (body ctx))}))
:handle-created (fn [ctx] (if (:conflict ctx)
(ring-response {:status 409})
(r/user-output (:created-entity ctx)))))
Circuit Breaker
Netflix
hystrix-clj
clj-http-hystrix
14
Fault Tolerance with Hystrix
(h/add-hook {:hystrix/timeout-ms (:HYSTRIX_TIMEOUT config/settings)
:hystrix/threads (:HYSTRIX_THREADS config/settings)})
15
Fault Tolerance with Hystrix
(defn search-customer [param]
(client/get
(str api-endpoint "/customers?search=" param)
{:content-type :json
:as :json
:hystrix/group-key "customers"
:hystrix/fallback-fn (constantly {:body {:name "Not" :firstname "Found"}})}))
16
Metrics with Prometheus
17
Metrics with Prometheus
18
Metrics with Prometheus
(defroutes app
;; ...
(ANY "/internal/metrics" []
(prometheus/dump-metrics (:registry @metrics/metrics-store))))
(def handler
(-> app
; ...
(prometheus/instrument-handler "" (:registry @metrics/metrics-store))))
19
Metrics with Prometheus
prometheus-clj
(defonce metrics-store (atom (prometheus/init-defaults)))
(defn- register-metrics []
(-> @metrics-store
(prometheus/register-gauge "users" "users_count" "Number of users in DB" ["users_count"])
(prometheus/register-gauge "users" "users_disabled" "Number of disabled users in DB"
["users_disabled"])
(prometheus/register-counter "users" "cache_hits"
"Number of cache hits when requesting a customer" ["cache_hits"])
(prometheus/register-counter "users" "cache_misses"
"Number of cache misses when requesting a customer" ["cache_misses"])))
(defn init []
(reset! metrics-store (register-metrics))
(HystrixPrometheusMetricsPublisher/register (:registry @metrics-store)))
20
Metrics with Prometheus
(defn update-metrics []
(prometheus/set-gauge @metrics-store "users" "users_count" (p/count-users) ["users_count"])
(prometheus/set-gauge @metrics-store "users" "users_disabled"
(p/count-users {:enabled false}) ["users_disabled"]))
(defn inc-cache-hits []
(prometheus/increase-counter @metrics-store "users" "cache_hits" ["cache_hits"] 1))
(defn inc-cache-misses []
(prometheus/increase-counter @metrics-store "users" "cache_misses" ["cache_misses"] 1))
21
Metrics with Prometheus
(defn process-event [event]
(when (= (:eventType event) "SubscriptionChanged")
(log/info "Received event" event)
(handle-subscription-changed-event event)))
(defn start-worker! [fn-processor]
(kinesis/worker! :app (:APP_NAME config/settings)
:stream (:EVENT_STREAM config/settings)
:endpoint (:KINESIS_ENDPOINT config/settings)
:region-name (:AWS_REGION config/settings)
:processor (fn [records]
(doseq [record records]
(process-record record fn-processor)))))
22
Cloudability with Amazonica
AWS Kinesis
23
jobs@inovex.de
www.inovex.de/jobs
+49 721 619 021 50
Wir suchen Verstärkung in den Bereichen
• Digital Consulting
• Web Frontend & Backend
• Replatforming
• Apps & Smart Devices
• Big Data
• Data Science
• Search
• Business Intelligence
• DevOps
• Cloud
• Operations
Hamburg, Köln, München,
Karlsruhe, Pforzheim

Contenu connexe

Tendances

Tendances (20)

Kubernetes and Prometheus
Kubernetes and PrometheusKubernetes and Prometheus
Kubernetes and Prometheus
 
Know your app: Add metrics to Java with Micrometer | DevNation Tech Talk
Know your app: Add metrics to Java with Micrometer | DevNation Tech TalkKnow your app: Add metrics to Java with Micrometer | DevNation Tech Talk
Know your app: Add metrics to Java with Micrometer | DevNation Tech Talk
 
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
 
Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...
Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...
Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...
 
Handle insane devices traffic using Google Cloud Platform - Andrea Ulisse - C...
Handle insane devices traffic using Google Cloud Platform - Andrea Ulisse - C...Handle insane devices traffic using Google Cloud Platform - Andrea Ulisse - C...
Handle insane devices traffic using Google Cloud Platform - Andrea Ulisse - C...
 
NFVO based on ManageIQ - OPNFV Summit 2016 Demo
NFVO based on ManageIQ - OPNFV Summit 2016 DemoNFVO based on ManageIQ - OPNFV Summit 2016 Demo
NFVO based on ManageIQ - OPNFV Summit 2016 Demo
 
Monitoring MySQL with Prometheus, Grafana and Percona Dashboards
Monitoring MySQL with Prometheus, Grafana and Percona DashboardsMonitoring MySQL with Prometheus, Grafana and Percona Dashboards
Monitoring MySQL with Prometheus, Grafana and Percona Dashboards
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
 
Ceilometer Updates - Kilo Edition
Ceilometer Updates - Kilo EditionCeilometer Updates - Kilo Edition
Ceilometer Updates - Kilo Edition
 
Java application monitoring with Dropwizard Metrics and graphite
Java application monitoring with Dropwizard Metrics and graphite Java application monitoring with Dropwizard Metrics and graphite
Java application monitoring with Dropwizard Metrics and graphite
 
Prometheus for Monitoring Metrics (Fermilab 2018)
Prometheus for Monitoring Metrics (Fermilab 2018)Prometheus for Monitoring Metrics (Fermilab 2018)
Prometheus for Monitoring Metrics (Fermilab 2018)
 
CDK Meetup: Rule the World through IaC
CDK Meetup: Rule the World through IaCCDK Meetup: Rule the World through IaC
CDK Meetup: Rule the World through IaC
 
The journey to the kubernetes metrics
The journey to the kubernetes metricsThe journey to the kubernetes metrics
The journey to the kubernetes metrics
 
stackconf 2021 | Prometheus in 2021 and beyond
stackconf 2021 | Prometheus in 2021 and beyondstackconf 2021 | Prometheus in 2021 and beyond
stackconf 2021 | Prometheus in 2021 and beyond
 
An Introduction to Prometheus
An Introduction to PrometheusAn Introduction to Prometheus
An Introduction to Prometheus
 
Monitoring with prometheus at scale
Monitoring with prometheus at scaleMonitoring with prometheus at scale
Monitoring with prometheus at scale
 
Replication - Nick Carboni - ManageIQ Design Summit 2016
Replication - Nick Carboni - ManageIQ Design Summit 2016Replication - Nick Carboni - ManageIQ Design Summit 2016
Replication - Nick Carboni - ManageIQ Design Summit 2016
 
Airflow at WePay
Airflow at WePayAirflow at WePay
Airflow at WePay
 
Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators
 
Handling Kubernetes Resources
Handling Kubernetes ResourcesHandling Kubernetes Resources
Handling Kubernetes Resources
 

En vedette

Datenprodukte für Deutschlands größten Fahrzeugmarkt
Datenprodukte für Deutschlands größten FahrzeugmarktDatenprodukte für Deutschlands größten Fahrzeugmarkt
Datenprodukte für Deutschlands größten Fahrzeugmarkt
inovex GmbH
 
Elasticsearch und Big Data - Webinar vom 23.07.2014
Elasticsearch und Big Data - Webinar vom 23.07.2014Elasticsearch und Big Data - Webinar vom 23.07.2014
Elasticsearch und Big Data - Webinar vom 23.07.2014
inovex GmbH
 
Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...
Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...
Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...
inovex GmbH
 

En vedette (20)

Moderne App-Entwicklung am Beispiel waipu.tv
Moderne App-Entwicklung am Beispiel waipu.tvModerne App-Entwicklung am Beispiel waipu.tv
Moderne App-Entwicklung am Beispiel waipu.tv
 
Datenprodukte für Deutschlands größten Fahrzeugmarkt
Datenprodukte für Deutschlands größten FahrzeugmarktDatenprodukte für Deutschlands größten Fahrzeugmarkt
Datenprodukte für Deutschlands größten Fahrzeugmarkt
 
Continuous Integration for Fun and Profit
Continuous Integration for Fun and ProfitContinuous Integration for Fun and Profit
Continuous Integration for Fun and Profit
 
Erfolgsfaktoren von Datenprodukten
Erfolgsfaktoren von DatenproduktenErfolgsfaktoren von Datenprodukten
Erfolgsfaktoren von Datenprodukten
 
Gitlab meets Kubernetes
Gitlab meets KubernetesGitlab meets Kubernetes
Gitlab meets Kubernetes
 
Stackstorm – Event driven Automation
Stackstorm – Event driven AutomationStackstorm – Event driven Automation
Stackstorm – Event driven Automation
 
Prometheus Monitoring
Prometheus MonitoringPrometheus Monitoring
Prometheus Monitoring
 
Elasticsearch und Big Data - Webinar vom 23.07.2014
Elasticsearch und Big Data - Webinar vom 23.07.2014Elasticsearch und Big Data - Webinar vom 23.07.2014
Elasticsearch und Big Data - Webinar vom 23.07.2014
 
Kubernetes Frankfurt
Kubernetes FrankfurtKubernetes Frankfurt
Kubernetes Frankfurt
 
OpenStack und Containers
OpenStack und ContainersOpenStack und Containers
OpenStack und Containers
 
Kubernetes Workshop
Kubernetes WorkshopKubernetes Workshop
Kubernetes Workshop
 
Die dunkle Seite der Microservices - und wie du sie besiegen kannst
Die dunkle Seite der Microservices - und wie du sie besiegen kannst Die dunkle Seite der Microservices - und wie du sie besiegen kannst
Die dunkle Seite der Microservices - und wie du sie besiegen kannst
 
Docker meets Kubernetes
Docker meets KubernetesDocker meets Kubernetes
Docker meets Kubernetes
 
Dockerized Microservices
Dockerized MicroservicesDockerized Microservices
Dockerized Microservices
 
Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...
Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...
Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...
 
SysDig Metriken zentralisieren
SysDig Metriken zentralisierenSysDig Metriken zentralisieren
SysDig Metriken zentralisieren
 
Automated Application Management with SaltStack
Automated Application Management with SaltStackAutomated Application Management with SaltStack
Automated Application Management with SaltStack
 
Monitoring with Graylog - a modern approach to monitoring?
Monitoring with Graylog - a modern approach to monitoring?Monitoring with Graylog - a modern approach to monitoring?
Monitoring with Graylog - a modern approach to monitoring?
 
Sprachsteuerung mit dem Google Assistant – Add a new User Interface to your P...
Sprachsteuerung mit dem Google Assistant – Add a new User Interface to your P...Sprachsteuerung mit dem Google Assistant – Add a new User Interface to your P...
Sprachsteuerung mit dem Google Assistant – Add a new User Interface to your P...
 
Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...
Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...
Haltet den (Daten-) Dieb! Echtzeiterkennung von Anomalien in Computernetzwerk...
 

Similaire à Advanced Cojure Microservices

Similaire à Advanced Cojure Microservices (20)

Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
 Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg... Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
Little Opinions, Big Possibilities: The Tools and Patterns for Building Larg...
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
 
使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster 使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Monitoring a Kubernetes-backed microservice architecture with Prometheus
Monitoring a Kubernetes-backed microservice architecture with PrometheusMonitoring a Kubernetes-backed microservice architecture with Prometheus
Monitoring a Kubernetes-backed microservice architecture with Prometheus
 
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-ServicesNode Interactive: Node.js Performance and Highly Scalable Micro-Services
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
 
Application Security from the Inside - OWASP
Application Security from the Inside - OWASPApplication Security from the Inside - OWASP
Application Security from the Inside - OWASP
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesIBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
 
Programming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioProgramming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.io
 
Swift Cloud Workshop - Swift Microservices
Swift Cloud Workshop - Swift MicroservicesSwift Cloud Workshop - Swift Microservices
Swift Cloud Workshop - Swift Microservices
 
Re-Design with Elixir/OTP
Re-Design with Elixir/OTPRe-Design with Elixir/OTP
Re-Design with Elixir/OTP
 
Monitoring as Software Validation
Monitoring as Software ValidationMonitoring as Software Validation
Monitoring as Software Validation
 
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!
 
iguazio - nuclio overview to CNCF (Sep 25th 2017)
iguazio - nuclio overview to CNCF (Sep 25th 2017)iguazio - nuclio overview to CNCF (Sep 25th 2017)
iguazio - nuclio overview to CNCF (Sep 25th 2017)
 
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-MechanizePerformance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanize
 
nuclio Overview October 2017
nuclio Overview October 2017nuclio Overview October 2017
nuclio Overview October 2017
 
Data visualization in python/Django
Data visualization in python/DjangoData visualization in python/Django
Data visualization in python/Django
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and Ops
 
Master a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptxMaster a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptx
 

Plus de inovex GmbH

Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learning
inovex GmbH
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systems
inovex GmbH
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreihen
inovex GmbH
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use case
inovex GmbH
 

Plus de inovex GmbH (20)

lldb – Debugger auf Abwegen
lldb – Debugger auf Abwegenlldb – Debugger auf Abwegen
lldb – Debugger auf Abwegen
 
Are you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIAre you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AI
 
Why natural language is next step in the AI evolution
Why natural language is next step in the AI evolutionWhy natural language is next step in the AI evolution
Why natural language is next step in the AI evolution
 
WWDC 2019 Recap
WWDC 2019 RecapWWDC 2019 Recap
WWDC 2019 Recap
 
Network Policies
Network PoliciesNetwork Policies
Network Policies
 
Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learning
 
Jenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen UmgebungenJenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen Umgebungen
 
AI auf Edge-Geraeten
AI auf Edge-GeraetenAI auf Edge-Geraeten
AI auf Edge-Geraeten
 
Prometheus on Kubernetes
Prometheus on KubernetesPrometheus on Kubernetes
Prometheus on Kubernetes
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systems
 
Azure IoT Edge
Azure IoT EdgeAzure IoT Edge
Azure IoT Edge
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreihen
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
 
Künstlich intelligent?
Künstlich intelligent?Künstlich intelligent?
Künstlich intelligent?
 
Dev + Ops = Go
Dev + Ops = GoDev + Ops = Go
Dev + Ops = Go
 
Das Android Open Source Project
Das Android Open Source ProjectDas Android Open Source Project
Das Android Open Source Project
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretability
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use case
 
People & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessPeople & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madness
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
 

Dernier

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Dernier (20)

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

Advanced Cojure Microservices

  • 1. Advanced Clojure Microservices Tobias Bayer Hamburg, 30.09.2016
  • 2. Clojure, Java, Cloud tobias.bayer@inovex.de https://github.com/tobiasbayer 2 Tobias Bayer Senior Developer / Software Architect inovex GmbH
  • 3. 3 (defroutes app (GET "/messages/:name" [name] {:body {:message (str "Hello World" " " name)}}) (route/resources "/") (route/not-found "Not Found")) (defn -main [& args] (run-jetty app {:port 3000 :join? false })) Microservices with Clojure is easy!
  • 4. 4
  • 5. ~ 20 Microservices High Availability Polyglot About 30% of services in Clojure Running on AWS 5 Project
  • 6. 6 Resource Modeling Fault Tolerance Monitoring and Metrics Cloudability ... Real World Problems
  • 12. 12 Resource Modeling with Liberator (defroutes app (ANY "/api/users" [] r/users) (ANY "/api/users/:userhandle" [userhandle] (r/user userhandle)) (ANY "/api/authentication" [] r/authentication))
  • 13. 13 Resource Modeling with Liberator (defresource users :available-media-types ["application/user-v1+json"] :allowed-methods [:post] :malformed? (fn [ctx] (s/validate-user (body ctx))) :handle-malformed (fn [ctx] (ring-response {:status 400 :body {:message (str (s/validate-user (body ctx)))})})) :post! (fn [ctx] (if (user-exists? (body ctx)) {:conflict true} {:created-entity (create-user (body ctx))})) :handle-created (fn [ctx] (if (:conflict ctx) (ring-response {:status 409}) (r/user-output (:created-entity ctx)))))
  • 15. (h/add-hook {:hystrix/timeout-ms (:HYSTRIX_TIMEOUT config/settings) :hystrix/threads (:HYSTRIX_THREADS config/settings)}) 15 Fault Tolerance with Hystrix (defn search-customer [param] (client/get (str api-endpoint "/customers?search=" param) {:content-type :json :as :json :hystrix/group-key "customers" :hystrix/fallback-fn (constantly {:body {:name "Not" :firstname "Found"}})}))
  • 19. (defroutes app ;; ... (ANY "/internal/metrics" [] (prometheus/dump-metrics (:registry @metrics/metrics-store)))) (def handler (-> app ; ... (prometheus/instrument-handler "" (:registry @metrics/metrics-store)))) 19 Metrics with Prometheus prometheus-clj
  • 20. (defonce metrics-store (atom (prometheus/init-defaults))) (defn- register-metrics [] (-> @metrics-store (prometheus/register-gauge "users" "users_count" "Number of users in DB" ["users_count"]) (prometheus/register-gauge "users" "users_disabled" "Number of disabled users in DB" ["users_disabled"]) (prometheus/register-counter "users" "cache_hits" "Number of cache hits when requesting a customer" ["cache_hits"]) (prometheus/register-counter "users" "cache_misses" "Number of cache misses when requesting a customer" ["cache_misses"]))) (defn init [] (reset! metrics-store (register-metrics)) (HystrixPrometheusMetricsPublisher/register (:registry @metrics-store))) 20 Metrics with Prometheus
  • 21. (defn update-metrics [] (prometheus/set-gauge @metrics-store "users" "users_count" (p/count-users) ["users_count"]) (prometheus/set-gauge @metrics-store "users" "users_disabled" (p/count-users {:enabled false}) ["users_disabled"])) (defn inc-cache-hits [] (prometheus/increase-counter @metrics-store "users" "cache_hits" ["cache_hits"] 1)) (defn inc-cache-misses [] (prometheus/increase-counter @metrics-store "users" "cache_misses" ["cache_misses"] 1)) 21 Metrics with Prometheus
  • 22. (defn process-event [event] (when (= (:eventType event) "SubscriptionChanged") (log/info "Received event" event) (handle-subscription-changed-event event))) (defn start-worker! [fn-processor] (kinesis/worker! :app (:APP_NAME config/settings) :stream (:EVENT_STREAM config/settings) :endpoint (:KINESIS_ENDPOINT config/settings) :region-name (:AWS_REGION config/settings) :processor (fn [records] (doseq [record records] (process-record record fn-processor))))) 22 Cloudability with Amazonica AWS Kinesis
  • 23. 23
  • 24. jobs@inovex.de www.inovex.de/jobs +49 721 619 021 50 Wir suchen Verstärkung in den Bereichen • Digital Consulting • Web Frontend & Backend • Replatforming • Apps & Smart Devices • Big Data • Data Science • Search • Business Intelligence • DevOps • Cloud • Operations Hamburg, Köln, München, Karlsruhe, Pforzheim