All Projects → PaytmLabs → Akka Batteries

PaytmLabs / Akka Batteries

Licence: apache-2.0
Utilities for Akka cluster in production

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to Akka Batteries

Jersey2 Akka Java
An example async Java REST API using Jersey 2 and Akka
Stars: ✭ 50 (-51.46%)
Mutual labels:  akka
Hydra
A real-time data replication platform that "unbundles" the receiving, transforming, and transport of data streams.
Stars: ✭ 68 (-33.98%)
Mutual labels:  akka
Scala Ddd Example
🎯 λ Hexagonal Architecture + DDD + CQRS applied in Scala using Akka HTTP
Stars: ✭ 86 (-16.5%)
Mutual labels:  akka
Utils4s
scala、spark使用过程中,各种测试用例以及相关资料整理
Stars: ✭ 1,070 (+938.83%)
Mutual labels:  akka
Thingsboard
Open-source IoT Platform - Device management, data collection, processing and visualization.
Stars: ✭ 10,526 (+10119.42%)
Mutual labels:  akka
Eventstore.akka.persistence
Event Store Journal for Akka Persistence
Stars: ✭ 72 (-30.1%)
Mutual labels:  akka
Akka Typed Session
add-on to Akka Typed that tracks effects for use with Session Types
Stars: ✭ 47 (-54.37%)
Mutual labels:  akka
Squbs
Akka Streams & Akka HTTP for Large-Scale Production Deployments
Stars: ✭ 1,365 (+1225.24%)
Mutual labels:  akka
Alpakka
Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
Stars: ✭ 1,154 (+1020.39%)
Mutual labels:  akka
Clickhouse Scala Client
Clickhouse Scala Client with Reactive Streams support
Stars: ✭ 84 (-18.45%)
Mutual labels:  akka
Protoactor Dotnet
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
Stars: ✭ 1,070 (+938.83%)
Mutual labels:  akka
Failurewall
Destroys failures.
Stars: ✭ 64 (-37.86%)
Mutual labels:  akka
Swagger Akka Http Sample
Sample demonstrating use of swagger-akka-http
Stars: ✭ 79 (-23.3%)
Mutual labels:  akka
Play Spark Scala
Stars: ✭ 51 (-50.49%)
Mutual labels:  akka
Alpakka Kafka
Alpakka Kafka connector - Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
Stars: ✭ 1,295 (+1157.28%)
Mutual labels:  akka
Nsdb
Natural Series Database
Stars: ✭ 49 (-52.43%)
Mutual labels:  akka
Akka Http
The Streaming-first HTTP server/module of Akka
Stars: ✭ 1,163 (+1029.13%)
Mutual labels:  akka
Akka Reasonable Downing
Quorum split brain resolver for static akka cluster
Stars: ✭ 101 (-1.94%)
Mutual labels:  akka
Akka Persistence Mongo
Implementation of akka-persistence storage plugins for mongodb
Stars: ✭ 99 (-3.88%)
Mutual labels:  akka
Travesty
Diagram- and graph-generating library for Akka Streams
Stars: ✭ 83 (-19.42%)
Mutual labels:  akka

Akka Batteries (Beta)

A collection of useful utilities for Akka cluster in production.

Akka Cluster Discover

To discover cluster seed nodes from external source. Cluster will be formed programatically by calling ClusterDiscovery(system).start(). It supports a few cluster discovery providers: self for local development and debugging only in which the seed will join itself to form the cluster. network which uses a provided set of seeds ip:port. elb which will use AWS ELB for seed discovery where all seed nodes must register with the same elb. When the expected number of configured seed nodes is reached, the cluster will be formed.

Note: When using AWS ECS, if the seed service is configured with elb, the registration will happen automatically.

Example

To use the cluster discovery, add configuration to your project. You can configure only the discovery provider you need. It is useful to have network or self for local development or testing and elb for production

// application.conf or reference.configured

akka {
  cluster {
    discovery {
      provider = network
      provider = ${?DISCOVERY_PROVIDER} // network, elb or self
      modules {

        network {
          seed-hosts = ["127.0.0.1:2551"]
        }

        elb {
          name = "YOUR-SEED-ELB-NAME"
          name = ${?DISCOVERY_ELB_NAME}
        }
      }
    }
  }
}

It is better to override configuration with environment variables so it can be changed during operation after deployment.

In your code whenever you need to join the Akka cluster add the following (assuming system is your actor system variable):

ClusterDiscovery(system).start()

It is better to only invoke the above code once your actor is fully initialized and ready to serve, so it only joins the cluster when it is fully in service.

Local Affinity Router

A cluster-aware group router that favors components on the same server but if target component is not on the same exists then the router will fallback to provided routing logic (i.e. RoundRobin or Random). This router helps in reducing network bandwidth between the servers that run the akka cluster which is important for very high throughput services.

Example

akka {
  actor{
    deployment {
      /myRouter {
        router = local-affinity-round-robin-group
        router = ${?MY_ROUTER}
        routees.paths = ["/user/myService"]
        cluster {
          enabled = on
          allow-local-routees = on
          use-role = my-service // to limit the search space
        }
      }
    }
  }
}

The router can be used from the code as following:

val myRouter = system.actorOf(FromConfig.props(), name = "myRouter")

Role-based Split Brain Resolver

The split brain heal the cluster when a network partition occurs or when a node does not leave the cluster cleanly. To ensure the entire system is function, mandatory roles can be configured. The resolver will maintain the partition with all the mandatory roles even if they are the minority. If both partitions contain the mandatory roles, then keep majority will be applied. Tie will be broken by keeping the partition with the oldest running node. If both partitions does not have all the essential roles, then the entire cluster will shutdown. An external process recovery should be configured to restart the JVM and re-establish the cluster.

Example

akka {
  cluster {
    downing-provider-class =
     "com.paytmlabs.akka.cluster.sbr.RoleBasedSplitBrainResolverProvider"
  }
}

app {
  cluster {
    stable-after = 10 seconds
    essential-roles = ["seed", "service1", "service2"]
  }
}

stable-after is the cool down period the resolver will wait after the last change in cluster membership before acting.

TODO

These utilities have been running in our production systems with a high throughput (sustained 6,000+ req/sec) and low latency (less than 50 millis).

  • Add unit and multi-jvm testing
  • Support more discovery providers (e.g., consul, etcd, s3)
  • Setup a public CI/CD pipeline
  • Publish artifacts to central repository
  • Add full example projects

Contributions will be appreciated, please open a github issue first to discuss your potential PR before working on it to ensure there is no duplication in effort.

LICENSE

Copyright 2017 Paytm Labs

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].