SlideShare a Scribd company logo
1 of 18
Download to read offline
Presented By: Rahul Kayal
Introduction to Twitter’s
Finagle
What is Finagle?
Twitterʼs definition - Finagle is an extensible RPC for JVM, used to construct high
concurrency servers. Finagle implements uniform client and server APIʼs for several
protocols, and is designed for high performance and concurrency. Most of Finagleʼs
code is protocol agnostic, simplifying the implementation of new protocols.
In simple words - Finagle is a network stack for the JVM that you can use asynchronous
Remote Procedure Call (RPC) clients and server.
Why do we need Finagle?
In an actual enterprise application, there are a lot of services and each have them
have their own protocol. Each of these protocols comes with their libraries, jars to
manage them
Challenges
● Load Balancers
● Failure Detection
● Low Latency
● High Throughput
● Metric Collections
● Sharding
● Service Discovery
● Routing
● Back-Pressure Management
● Distributed Tracing
Twitterʼs Finagle core library consolidates all these and provides a single solution
for all these problems.
Finagle an be divided in 2 parts
Part 1 : As an asynchronous framework - Handled by Finagleʼs
com.twitter.util.Future.
Part 2 : As a common infrastructure to RPC Servers and Clients.
Three Composible Primitives
For asynchronous RPC development, there are 3 basic constructs we need to know.
● Service
● Future
● Filter
Service
● The core abstraction of Finagle is that of a Service. A Service, at its heart, is a
simple function, taking 2 arguments and returning a Future.
● A Service handles RPCs, taking requests and gives back a Future representing
the eventual result (or failure) of Type response.
● Services are used to represent both client and server. An instance of service is
used through a client; a server implements a Service.
● Services implement application logic. We might, for instance, define a
Service<Request,Response> to implement our applicationʼs external API.
Server
● Finagle Server implements a simple interface Server.
● When given a socket address and a ServiceFactory, a server returns a
ListeningServer when the serve method is called. The ListeningServer allows
management of server resources.
● The interface comes with variants that allow serving a simple Service as well.
● Typical usage would be of the form : Protocol.serve(...)
● Example : Http.server().serve(“:8080, service)
Server Modules
● Finagle servers are simple as they are designed to serve requests quickly. Hence,
Finagle minimally furnishes servers with additional behaviour. More
sophisticated behaviour lives with the clients.
Clients
● Similar to Servers, Finagle clients adhere to a simple interface for construction.
● Finagle supports both stateful and stateless clients.
● For stateless client, the usage is Protocol.client().newService(destination). The
method returns a Service. Dispatched requests will be load balanced across all of
the resolved hosts utilizing Finagleʼs configured Load Balancer.
● For stateful client, the usage is Protocol.client().newClient(destination). This
method would return a ServiceFactory that represents a distinct session.
Requests dispatched on this Service will reuse the established connection.
Client Contd.
● Load Balancer works only per session using ServiceFactory.apply, while
per-request on newService.
● Depending on the connection pooling strategy, Service.close returns the
connection to the pool and does not necessarily kill the connection. Hence it is
important to close the sessions after use to avoid resource leakage.
Finagle Client Features
● Connection Pooling
● Load Balancing
● Failure Detection
● Failover/Retry
● Distributed Tracing
● Service Discovery
● Rich Statistics
● Native OpenSSL bindings
Finagle Server Features
● Backpressure
● Server Registration
● Distributed Tracing
● Native OpenSSL bindings
FUTURES
● A computation that is not yet completed. Itʼs a promise of something to be done
later.
● It is implemented usually by either non-blocking io or thread pools. Finagle
almost entirely uses non blocking code.
● Finagle uses Futures to encapsulate and compose concurrent operations such as
network RPCs.
● The response of the Service is a Future, hence the response of a Client call to RPC
is a Future and we can make asynchronous calls to the server.
Filters
● Filters are basically that transforms a service.
● Like Services, Filters are also simple function.
● Filter also enable decomposition of services into phases.
● Provide service generic functionality, like rate limiting.
● A common example is to implement timeouts : if a request fails to complete
within a certain time, the timeout mechanism fails it with a timeout exception.
● It also returns a Future for non-blocking operations.
Demo
● Finagle Server and service
● Finagle Client and service
● Filters
● Future
Finagle a Network Stack for JVM
Thank You !
Get in touch with us:
Lorem Studio, Lord Building
D4456, LA, USA

More Related Content

What's hot

What's hot (20)

Open shift 4 infra deep dive
Open shift 4    infra deep diveOpen shift 4    infra deep dive
Open shift 4 infra deep dive
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
NGINX, Istio, and the Move to Microservices and Service Mesh
NGINX, Istio, and the Move to Microservices and Service MeshNGINX, Istio, and the Move to Microservices and Service Mesh
NGINX, Istio, and the Move to Microservices and Service Mesh
 
Ingress overview
Ingress overviewIngress overview
Ingress overview
 
Modernizing Applications by Replacing F5 with the NGINX Application Delivery ...
Modernizing Applications by Replacing F5 with the NGINX Application Delivery ...Modernizing Applications by Replacing F5 with the NGINX Application Delivery ...
Modernizing Applications by Replacing F5 with the NGINX Application Delivery ...
 
Slide DevSecOps Microservices
Slide DevSecOps Microservices Slide DevSecOps Microservices
Slide DevSecOps Microservices
 
K8s - Setting up minikube
K8s  - Setting up minikubeK8s  - Setting up minikube
K8s - Setting up minikube
 
Control Kubernetes Ingress and Egress Together with NGINX
Control Kubernetes Ingress and Egress Together with NGINXControl Kubernetes Ingress and Egress Together with NGINX
Control Kubernetes Ingress and Egress Together with NGINX
 
Microservices & API Gateways
Microservices & API Gateways Microservices & API Gateways
Microservices & API Gateways
 
Cloud Native Application
Cloud Native ApplicationCloud Native Application
Cloud Native Application
 
Hashicorp Vault ppt
Hashicorp Vault pptHashicorp Vault ppt
Hashicorp Vault ppt
 
Gatekeeper: API gateway
Gatekeeper: API gatewayGatekeeper: API gateway
Gatekeeper: API gateway
 
Everything you want to know about Ingress
Everything you want to know about IngressEverything you want to know about Ingress
Everything you want to know about Ingress
 
Continuous Lifecycle London 2018 Event Keynote
Continuous Lifecycle London 2018 Event KeynoteContinuous Lifecycle London 2018 Event Keynote
Continuous Lifecycle London 2018 Event Keynote
 
Red Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform OverviewRed Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform Overview
 
OpenShift 4, the smarter Kubernetes platform
OpenShift 4, the smarter Kubernetes platformOpenShift 4, the smarter Kubernetes platform
OpenShift 4, the smarter Kubernetes platform
 
DevOps: Infrastructure as Code
DevOps: Infrastructure as CodeDevOps: Infrastructure as Code
DevOps: Infrastructure as Code
 
Understanding docker networking
Understanding docker networkingUnderstanding docker networking
Understanding docker networking
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Microsoft DevOps Solution - DevOps
Microsoft DevOps Solution - DevOps  Microsoft DevOps Solution - DevOps
Microsoft DevOps Solution - DevOps
 

Similar to Twitter Finagle

Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ UberKafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
confluent
 
Микросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring CloudМикросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring Cloud
Vitebsk DSC
 

Similar to Twitter Finagle (20)

Yotpo microservices
Yotpo microservicesYotpo microservices
Yotpo microservices
 
Java one2013
Java one2013Java one2013
Java one2013
 
Consumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With PostmanConsumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With Postman
 
Nginx Conference 2016 - Learnings and State of the Industry
Nginx Conference 2016 - Learnings and State of the IndustryNginx Conference 2016 - Learnings and State of the Industry
Nginx Conference 2016 - Learnings and State of the Industry
 
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ UberKafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
 
'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...
 
Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On
 
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
 
MuleSoft Surat Virtual Meetup#33 - Unleash the power of Anypoint MQ and DLQ
MuleSoft Surat Virtual Meetup#33 - Unleash the power of Anypoint MQ and DLQ MuleSoft Surat Virtual Meetup#33 - Unleash the power of Anypoint MQ and DLQ
MuleSoft Surat Virtual Meetup#33 - Unleash the power of Anypoint MQ and DLQ
 
Building and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemBuilding and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub System
 
Integration Microservices
Integration MicroservicesIntegration Microservices
Integration Microservices
 
Introduction to Flink Streaming
Introduction to Flink StreamingIntroduction to Flink Streaming
Introduction to Flink Streaming
 
Distributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and ScalaDistributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and Scala
 
Openshift serverless Solution
Openshift serverless SolutionOpenshift serverless Solution
Openshift serverless Solution
 
Choosing the right messaging service for your serverless app [with lumigo]
Choosing the right messaging service for your serverless app [with lumigo]Choosing the right messaging service for your serverless app [with lumigo]
Choosing the right messaging service for your serverless app [with lumigo]
 
2017 Microservices Practitioner Virtual Summit: The Mechanics of Deploying En...
2017 Microservices Practitioner Virtual Summit: The Mechanics of Deploying En...2017 Microservices Practitioner Virtual Summit: The Mechanics of Deploying En...
2017 Microservices Practitioner Virtual Summit: The Mechanics of Deploying En...
 
All About Microservices and OpenSource Microservice Frameworks
All About Microservices and OpenSource Microservice FrameworksAll About Microservices and OpenSource Microservice Frameworks
All About Microservices and OpenSource Microservice Frameworks
 
Микросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring CloudМикросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring Cloud
 
6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF6. The grid-COMPUTING OGSA and WSRF
6. The grid-COMPUTING OGSA and WSRF
 

More from Knoldus Inc.

More from Knoldus Inc. (20)

Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptx
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Twitter Finagle

  • 1. Presented By: Rahul Kayal Introduction to Twitter’s Finagle
  • 2. What is Finagle? Twitterʼs definition - Finagle is an extensible RPC for JVM, used to construct high concurrency servers. Finagle implements uniform client and server APIʼs for several protocols, and is designed for high performance and concurrency. Most of Finagleʼs code is protocol agnostic, simplifying the implementation of new protocols. In simple words - Finagle is a network stack for the JVM that you can use asynchronous Remote Procedure Call (RPC) clients and server.
  • 3. Why do we need Finagle? In an actual enterprise application, there are a lot of services and each have them have their own protocol. Each of these protocols comes with their libraries, jars to manage them
  • 4. Challenges ● Load Balancers ● Failure Detection ● Low Latency ● High Throughput ● Metric Collections ● Sharding ● Service Discovery ● Routing ● Back-Pressure Management ● Distributed Tracing Twitterʼs Finagle core library consolidates all these and provides a single solution for all these problems.
  • 5. Finagle an be divided in 2 parts Part 1 : As an asynchronous framework - Handled by Finagleʼs com.twitter.util.Future. Part 2 : As a common infrastructure to RPC Servers and Clients.
  • 6. Three Composible Primitives For asynchronous RPC development, there are 3 basic constructs we need to know. ● Service ● Future ● Filter
  • 7. Service ● The core abstraction of Finagle is that of a Service. A Service, at its heart, is a simple function, taking 2 arguments and returning a Future. ● A Service handles RPCs, taking requests and gives back a Future representing the eventual result (or failure) of Type response. ● Services are used to represent both client and server. An instance of service is used through a client; a server implements a Service. ● Services implement application logic. We might, for instance, define a Service<Request,Response> to implement our applicationʼs external API.
  • 8. Server ● Finagle Server implements a simple interface Server. ● When given a socket address and a ServiceFactory, a server returns a ListeningServer when the serve method is called. The ListeningServer allows management of server resources. ● The interface comes with variants that allow serving a simple Service as well. ● Typical usage would be of the form : Protocol.serve(...) ● Example : Http.server().serve(“:8080, service)
  • 9. Server Modules ● Finagle servers are simple as they are designed to serve requests quickly. Hence, Finagle minimally furnishes servers with additional behaviour. More sophisticated behaviour lives with the clients.
  • 10. Clients ● Similar to Servers, Finagle clients adhere to a simple interface for construction. ● Finagle supports both stateful and stateless clients. ● For stateless client, the usage is Protocol.client().newService(destination). The method returns a Service. Dispatched requests will be load balanced across all of the resolved hosts utilizing Finagleʼs configured Load Balancer. ● For stateful client, the usage is Protocol.client().newClient(destination). This method would return a ServiceFactory that represents a distinct session. Requests dispatched on this Service will reuse the established connection.
  • 11. Client Contd. ● Load Balancer works only per session using ServiceFactory.apply, while per-request on newService. ● Depending on the connection pooling strategy, Service.close returns the connection to the pool and does not necessarily kill the connection. Hence it is important to close the sessions after use to avoid resource leakage.
  • 12. Finagle Client Features ● Connection Pooling ● Load Balancing ● Failure Detection ● Failover/Retry ● Distributed Tracing ● Service Discovery ● Rich Statistics ● Native OpenSSL bindings
  • 13. Finagle Server Features ● Backpressure ● Server Registration ● Distributed Tracing ● Native OpenSSL bindings
  • 14. FUTURES ● A computation that is not yet completed. Itʼs a promise of something to be done later. ● It is implemented usually by either non-blocking io or thread pools. Finagle almost entirely uses non blocking code. ● Finagle uses Futures to encapsulate and compose concurrent operations such as network RPCs. ● The response of the Service is a Future, hence the response of a Client call to RPC is a Future and we can make asynchronous calls to the server.
  • 15. Filters ● Filters are basically that transforms a service. ● Like Services, Filters are also simple function. ● Filter also enable decomposition of services into phases. ● Provide service generic functionality, like rate limiting. ● A common example is to implement timeouts : if a request fails to complete within a certain time, the timeout mechanism fails it with a timeout exception. ● It also returns a Future for non-blocking operations.
  • 16. Demo ● Finagle Server and service ● Finagle Client and service ● Filters ● Future
  • 17. Finagle a Network Stack for JVM
  • 18. Thank You ! Get in touch with us: Lorem Studio, Lord Building D4456, LA, USA