This document discusses distributed and highly available server applications built in Java and Scala. It describes an architecture using lightweight microservices called Talkbits that communicate over the Finagle distributed RPC framework. Key principles for Talkbits include stateless services, service discovery with Zookeeper, and functional composition of RPC calls. The document also covers configuration, deployment, logging, metrics collection and monitoring of the distributed system using tools like Loggly, CodaHale, Jolokia, Datadog, and Fabric.
Using OVSDB and OpenFlow southbound pluginsOpenDaylight
Southbound plugins are essential for programming your network with OpenDaylight. In this meetup, we will discuss the plugins for OpenFlow and OVSDB, as well as the differences in writing applications with MD-SAL and AD-SAL. We will do bite-sized hands-on exercises to learn how to use the two plugins.
Network Intent Composition in OpenDaylightOpenDaylight
There is a flurry of activity on policy and intent in Software-defined Networks. The NIC project in OpenDaylight focuses on enabling the controller to manage and direct network services and network resources based on app-described “Intents”. The Intent based NBI allows for a descriptive way to get what is desired from the infrastructure, unlike the current SDN interfaces which are based on describing how to provide different services. The Network Intent Composition function will use existing OpenDaylight Network Service Functions and Southbound Plugins to control both virtual and physical network devices.
DEVNET-1006 Getting Started with OpenDayLightCisco DevNet
Install OpenDaylight within a VM on your own laptop. Acquaint yourself with the development environment. Learn your way around Dlux (GUI) and the CLI to view and operate an OpenDaylight controlled network. Activate and operate integrations to Cisco network elements
Slides from Talk by Jan Medved on Yang modeling and its support in OpenDaylight meetup
http://www.meetup.com/OpenDaylight-Silicon-Valley/events/212834752
Yang is a data modeling language that is rapidly being adopted to model Netconf, an IETF standardized network management protocol, as well as to model other data interfaces in OpenDaylight. Join us for the talk by expert Jan Medved to learn about Yang and its usage within OpenDaylight.
End-to-End Reactive Data Access Using R2DBC with RSocket and ProteusVMware Tanzu
Lack of asynchronous relational database drivers in Java has been a barrier to writing scalable, data-driven applications for many. R2DBC is seeking to change this with a new API designed from the ground up for reactive programming against relational databases—its intent ito support reactive data access built on natively asynchronous, non-blocking SQL database drivers.
How does this change the game for data access in the cloud? Used in conjunction with RSocket and Proteus, it is now possible to write applications benefiting from reactive streaming end-to-end, from the browser all the way to the database. No more fiddling with paging APIs, polling for updates, or writing complex logic to merge data from multiple sources--reactive streams can handle this all for you!
RSocket is an open-source, reactive networking protocol that is a collaborative development initiative of Netifi with Pivotal, Facebook, and others. Proteus is a freely available broker for RSocket that is designed to handle the challenges of communication between complex networks of services—both within the data center and over the internet—extending to mobile devices and browsers.
Attend this webinar to learn how to use Pivotal Cloud Foundry with R2DBC and Proteus to build reactive microservices that return large amounts of data in a streaming fashion over RSocket.
Speakers: Ryland Degnan, co-founder and CTO of Netifi and Dan Baskette, Pivotal host
Using OVSDB and OpenFlow southbound pluginsOpenDaylight
Southbound plugins are essential for programming your network with OpenDaylight. In this meetup, we will discuss the plugins for OpenFlow and OVSDB, as well as the differences in writing applications with MD-SAL and AD-SAL. We will do bite-sized hands-on exercises to learn how to use the two plugins.
Network Intent Composition in OpenDaylightOpenDaylight
There is a flurry of activity on policy and intent in Software-defined Networks. The NIC project in OpenDaylight focuses on enabling the controller to manage and direct network services and network resources based on app-described “Intents”. The Intent based NBI allows for a descriptive way to get what is desired from the infrastructure, unlike the current SDN interfaces which are based on describing how to provide different services. The Network Intent Composition function will use existing OpenDaylight Network Service Functions and Southbound Plugins to control both virtual and physical network devices.
DEVNET-1006 Getting Started with OpenDayLightCisco DevNet
Install OpenDaylight within a VM on your own laptop. Acquaint yourself with the development environment. Learn your way around Dlux (GUI) and the CLI to view and operate an OpenDaylight controlled network. Activate and operate integrations to Cisco network elements
Slides from Talk by Jan Medved on Yang modeling and its support in OpenDaylight meetup
http://www.meetup.com/OpenDaylight-Silicon-Valley/events/212834752
Yang is a data modeling language that is rapidly being adopted to model Netconf, an IETF standardized network management protocol, as well as to model other data interfaces in OpenDaylight. Join us for the talk by expert Jan Medved to learn about Yang and its usage within OpenDaylight.
End-to-End Reactive Data Access Using R2DBC with RSocket and ProteusVMware Tanzu
Lack of asynchronous relational database drivers in Java has been a barrier to writing scalable, data-driven applications for many. R2DBC is seeking to change this with a new API designed from the ground up for reactive programming against relational databases—its intent ito support reactive data access built on natively asynchronous, non-blocking SQL database drivers.
How does this change the game for data access in the cloud? Used in conjunction with RSocket and Proteus, it is now possible to write applications benefiting from reactive streaming end-to-end, from the browser all the way to the database. No more fiddling with paging APIs, polling for updates, or writing complex logic to merge data from multiple sources--reactive streams can handle this all for you!
RSocket is an open-source, reactive networking protocol that is a collaborative development initiative of Netifi with Pivotal, Facebook, and others. Proteus is a freely available broker for RSocket that is designed to handle the challenges of communication between complex networks of services—both within the data center and over the internet—extending to mobile devices and browsers.
Attend this webinar to learn how to use Pivotal Cloud Foundry with R2DBC and Proteus to build reactive microservices that return large amounts of data in a streaming fashion over RSocket.
Speakers: Ryland Degnan, co-founder and CTO of Netifi and Dan Baskette, Pivotal host
The monolith to cloud-native, microservices evolution has driven a shift from monitoring to observability. OpenTelemetry, a merger of the OpenTracing and OpenCensus projects, is enabling Observability 2.0. This talk covers the latest concepts in observability and then demonstrates how to configure and deploy various OpenTelemetry components to effectively meet your SLO's.
Jan Lindblad's presentation at Layer123 SDN and OpenFlow World Congress in Bad Homburg, Germany. Focusing on a multi-vendor SDN deployment at a Tier 1 Service Provider in Asia.
Tail-f Network Control System (NCS) use case:
• Dynamic control of L3-L7 devices using service- oriented network API
• Service chaining using OpenFlow
• Virtualized appliances
Introducing Confluent labs Parallel Consumer client | Anthony Stubbes, ConfluentHostedbyConfluent
Consuming messages in parallel is what Apache Kafka® is all about, so you may well wonder, why would we want anything else? It turns out that, in practice, there are a number of situations where Kafka’s partition-level parallelism gets in the way of optimal design.
This session will go over some of these types of situations that can benefit from parallel message processing within a single application instance (aka slow consumers or competing consumers), and then introduce the new Parallel Consumer labs project from Confluent, which can improve functionality and massively improve performance in such situations.
It will cover the
- Different ordering modes of the client
- Relative performance improvements
- Usage with other components like Kafka Streams
- An introduction to the internal architecture of the project
- How it can achieve all this in a reassignment friendly manner
Achieving a 50% Reduction in Cross-AZ Network Costs from Kafka (Uday Sagar Si...confluent
Cloud providers like AWS allow free data transfers within an Availability Zone (AZ), but bill users when data moves between AZs. When the data volume streamed through Kafka reaches big data scale, (e.g. numeric data points or user activity tracking), the costs incurred by cross-AZ traffic can add significantly to your monthly cloud spend. Since Kafka serves reads and writes only from leader partitions, for a topic with a replication factor of 3, a message sent through Kafka can cross AZs up to 4 times. Once when a producer produces a message onto broker in a different AZ, two times during Kafka replication, and once more during message consumption. With careful design, we can eliminate the first and last part of the cross AZ traffic. We can also use message compression strategies provided by Kafka to reduce costs during replication. In this talk, we will discuss the architectural choices that allow us to ensure a Kafka message is produced and consumed within a single AZ, as well as an algorithm that lets consumers intelligently subscribe to partitions with leaders in the same AZ. We will also cover use cases in which cross-AZ message streaming is unavoidable due to design limitations. Talk outline: 1) A review of Kafka replication, 2) Cross-AZ traffic implications, 3) Architectural choices for AZ-aware message streaming, 4) Algorithms for AZ-aware producers and consumers, 5) Results, 6) Limitations, 7) Takeaways.
Apache Deep Learning 201 - Philly Open SourceTimothy Spann
#phillyopensource
Introduction talk for data engineers for deep learning on apache with apache mxnet, apache nifi, apache hive, apache hadoop, apache spark, python and other tools.
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...Brent Salisbury
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach in OpenDaylight. Will post more details in a blog entry at http://networkstatic.net as soon as time permits for those looking for more information.
Cheers,
-Brent
High Performance Object Pascal Code on Servers (at EKON 22)Arnaud Bouchez
This EKON 22 conference is about high performance on servers, written in the object pascal (Delphi / FPC) language. Profiling should be the first step to avoid premature optimization, which is the root of all evil (Knuth). But when some bottlenecks are identified, we introduce some simple architecture patterns (like caching or microservices), data structures and algorithms to make process actually faster, with minimal refactoring. It was a fun session about how to write faster code, ending up by looking at the Delphi CPU view – even if you don’t know assembly.
(ATS3-DEV04) Introduction to Pipeline Pilot Protocol Development for DevelopersBIOVIA
An overview of techniques for building Pipeline Pilot protocols, using the languages and paradigms familiar to software developers. Sound engineering principles should be applied to the development of protocols, so this session will discuss concepts like modularity and re-use, minimizing side effects, clarity of interfaces, multi-threading, version control. We will also cover the data pipelining architecture of Pipeline Pilot and how that affects the approach to protocol authoring.
Build a Micro HTTP Server for Embedded SystemJian-Hong Pan
Apache HTTP Server, NGINX .. are famous web servers in the world. More and more web server frameworks come and follow up, like Node.js, Bottle of Python .., etc. All of them make us have the abilities to get or connect to the resources behind the web server. However, considering the limitations and portability, they may not be ported directly to the embedded system which has restricted resources. Therefore, we need to re-implement an HTTP server to fulfill that requirement.
I will introduce how do I use the convenience of Python to implement a Micro HTTP Server prototype according to RFC 2616/HTTP 1.1. Then, re-write the codes in C to build the Micro HTTP Server and do the automated testing with Python Unit Testing Framework. Finally, I combined the Micro HTTP Server with an RTOS and light the LEDs on an STM32F4-Discovery board.
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...HostedbyConfluent
This talk is aimed to give developers who are interested to scale their streaming application with Exactly-Once (EOS) guarantees. Since the original release, EOS processing has received wide adoption as a much needed feature inside the community, and has also exposed various scalability and usability issues when applied in production systems.
To address those issues, we improved on the existing EOS model by integrating static Producer transaction semantics with dynamic Consumer group semantics. We will have a deep-dive into the newly added features (KIP-447), from which the audience will have more insight into the scalability v.s. semantics guarantees tradeoffs and how Kafka Streams specifically leveraged them to help scale EOS streaming applications written in this library. We would also present how the EOS code can be simplified with plain Producer and Consumer. Come to learn more if you wish to adopt this improved EOS feature and get started on building your own EOS application today!
An introduction to KrakenD, the ultra-high performance API Gateway with middlewares. An opensource tool built using go that is currently serving traffic in major european sites.
The Cisco Open SDN Controller is a commercial distribution of OpenDaylight that delivers business agility through automation of standards-based network infrastructure.
Built as a highly scalable software-defined networking (SDN) platform, the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
The controller exposes REST APIs to allow other applications to take advantage capabilities of the controller and unlock the power of the underlying network infrastructure, and JAVA APIs to allow for the creation of new network services.
This session will present the basic constructs of the controller and the capabilities of the REST and JAVA APIs to demonstrate how the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
Speaker: Matt Howlett, Software Engineer, Confluent
This presentation provides a technical overview of Apache Kafka® and covers some of its popular use cases.
The monolith to cloud-native, microservices evolution has driven a shift from monitoring to observability. OpenTelemetry, a merger of the OpenTracing and OpenCensus projects, is enabling Observability 2.0. This talk covers the latest concepts in observability and then demonstrates how to configure and deploy various OpenTelemetry components to effectively meet your SLO's.
Jan Lindblad's presentation at Layer123 SDN and OpenFlow World Congress in Bad Homburg, Germany. Focusing on a multi-vendor SDN deployment at a Tier 1 Service Provider in Asia.
Tail-f Network Control System (NCS) use case:
• Dynamic control of L3-L7 devices using service- oriented network API
• Service chaining using OpenFlow
• Virtualized appliances
Introducing Confluent labs Parallel Consumer client | Anthony Stubbes, ConfluentHostedbyConfluent
Consuming messages in parallel is what Apache Kafka® is all about, so you may well wonder, why would we want anything else? It turns out that, in practice, there are a number of situations where Kafka’s partition-level parallelism gets in the way of optimal design.
This session will go over some of these types of situations that can benefit from parallel message processing within a single application instance (aka slow consumers or competing consumers), and then introduce the new Parallel Consumer labs project from Confluent, which can improve functionality and massively improve performance in such situations.
It will cover the
- Different ordering modes of the client
- Relative performance improvements
- Usage with other components like Kafka Streams
- An introduction to the internal architecture of the project
- How it can achieve all this in a reassignment friendly manner
Achieving a 50% Reduction in Cross-AZ Network Costs from Kafka (Uday Sagar Si...confluent
Cloud providers like AWS allow free data transfers within an Availability Zone (AZ), but bill users when data moves between AZs. When the data volume streamed through Kafka reaches big data scale, (e.g. numeric data points or user activity tracking), the costs incurred by cross-AZ traffic can add significantly to your monthly cloud spend. Since Kafka serves reads and writes only from leader partitions, for a topic with a replication factor of 3, a message sent through Kafka can cross AZs up to 4 times. Once when a producer produces a message onto broker in a different AZ, two times during Kafka replication, and once more during message consumption. With careful design, we can eliminate the first and last part of the cross AZ traffic. We can also use message compression strategies provided by Kafka to reduce costs during replication. In this talk, we will discuss the architectural choices that allow us to ensure a Kafka message is produced and consumed within a single AZ, as well as an algorithm that lets consumers intelligently subscribe to partitions with leaders in the same AZ. We will also cover use cases in which cross-AZ message streaming is unavoidable due to design limitations. Talk outline: 1) A review of Kafka replication, 2) Cross-AZ traffic implications, 3) Architectural choices for AZ-aware message streaming, 4) Algorithms for AZ-aware producers and consumers, 5) Results, 6) Limitations, 7) Takeaways.
Apache Deep Learning 201 - Philly Open SourceTimothy Spann
#phillyopensource
Introduction talk for data engineers for deep learning on apache with apache mxnet, apache nifi, apache hive, apache hadoop, apache spark, python and other tools.
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...Brent Salisbury
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach in OpenDaylight. Will post more details in a blog entry at http://networkstatic.net as soon as time permits for those looking for more information.
Cheers,
-Brent
High Performance Object Pascal Code on Servers (at EKON 22)Arnaud Bouchez
This EKON 22 conference is about high performance on servers, written in the object pascal (Delphi / FPC) language. Profiling should be the first step to avoid premature optimization, which is the root of all evil (Knuth). But when some bottlenecks are identified, we introduce some simple architecture patterns (like caching or microservices), data structures and algorithms to make process actually faster, with minimal refactoring. It was a fun session about how to write faster code, ending up by looking at the Delphi CPU view – even if you don’t know assembly.
(ATS3-DEV04) Introduction to Pipeline Pilot Protocol Development for DevelopersBIOVIA
An overview of techniques for building Pipeline Pilot protocols, using the languages and paradigms familiar to software developers. Sound engineering principles should be applied to the development of protocols, so this session will discuss concepts like modularity and re-use, minimizing side effects, clarity of interfaces, multi-threading, version control. We will also cover the data pipelining architecture of Pipeline Pilot and how that affects the approach to protocol authoring.
Build a Micro HTTP Server for Embedded SystemJian-Hong Pan
Apache HTTP Server, NGINX .. are famous web servers in the world. More and more web server frameworks come and follow up, like Node.js, Bottle of Python .., etc. All of them make us have the abilities to get or connect to the resources behind the web server. However, considering the limitations and portability, they may not be ported directly to the embedded system which has restricted resources. Therefore, we need to re-implement an HTTP server to fulfill that requirement.
I will introduce how do I use the convenience of Python to implement a Micro HTTP Server prototype according to RFC 2616/HTTP 1.1. Then, re-write the codes in C to build the Micro HTTP Server and do the automated testing with Python Unit Testing Framework. Finally, I combined the Micro HTTP Server with an RTOS and light the LEDs on an STM32F4-Discovery board.
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...HostedbyConfluent
This talk is aimed to give developers who are interested to scale their streaming application with Exactly-Once (EOS) guarantees. Since the original release, EOS processing has received wide adoption as a much needed feature inside the community, and has also exposed various scalability and usability issues when applied in production systems.
To address those issues, we improved on the existing EOS model by integrating static Producer transaction semantics with dynamic Consumer group semantics. We will have a deep-dive into the newly added features (KIP-447), from which the audience will have more insight into the scalability v.s. semantics guarantees tradeoffs and how Kafka Streams specifically leveraged them to help scale EOS streaming applications written in this library. We would also present how the EOS code can be simplified with plain Producer and Consumer. Come to learn more if you wish to adopt this improved EOS feature and get started on building your own EOS application today!
An introduction to KrakenD, the ultra-high performance API Gateway with middlewares. An opensource tool built using go that is currently serving traffic in major european sites.
The Cisco Open SDN Controller is a commercial distribution of OpenDaylight that delivers business agility through automation of standards-based network infrastructure.
Built as a highly scalable software-defined networking (SDN) platform, the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
The controller exposes REST APIs to allow other applications to take advantage capabilities of the controller and unlock the power of the underlying network infrastructure, and JAVA APIs to allow for the creation of new network services.
This session will present the basic constructs of the controller and the capabilities of the REST and JAVA APIs to demonstrate how the Open SDN Controller abstracts away the complexity of managing heterogeneous networks to improve service delivery and reduce operating costs.
Speaker: Matt Howlett, Software Engineer, Confluent
This presentation provides a technical overview of Apache Kafka® and covers some of its popular use cases.
Designing Event-Driven Applications with Apache NiFi, Apache Flink, Apache Spark
DevNexus 2022 Atlanta
https://devnexus.com/presentations/7150/
This talk is a quick overview of the How, What and WHY of Apache Pulsar, Apache Flink and Apache NiFi. I will show you how to design event-driven applications that scale the cloud native way.
This talk was done live in person at DevNexus across from the booth in room 311
Tim Spann
Tim Spann is a Developer Advocate for StreamNative. He works with StreamNative Cloud, Apache Pulsar, Apache Flink, Flink SQL, Apache NiFi, MiniFi, Apache MXNet, TensorFlow, Apache Spark, big data, the IoT, machine learning, and deep learning. Tim has over a decade of experience with the IoT, big data, distributed computing, streaming technologies, and Java programming. Previously, he was a Principal DataFlow Field Engineer at Cloudera, a Senior Solutions Architect at AirisData, a Senior Field Engineer at Pivotal and a Team Leader at HPE. He blogs for DZone, where he is the Big Data Zone leader, and runs a popular meetup in Princeton on big data, the IoT, deep learning, streaming, NiFi, the blockchain, and Spark. Tim is a frequent speaker at conferences such as IoT Fusion, Strata, ApacheCon, Data Works Summit Berlin, DataWorks Summit Sydney, and Oracle Code NYC. He holds a BS and MS in computer science.
The session will be about Twitter's RPC Library, Finagle. We well see why Finagle is a powerful library for asynchronous programming and will have a working implementation of simple use case.
Current & Future Use-Cases of OpenDaylightabhijit2511
OpenDaylight Overview and Architecture
• OpenDaylight Use Cases (Partial List)
I. Network Abstraction
II. ONAP
III. Network Virtualization
IV. AI/ML with OpenDaylight
V. ODL in OSS
• OpenDaylight: Getting Involved
Comparison between zookeeper, etcd 3 and other distributed coordination systemsImesha Sudasingha
This is a comparison between popular distributed coordination systems including zookeeper (which powers Apache Hadoop), etcd 3 (which powers Kubernetes), consul and hazelcast. This comparison was made in second half of 2016. Therefore, please note that some of these technologies have improved immensely over the time. Anyway, this presentation will provide an initial idea of each distributed coordination systems.
The Internet of Things if growing, but how can you build your own connected objects?
Together with MQTT, CoAP is one of the popular IoT protocols. It provides answers to the typical IoT constraints: it is bandwidth efficient and fits in constrained embedded environment while providing friendly and discoverable RESTful API.
This tutorial aims at giving you a hands-on experience with CoAP by showing you the power and simplicity of the Eclipse Californium library for developing real world IoT application.
Agenda:
- Introduction to CoAP
- Live discovery of connected CoAP objects using the Copper plugin for Firefox
- Presentation of more advanced CoAP topics (proxy, resource directory, device management with LWM2M)
- Presentation of Eclipse Californium, a CoAP library for Java
- Exercise: complete the provided Java code to create your own Internet of Things... thing!
Summit 16: How to Compose a New OPNFV Solution Stack?OPNFV
This session showcases how a new OPNFV solution stack (a.k.a. ""scenario"") is composed and stood up. We'll use a new solution stack framed around a new software forwarder (""VPP"") provided by the FD.io project as example for this session. The session discusses how an evolution/change of upstream components from OpenStack, OpenDaylight and FFD.io are put in place for the scenario, how installers and tests need to be evolved to allow for integration into OPNFV's continuous integration, deployment and test pipeline.
The Fn project is a container-native Apache 2.0 licensed serverless platform that you can run anywhere – on any cloud or on-premise. It’s easy to use, supports every programming language, and is extensible and performant. This YourStory-Oracle Developer Meetup covers various design aspects of Serverless for polyglot programming, implementation of Saga pattern, etc. It also emphasizes on the monitoring aspect of Fn project using Prometheus and Grafana
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Guido Schmutz
Independent of the source of data, the integration and analysis of event streams gets more important in the world of sensors, social media streams and Internet of Things. Events have to be accepted quickly and reliably, they have to be distributed and analyzed, often with many consumers or systems interested in all or part of the events. In this session we compare two popular Streaming Analytics solutions: Spark Streaming and Kafka Streams.
Spark is fast and general engine for large-scale data processing and has been designed to provide a more efficient alternative to Hadoop MapReduce. Spark Streaming brings Spark's language-integrated API to stream processing, letting you write streaming applications the same way you write batch jobs. It supports both Java and Scala.
Kafka Streams is the stream processing solution which is part of Kafka. It is provided as a Java library and by that can be easily integrated with any Java application.
4. Lightweight SOA
Key principles
● S1, S2 - edge services
● Each service is 0..1 servers
and 0..N clients built together
● No special "broker" services
● All services are stateless
● All instances are equal
What about state?
State is kept is specialized
distributed systems and fronted
by specific services.
Example follows...
6. Requirements for a distrubuted RPC system
Must have and nice to have
● Elastic and reliable discovery - schould handle nodes brought up and
shut down transparently and not be a SPOF itself
● Support for N-N topology of client and server instances
● Disconnect detection and transparent reconnects
● Fault tolerance - for example, by retries to remaining instances where
called instance goes down
● Clients backoff built-in - i.e., clients should not overload servers
when load spikes - as far as possible
● Configurable load distribution - i.e., which server instance to call for
this specific request
● Configurable networking layer - keepalives & heartbeats, timeouts,
connection pools etc.)
● Distributed tracing facilities
● Portability among different platforms
● Distributed stack traces for exceptions
● Transactions
7. Key principles to be lightweight and get rid of architectural waste
● Java SE
● No containers. Even servlet containers are light and built-in
● Standalone applications: unified configuration, deployment, metrics,
logging, single development framework - more on this later
● All launched istances are equal and process requests - no "special"
nodes or "active-standby" patterns
● Minimal dependencies and JAR size
● Minimal memory footprint
● One service - one purpose
● Highly tuned for this one purpose (app, JVM, OS, HW)
● Isolated fault domains - i.e., single datasource or external service is
fronted by one service only
No bloatware in technology stack!
"Lean" services
8. Finagle library
(twitter.github.io/finagle) acts
as a distributed RPC
framework.
Services are written in Java
and Scala and use Thrift
communication protocol.
Talkbits implementation choices
Apache Zookeeper (zookeeper.apache.org)
Provides reliable service discovery mechanics. Finagle has a nice built-in
integration with Zookeeper.
9. Finagle server: networking
Finagle is built on top of Netty - asynchronous, non-blocking TCP server.
Finagle codec
trait Codec[Req, Rep]
class ThriftClientFramedCodec(...) extends Codec[ThriftClientRequest, Array[Byte]] {
pipeline.addLast("thriftFrameCodec", new ThriftFrameCodec)
pipeline.addLast("byteEncoder", new ThriftClientChannelBufferEncoder)
pipeline.addLast("byteDecoder", new ThriftChannelBufferDecoder)
...
}
Finagle comes with ready-made codecs for
Thrift, HTTP, Memcache, Kestrel, HTTP streaming.
10. Finagle services and filters
// Service is simply a function from request to a future of response.
trait Service[Req, Rep] extends (Req => Future[Rep])
// Filter[A, B, C, D] converts a Service[C, D] to a Service[A, B].
abstract class Filter[-ReqIn, +RepOut, +ReqOut, -RepIn]
extends ((ReqIn, Service[ReqOut, RepIn]) => Future[RepOut])
abstract class SimpleFilter[Req, Rep] extends Filter[Req, Rep, Req, Rep]
// Service transformation example
val serviceWithTimeout: Service[Req, Rep] =
new RetryFilter[Req, Rep](..) andThen
new TimeoutFilter[Req, Rep](..) andThen
service
Finagle comes with
rate limiting, retries,
statistics, tracing,
uncaught exceptions
handling, timeouts and
more.
11. Functional composition
Given Future[A]
Sequential composition
def map[B](f: A => B): Future[B]
def flatMap[B](f: A => Future[B]): Future[B]
def rescue[B >: A](rescueException: PartialFunction[Throwable, Future[B]]): Future[B]
Concurrent composition
def collect[A](fs: Seq[Future[A]]): Future[Seq[A]]
def select[A](fs: Seq[Future[A]]): Future[(Try[A], Seq[Future[A]])]
And more
times(), whileDo() etc.
12. Functional composition on RPC calls
Sequential composition
val nearestChannel: Future[Channel] =
metadataClient.getUserById(uuid) flatMap {
user => geolocationClient.getNearestChannelId( user.getLocation() )
} flatMap {
channelId => metadataClient.getChannelById( channelId )
}
Concurrent composition
val userF: Future[User] = metadataClient.getUserById(uuid)
val bitsCountF: Future[Integer] = metadataClient.getUserBitsCount(uuid)
val avatarsF: Future[List[Avatar]] = metadataClient.getUserAvatars(uuid)
val(user, bitsCount, avatars) =
Future.collect(Seq(userF, bitsCountF, avatarsF)).get()
*All this stuff works in Java just like in Scala, but does not look as cool.
13. Finagle server: threading model
You should never block worker threads in order to achieve high
performance (throughput).
For blocking IO or long compuntations, delegate to FuturePool.
val diskIoFuturePool = FuturePool(Executors.newFixedThreadPool(4))
diskIoFuturePool( { scala.Source.fromFile(..) } )
Boss thread accepts new
client connections and
binds NIO Channel to a
specific worker thread.
Worker threads perform
all client IO.
14. More gifts and bonuses from Finagle
In addition to all said before, Finagle has
● Load-distribution in N-N topos - HeapBalancer ("least active
connections") by default
● Client backoff strategies - comes with TruncatedBinaryBackoff
implementation
● Failure detection
● Failover/Retry
● Connection Pooling
● Distributed Tracing (Zipkin project based on Google Dapper paper)
15. Finagle, Thrift & Java: lessons learned
Pros
● Gives a lot out of the box
● Production-proven and stable
● Active development community
● Lots of extension points in the library
Cons
● Good for Scala, usable with Java
● Works well with Thrift and HTTP (plus trivial protocols), but lacks
support for Protobuf and other stuff
● Poor exceptions handling experience with Java (no Scala match-es)
and ugly code
● finagle-thrift is a pain (old libthrift version lock-in, Cassandra
dependencies clash, cannot return nulls, and more). All problems
avoidable thought.
● Cluster scatters and never gathers when whole Zookeeper ensemble
is down.
16. Finagle: competitors & alternatives
Trending
● Akka 2.0 (Scala, OpenSource) by Typesafe
● ZeroRPC (Python & Node.js, OpenSource) by DotCloud
● RxJava (Java, OpenSource) by Netflix
Old
● JGroups (Java, OpenSource)
● JBOSS Remoting (Java, OpenSource) by JBOSS
● Spread Toolkit (C/C++, Commercial & OpenSource)
20. Architecture of talkbits service
One way to configure service, logs, metrics.
One way to package and deploy service.
One way to lunch service.
Bundled in one-jar.
21. One delivery unit. Contains:
Java service
In a single executable fat-jar.
Installation script
[Re]installs service on the machine,
registers it in /etc/init.d
Init.d script
Contains instructions to start, stop,
restart JVM and get quick status.
Delivery
22. Logging
Confuguration
● SLF4J as an API, all other libraries redirected
● Logback as a logging implementation
● Each service logs to /var/log/talkbits/... (application logs, GC logs)
● Daily rotation policy applied
● Also sent to loggly.com for aggregation, grouping etc.
Aggregation
● loggly.com
● sshfs for analyzing logs by means of linux tools such as grep, tail, less,
etc.
Aggregation alternatives
Splunk.com, Flume, Scribe, etc...
23. Metrics
Application metrics and health checks are implemented with CodaHale lib
(metrics.codahale.com). Codahale reports metrics via JMX.
Jolokia JVM agent (www.jolokia.org/agent/jvm.html) exposes JMX beans
via REST (JSON / HTTP), using JVMs internal HTTP server.
Monitoring agent use jolokia REST interface to fetch metrics and send
them to monitoring system.
All metrics are divided into common metrics (HW, JVM, etc) and service-
specific metrics.
24. Deployment
Fabric (http://fabfile.org) used for
environments provisioning and
services deployment.
Process
● Fabric script provisions new env
(or uses existing) by cluster
scheme
● Amazon instances are
automatically tagged with
services list (i.e., instance roles)
● Fabric script reads instance roles
and deploys (redeploys)
appropriate components.
25. Monitoring
As monitoring platform we chose Datadoghq.com. Datadog is a SaaS
which is easy to integrate into your infrastucture. Datadog agent is
opensourced and implemented in Python. There are many predefined
checksets (plugins, or integrations) for popular products out of the box -
including JVM, Cassandra, Zookeeper and ElasticSearch.
Datadog provides REST API.
Alternatives
● Nagios, Zabbix - need to have bearded admin in team. We wanted to
go SaaS and outsource infrastructure as far as possible.
● Amazon CloudWatch, LogicMonitor, ManageEngine, etc.
Process
Each service has own monitoring agent instance on a single machine. If
node has 'monitoring-agent' role in the roles tag of EC2 instance,
monitoring agent will be installed for each service on this node.