diff --git a/akka-actor/src/main/scala/akka/actor/ActorSystem.scala b/akka-actor/src/main/scala/akka/actor/ActorSystem.scala index f4398a1180..a08a3d0311 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorSystem.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorSystem.scala @@ -4,23 +4,21 @@ package akka.actor +import java.io.Closeable +import java.util.concurrent.{ ConcurrentHashMap, ThreadFactory, CountDownLatch, TimeoutException, RejectedExecutionException } +import java.util.concurrent.TimeUnit.MILLISECONDS +import com.typesafe.config.{ Config, ConfigFactory } import akka.event._ import akka.dispatch._ import akka.japi.Util.immutableSeq -import com.typesafe.config.{ Config, ConfigFactory } +import akka.actor.dungeon.ChildrenContainer +import akka.util._ import scala.annotation.tailrec import scala.collection.immutable import scala.concurrent.duration.{ FiniteDuration, Duration } -import scala.concurrent.{ Await, Awaitable, CanAwait, Future } +import scala.concurrent.{ Await, Awaitable, CanAwait, Future, ExecutionContext } import scala.util.{ Failure, Success } -import scala.util.control.NonFatal -import akka.util._ -import java.io.Closeable -import akka.util.internal.{ HashedWheelTimer } -import java.util.concurrent.{ ConcurrentHashMap, ThreadFactory, CountDownLatch, TimeoutException, RejectedExecutionException } -import java.util.concurrent.TimeUnit.MILLISECONDS -import akka.actor.dungeon.ChildrenContainer -import scala.concurrent.ExecutionContext +import scala.util.control.{ NonFatal, ControlThrowable } object ActorSystem { @@ -465,7 +463,7 @@ private[akka] class ActorSystemImpl(val name: String, applicationConfig: Config, new Thread.UncaughtExceptionHandler() { def uncaughtException(thread: Thread, cause: Throwable): Unit = { cause match { - case NonFatal(_) | _: InterruptedException ⇒ log.error(cause, "Uncaught error from thread [{}]", thread.getName) + case NonFatal(_) | _: InterruptedException | _: NotImplementedError | _: ControlThrowable ⇒ log.error(cause, "Uncaught error from thread [{}]", thread.getName) case _ ⇒ if (settings.JvmExitOnFatalError) { try { diff --git a/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala index 79d46b5f91..4f59b9abe6 100644 --- a/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala @@ -492,10 +492,8 @@ object ForkJoinExecutorConfigurator { threadFactory: ForkJoinPool.ForkJoinWorkerThreadFactory, unhandledExceptionHandler: Thread.UncaughtExceptionHandler) extends ForkJoinPool(parallelism, threadFactory, unhandledExceptionHandler, true) with LoadMetrics { - override def execute(r: Runnable): Unit = r match { - case m: Mailbox ⇒ super.execute(new MailboxExecutionTask(m)) - case other ⇒ super.execute(other) - } + override def execute(r: Runnable): Unit = + if (r eq null) throw new NullPointerException else super.execute(new AkkaForkJoinTask(r)) def atFullThrottle(): Boolean = this.getActiveThreadCount() >= this.getParallelism() } @@ -503,10 +501,11 @@ object ForkJoinExecutorConfigurator { /** * INTERNAL AKKA USAGE ONLY */ - final class MailboxExecutionTask(mailbox: Mailbox) extends ForkJoinTask[Unit] { - final override def setRawResult(u: Unit): Unit = () - final override def getRawResult(): Unit = () - final override def exec(): Boolean = try { mailbox.run; true } catch { + @SerialVersionUID(1L) + final class AkkaForkJoinTask(runnable: Runnable) extends ForkJoinTask[Unit] { + override def getRawResult(): Unit = () + override def setRawResult(unit: Unit): Unit = () + final override def exec(): Boolean = try { runnable.run(); true } catch { case anything: Throwable ⇒ val t = Thread.currentThread t.getUncaughtExceptionHandler match { diff --git a/akka-osgi/src/main/resources/akka-actor.conf b/akka-osgi/src/main/resources/akka-actor.conf new file mode 100644 index 0000000000..0039320631 --- /dev/null +++ b/akka-osgi/src/main/resources/akka-actor.conf @@ -0,0 +1,406 @@ +#################################### +# Akka Actor Reference Config File # +#################################### + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. + +akka { + # Akka version, checked against the runtime version of Akka. + version = "2.2-SNAPSHOT" + + # Home directory of Akka, modules in the deploy directory will be loaded + home = "" + + # Event handlers to register at boot time (Logging$DefaultLogger logs to STDOUT) + event-handlers = ["akka.event.Logging$DefaultLogger"] + + # Event handlers are created and registered synchronously during ActorSystem + # start-up, and since they are actors, this timeout is used to bound the + # waiting time + event-handler-startup-timeout = 5s + + # Log level used by the configured loggers (see "event-handlers") as soon + # as they have been started; before that, see "stdout-loglevel" + # Options: ERROR, WARNING, INFO, DEBUG + loglevel = "INFO" + + # Log level for the very basic logger activated during AkkaApplication startup + # Options: ERROR, WARNING, INFO, DEBUG + stdout-loglevel = "WARNING" + + # Log the complete configuration at INFO level when the actor system is started. + # This is useful when you are uncertain of what configuration is used. + log-config-on-start = off + + # List FQCN of extensions which shall be loaded at actor system startup. + # Should be on the format: 'extensions = ["foo", "bar"]' etc. + # See the Akka Documentation for more info about Extensions + extensions = [] + + # Toggles whether threads created by this ActorSystem should be daemons or not + daemonic = off + + # JVM shutdown, System.exit(-1), in case of a fatal error, + # such as OutOfMemoryError + jvm-exit-on-fatal-error = on + + actor { + + # FQCN of the ActorRefProvider to be used; the below is the built-in default, + # another one is akka.remote.RemoteActorRefProvider in the akka-remote bundle. + provider = "akka.actor.LocalActorRefProvider" + + # The guardian "/user" will use this class to obtain its supervisorStrategy. + # It needs to be a subclass of akka.actor.SupervisorStrategyConfigurator. + # In addition to the default there is akka.actor.StoppingSupervisorStrategy. + guardian-supervisor-strategy = "akka.actor.DefaultSupervisorStrategy" + + # Timeout for ActorSystem.actorOf + creation-timeout = 20s + + # Frequency with which stopping actors are prodded in case they had to be + # removed from their parents + reaper-interval = 5s + + # Serializes and deserializes (non-primitive) messages to ensure immutability, + # this is only intended for testing. + serialize-messages = off + + # Serializes and deserializes creators (in Props) to ensure that they can be + # sent over the network, this is only intended for testing. + serialize-creators = off + + # Timeout for send operations to top-level actors which are in the process + # of being started. This is only relevant if using a bounded mailbox or the + # CallingThreadDispatcher for a top-level actor. + unstarted-push-timeout = 10s + + typed { + # Default timeout for typed actor methods with non-void return type + timeout = 5s + } + + deployment { + + # deployment id pattern - on the format: /parent/child etc. + default { + + # routing (load-balance) scheme to use + # - available: "from-code", "round-robin", "random", "smallest-mailbox", + # "scatter-gather", "broadcast" + # - or: Fully qualified class name of the router class. + # The class must extend akka.routing.CustomRouterConfig and + # have a constructor with com.typesafe.config.Config + # parameter. + # - default is "from-code"; + # Whether or not an actor is transformed to a Router is decided in code + # only (Props.withRouter). The type of router can be overridden in the + # configuration; specifying "from-code" means that the values specified + # in the code shall be used. + # In case of routing, the actors to be routed to can be specified + # in several ways: + # - nr-of-instances: will create that many children + # - routees.paths: will look the paths up using actorFor and route to + # them, i.e. will not create children + # - resizer: dynamically resizable number of routees as specified in + # resizer below + router = "from-code" + + # number of children to create in case of a non-direct router; + # this setting is ignored if routees.paths is given + nr-of-instances = 1 + + # within is the timeout used for routers containing future calls + within = 5 seconds + + # number of virtual nodes per node for consistent-hashing router + virtual-nodes-factor = 10 + + routees { + # Alternatively to giving nr-of-instances you can specify the full + # paths of those actors which should be routed to. This setting takes + # precedence over nr-of-instances + paths = [] + } + + # Routers with dynamically resizable number of routees; this feature is + # enabled by including (parts of) this section in the deployment + resizer { + + # The fewest number of routees the router should ever have. + lower-bound = 1 + + # The most number of routees the router should ever have. + # Must be greater than or equal to lower-bound. + upper-bound = 10 + + # Threshold used to evaluate if a routee is considered to be busy + # (under pressure). Implementation depends on this value (default is 1). + # 0: number of routees currently processing a message. + # 1: number of routees currently processing a message has + # some messages in mailbox. + # > 1: number of routees with at least the configured pressure-threshold + # messages in their mailbox. Note that estimating mailbox size of + # default UnboundedMailbox is O(N) operation. + pressure-threshold = 1 + + # Percentage to increase capacity whenever all routees are busy. + # For example, 0.2 would increase 20% (rounded up), i.e. if current + # capacity is 6 it will request an increase of 2 more routees. + rampup-rate = 0.2 + + # Minimum fraction of busy routees before backing off. + # For example, if this is 0.3, then we'll remove some routees only when + # less than 30% of routees are busy, i.e. if current capacity is 10 and + # 3 are busy then the capacity is unchanged, but if 2 or less are busy + # the capacity is decreased. + # Use 0.0 or negative to avoid removal of routees. + backoff-threshold = 0.3 + + # Fraction of routees to be removed when the resizer reaches the + # backoffThreshold. + # For example, 0.1 would decrease 10% (rounded up), i.e. if current + # capacity is 9 it will request an decrease of 1 routee. + backoff-rate = 0.1 + + # When the resizer reduce the capacity the abandoned routee actors are + # stopped with PoisonPill after this delay. The reason for the delay is + # to give concurrent messages a chance to be placed in mailbox before + # sending PoisonPill. + # Use 0s to skip delay. + stop-delay = 1s + + # Number of messages between resize operation. + # Use 1 to resize before each message. + messages-per-resize = 10 + } + } + } + + # Default dispatcher for Actors that extend Stash + default-stash-dispatcher { + mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox" + } + + default-dispatcher { + # Must be one of the following + # Dispatcher, (BalancingDispatcher, only valid when all actors using it are + # of the same type), PinnedDispatcher, or a FQCN to a class inheriting + # MessageDispatcherConfigurator with a constructor with + # both com.typesafe.config.Config parameter and + # akka.dispatch.DispatcherPrerequisites parameters. + # PinnedDispatcher must be used toghether with executor=thread-pool-executor. + type = "Dispatcher" + + # Which kind of ExecutorService to use for this dispatcher + # Valid options: + # - "fork-join-executor" requires a "fork-join-executor" section + # - "thread-pool-executor" requires a "thread-pool-executor" section + # - A FQCN of a class extending ExecutorServiceConfigurator + executor = "fork-join-executor" + + # This will be used if you have set "executor = "fork-join-executor"" + fork-join-executor { + # Min number of threads to cap factor-based parallelism number to + parallelism-min = 8 + + # The parallelism factor is used to determine thread pool size using the + # following formula: ceil(available processors * factor). Resulting size + # is then bounded by the parallelism-min and parallelism-max values. + parallelism-factor = 3.0 + + # Max number of threads to cap factor-based parallelism number to + parallelism-max = 64 + } + + # This will be used if you have set "executor = "thread-pool-executor"" + thread-pool-executor { + # Keep alive time for threads + keep-alive-time = 60s + + # Min number of threads to cap factor-based core number to + core-pool-size-min = 8 + + # The core pool size factor is used to determine thread pool core size + # using the following formula: ceil(available processors * factor). + # Resulting size is then bounded by the core-pool-size-min and + # core-pool-size-max values. + core-pool-size-factor = 3.0 + + # Max number of threads to cap factor-based number to + core-pool-size-max = 64 + + # Minimum number of threads to cap factor-based max number to + # (if using a bounded task queue) + max-pool-size-min = 8 + + # Max no of threads (if using a bounded task queue) is determined by + # calculating: ceil(available processors * factor) + max-pool-size-factor = 3.0 + + # Max number of threads to cap factor-based max number to + # (if using a bounded task queue) + max-pool-size-max = 64 + + # Specifies the bounded capacity of the task queue (< 1 == unbounded) + task-queue-size = -1 + + # Specifies which type of task queue will be used, can be "array" or + # "linked" (default) + task-queue-type = "linked" + + # Allow core threads to time out + allow-core-timeout = on + } + + # How long time the dispatcher will wait for new actors until it shuts down + shutdown-timeout = 1s + + # Throughput defines the number of messages that are processed in a batch + # before the thread is returned to the pool. Set to 1 for as fair as possible. + throughput = 5 + + # Throughput deadline for Dispatcher, set to 0 or negative for no deadline + throughput-deadline-time = 0ms + + # If negative (or zero) then an unbounded mailbox is used (default) + # If positive then a bounded mailbox is used and the capacity is set using + # the property + # NOTE: setting a mailbox to 'blocking' can be a bit dangerous, could lead + # to deadlock, use with care + # The following mailbox-push-timeout-time is only used for type=Dispatcher + # and only if mailbox-capacity > 0 + mailbox-capacity = -1 + + # Specifies the timeout to add a new message to a mailbox that is full - + # negative number means infinite timeout. It is only used for type=Dispatcher + # and only if mailbox-capacity > 0 + mailbox-push-timeout-time = 10s + + # FQCN of the MailboxType, if not specified the default bounded or unbounded + # mailbox is used. The Class of the FQCN must have a constructor with + # (akka.actor.ActorSystem.Settings, com.typesafe.config.Config) parameters. + mailbox-type = "" + + # For BalancingDispatcher: If the balancing dispatcher should attempt to + # schedule idle actors using the same dispatcher when a message comes in, + # and the dispatchers ExecutorService is not fully busy already. + attempt-teamwork = on + + # For Actor with Stash: The default capacity of the stash. + # If negative (or zero) then an unbounded stash is used (default) + # If positive then a bounded stash is used and the capacity is set using + # the property + stash-capacity = -1 + } + + debug { + # enable function of Actor.loggable(), which is to log any received message + # at DEBUG level, see the “Testing Actor Systems” section of the Akka + # Documentation at http://akka.io/docs + receive = off + + # enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill et.c.) + autoreceive = off + + # enable DEBUG logging of actor lifecycle changes + lifecycle = off + + # enable DEBUG logging of all LoggingFSMs for events, transitions and timers + fsm = off + + # enable DEBUG logging of subscription changes on the eventStream + event-stream = off + + # enable DEBUG logging of unhandled messages + unhandled = off + + # enable WARN logging of misconfigured routers + router-misconfiguration = off + } + + # Entries for pluggable serializers and their bindings. + serializers { + java = "akka.serialization.JavaSerializer" + bytes = "akka.serialization.ByteArraySerializer" + } + + # Class to Serializer binding. You only need to specify the name of an + # interface or abstract base class of the messages. In case of ambiguity it + # is using the most specific configured class, or giving a warning and + # choosing the “first” one. + # + # To disable one of the default serializers, assign its class to "none", like + # "java.io.Serializable" = none + serialization-bindings { + "[B" = bytes + "java.io.Serializable" = java + } + + # Configuration items which are used by the akka.actor.ActorDSL._ methods + dsl { + # Maximum queue size of the actor created by newInbox(); this protects + # against faulty programs which use select() and consistently miss messages + inbox-size = 1000 + + # Default timeout to assume for operations like Inbox.receive et al + default-timeout = 5s + } + } + + # Used to set the behavior of the scheduler. + # Changing the default values may change the system behavior drastically so make + # sure you know what you're doing! See the Scheduler section of the Akka + # Documentation for more details. + scheduler { + # The HashedWheelTimer (HWT) implementation from Netty is used as the default + # scheduler in the system. + # HWT does not execute the scheduled tasks on exact time. + # It will, on every tick, check if there are any tasks behind the schedule + # and execute them. You can increase or decrease the accuracy of the execution + # timing by specifying smaller or larger tick duration. + # If you are scheduling a lot of tasks you should consider increasing the + # ticks per wheel. + # For more information see: http://www.jboss.org/netty/ + tick-duration = 100ms + + # The timer uses a circular wheel of buckets to store the timer tasks. + # This should be set such that the majority of scheduled timeouts (for high + # scheduling frequency) will be shorter than one rotation of the wheel + # (ticks-per-wheel * ticks-duration) + # THIS MUST BE A POWER OF TWO! + ticks-per-wheel = 512 + + # This setting selects the timer implementation which shall be loaded at + # system start-up. Built-in choices are: + # - akka.actor.DefaultScheduler (HWT) + # - akka.actor.LightArrayRevolverScheduler + # (to be benchmarked and evaluated) + # The class given here must implement the akka.actor.Scheduler interface + # and offer a constructor which takes three arguments: + # 1) com.typesafe.config.Config + # 2) akka.event.LoggingAdapter + # 3) java.util.concurrent.ThreadFactory + implementation = akka.actor.LightArrayRevolverScheduler + + # When shutting down the scheduler, there will typically be a thread which + # needs to be stopped, and this timeout determines how long to wait for + # that to happen. In case of timeout the shutdown of the actor system will + # proceed without running possibly still enqueued tasks. + shutdown-timeout = 5s + } + + io { + # In bytes, the size of the shared read buffer. In the span 0b..2GiB. + # + read-buffer-size = 8KiB + + # Specifies how many ops are done between every descriptor selection + select-interval = 100 + + # Number of connections that are allowed in the backlog. + # 0 or negative means that the platform default will be used. + default-backlog = 1000 + } +} diff --git a/akka-osgi/src/main/resources/akka-agent.conf b/akka-osgi/src/main/resources/akka-agent.conf new file mode 100644 index 0000000000..cf57b869de --- /dev/null +++ b/akka-osgi/src/main/resources/akka-agent.conf @@ -0,0 +1,23 @@ +#################################### +# Akka Agent Reference Config File # +#################################### + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. + +akka { + agent { + + # The dispatcher used for agent-send-off actor + send-off-dispatcher { + executor = thread-pool-executor + type = PinnedDispatcher + } + + # The dispatcher used for agent-alter-off actor + alter-off-dispatcher { + executor = thread-pool-executor + type = PinnedDispatcher + } + } +} diff --git a/akka-osgi/src/main/resources/akka-camel.conf b/akka-osgi/src/main/resources/akka-camel.conf new file mode 100644 index 0000000000..12bed5c28b --- /dev/null +++ b/akka-osgi/src/main/resources/akka-camel.conf @@ -0,0 +1,36 @@ +#################################### +# Akka Camel Reference Config File # +#################################### + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. + +akka { + camel { + # Whether JMX should be enabled or disabled for the Camel Context + jmx = off + # enable/disable streaming cache on the Camel Context + streamingCache = on + consumer { + # Configured setting which determines whether one-way communications + # between an endpoint and this consumer actor + # should be auto-acknowledged or application-acknowledged. + # This flag has only effect when exchange is in-only. + auto-ack = on + + # When endpoint is out-capable (can produce responses) reply-timeout is the + # maximum time the endpoint can take to send the response before the message + # exchange fails. This setting is used for out-capable, in-only, + # manually acknowledged communication. + reply-timeout = 1m + + # The duration of time to await activation of an endpoint. + activation-timeout = 10s + } + + #Scheme to FQCN mappings for CamelMessage body conversions + conversions { + "file" = "java.io.InputStream" + } + } +} diff --git a/akka-osgi/src/main/resources/akka-cluster-experimental.conf b/akka-osgi/src/main/resources/akka-cluster-experimental.conf new file mode 100644 index 0000000000..4532c0ff8a --- /dev/null +++ b/akka-osgi/src/main/resources/akka-cluster-experimental.conf @@ -0,0 +1,217 @@ +###################################### +# Akka Cluster Reference Config File # +###################################### + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. + +akka { + + cluster { + # Initial contact points of the cluster. + # The nodes to join at startup if auto-join = on. + # Comma separated full URIs defined by a string on the form of + # "akka://system@hostname:port" + # Leave as empty if the node should be a singleton cluster. + seed-nodes = [] + + # how long to wait for one of the seed nodes to reply to initial join request + seed-node-timeout = 5s + + # Automatic join the seed-nodes at startup. + # If seed-nodes is empty it will join itself and become a single node cluster. + auto-join = on + + # Should the 'leader' in the cluster be allowed to automatically mark + # unreachable nodes as DOWN? + # Using auto-down implies that two separate clusters will automatically be + # formed in case of network partition. + auto-down = off + + # Minimum required number of members before the leader changes member status + # of 'Joining' members to 'Up'. Typically used together with + # 'Cluster.registerOnMemberUp' to defer some action, such as starting actors, + # until the cluster has reached a certain size. + min-nr-of-members = 1 + + # Enable or disable JMX MBeans for management of the cluster + jmx.enabled = on + + # how long should the node wait before starting the periodic tasks + # maintenance tasks? + periodic-tasks-initial-delay = 1s + + # how often should the node send out gossip information? + gossip-interval = 1s + + # how often should the leader perform maintenance tasks? + leader-actions-interval = 1s + + # how often should the node move nodes, marked as unreachable by the failure + # detector, out of the membership ring? + unreachable-nodes-reaper-interval = 1s + + # How often the current internal stats should be published. + # A value of 0 s can be used to always publish the stats, when it happens. + publish-stats-interval = 10s + + # The id of the dispatcher to use for cluster actors. If not specified + # default dispatcher is used. + # If specified you need to define the settings of the actual dispatcher. + use-dispatcher = "" + + # Gossip to random node with newer or older state information, if any with + # this probability. Otherwise Gossip to any random live node. + # Probability value is between 0.0 and 1.0. 0.0 means never, 1.0 means always. + gossip-different-view-probability = 0.8 + + # Limit number of merge conflicts per second that are handled. If the limit is + # exceeded the conflicting gossip messages are dropped and will reappear later. + max-gossip-merge-rate = 5.0 + + failure-detector { + + # FQCN of the failure detector implementation. + # It must implement akka.cluster.FailureDetector and + # have constructor with akka.actor.ActorSystem and + # akka.cluster.ClusterSettings parameters + implementation-class = "akka.cluster.AccrualFailureDetector" + + # how often should the node send out heartbeats? + heartbeat-interval = 1s + + # Number of member nodes that each member will send heartbeat messages to, + # i.e. each node will be monitored by this number of other nodes. + monitored-by-nr-of-members = 5 + + # defines the failure detector threshold + # A low threshold is prone to generate many wrong suspicions but ensures + # a quick detection in the event of a real crash. Conversely, a high + # threshold generates fewer mistakes but needs more time to detect + # actual crashes + threshold = 8.0 + + # Minimum standard deviation to use for the normal distribution in + # AccrualFailureDetector. Too low standard deviation might result in + # too much sensitivity for sudden, but normal, deviations in heartbeat + # inter arrival times. + min-std-deviation = 100 ms + + # Number of potentially lost/delayed heartbeats that will be + # accepted before considering it to be an anomaly. + # It is a factor of heartbeat-interval. + # This margin is important to be able to survive sudden, occasional, + # pauses in heartbeat arrivals, due to for example garbage collect or + # network drop. + acceptable-heartbeat-pause = 3s + + # Number of samples to use for calculation of mean and standard deviation of + # inter-arrival times. + max-sample-size = 1000 + + # When a node stops sending heartbeats to another node it will end that + # with this number of EndHeartbeat messages, which will remove the + # monitoring from the failure detector. + nr-of-end-heartbeats = 8 + + # When no expected heartbeat message has been received an explicit + # heartbeat request is sent to the node that should emit heartbeats. + heartbeat-request { + # Grace period until an explicit heartbeat request is sent + grace-period = 10 s + + # After the heartbeat request has been sent the first failure detection + # will start after this period, even though no heartbeat mesage has + # been received. + expected-response-after = 3 s + + # Cleanup of obsolete heartbeat requests + time-to-live = 60 s + } + } + + metrics { + # Enable or disable metrics collector for load-balancing nodes. + enabled = on + + # FQCN of the metrics collector implementation. + # It must implement akka.cluster.cluster.MetricsCollector and + # have constructor with akka.actor.ActorSystem parameter. + # The default SigarMetricsCollector uses JMX and Hyperic SIGAR, if SIGAR + # is on the classpath, otherwise only JMX. + collector-class = "akka.cluster.SigarMetricsCollector" + + # How often metrics are sampled on a node. + # Shorter interval will collect the metrics more often. + collect-interval = 3s + + # How often a node publishes metrics information. + gossip-interval = 3s + + # How quickly the exponential weighting of past data is decayed compared to + # new data. Set lower to increase the bias toward newer values. + # The relevance of each data sample is halved for every passing half-life duration, + # i.e. after 4 times the half-life, a data sample’s relevance is reduced to 6% of + # its original relevance. The initial relevance of a data sample is given by + # 1 – 0.5 ^ (collect-interval / half-life). + # See http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average + moving-average-half-life = 12s + } + + # If the tick-duration of the default scheduler is longer than the + # tick-duration configured here a dedicated scheduler will be used for + # periodic tasks of the cluster, otherwise the default scheduler is used. + # See akka.scheduler settings for more details about the HashedWheelTimer. + scheduler { + tick-duration = 33ms + ticks-per-wheel = 512 + } + + # Netty blocks when sending to broken connections, and this circuit breaker + # is used to reduce connect attempts to broken connections. + send-circuit-breaker { + max-failures = 3 + call-timeout = 2 s + reset-timeout = 30 s + } + } + + # Default configuration for routers + actor.deployment.default { + # MetricsSelector to use + # - available: "mix", "heap", "cpu", "load" + # - or: Fully qualified class name of the MetricsSelector class. + # The class must extend akka.cluster.routing.MetricsSelector + # and have a constructor with com.typesafe.config.Config + # parameter. + # - default is "mix" + metrics-selector = mix + } + actor.deployment.default.cluster { + # enable cluster aware router that deploys to nodes in the cluster + enabled = off + + # Maximum number of routees that will be deployed on each cluster + # member node. + # Note that nr-of-instances defines total number of routees, but + # number of routees per node will not be exceeded, i.e. if you + # define nr-of-instances = 50 and max-nr-of-instances-per-node = 2 + # it will deploy 2 routees per new member in the cluster, up to + # 25 members. + max-nr-of-instances-per-node = 1 + + # Defines if routees are allowed to be located on the same node as + # the head router actor, or only on remote nodes. + # Useful for master-worker scenario where all routees are remote. + allow-local-routees = on + + # Actor path of the routees to lookup with actorFor on the member + # nodes in the cluster. E.g. "/user/myservice". If this isn't defined + # the routees will be deployed instead of looked up. + # max-nr-of-instances-per-node should not be configured (default value is 1) + # when routees-path is defined. + routees-path = "" + + } + +} diff --git a/akka-osgi/src/main/resources/akka-file-mailbox.conf b/akka-osgi/src/main/resources/akka-file-mailbox.conf new file mode 100644 index 0000000000..66f125e624 --- /dev/null +++ b/akka-osgi/src/main/resources/akka-file-mailbox.conf @@ -0,0 +1,69 @@ +############################################# +# Akka File Mailboxes Reference Config File # +############################################# + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. +# +# For more information see + +akka { + actor { + mailbox { + file-based { + # directory below which this queue resides + directory-path = "./_mb" + + # attempting to add an item after the queue reaches this size (in items) + # will fail. + max-items = 2147483647 + + # attempting to add an item after the queue reaches this size (in bytes) + # will fail. + max-size = 2147483647 bytes + + # attempting to add an item larger than this size (in bytes) will fail. + max-item-size = 2147483647 bytes + + # maximum expiration time for this queue (seconds). + max-age = 0s + + # maximum journal size before the journal should be rotated. + max-journal-size = 16 MiB + + # maximum size of a queue before it drops into read-behind mode. + max-memory-size = 128 MiB + + # maximum overflow (multiplier) of a journal file before we re-create it. + max-journal-overflow = 10 + + # absolute maximum size of a journal file until we rebuild it, + # no matter what. + max-journal-size-absolute = 9223372036854775807 bytes + + # whether to drop older items (instead of newer) when the queue is full + discard-old-when-full = on + + # whether to keep a journal file at all + keep-journal = on + + # whether to sync the journal after each transaction + sync-journal = off + + # circuit breaker configuration + circuit-breaker { + # maximum number of failures before opening breaker + max-failures = 3 + + # duration of time beyond which a call is assumed to be timed out and + # considered a failure + call-timeout = 3 seconds + + # duration of time to wait until attempting to reset the breaker during + # which all calls fail-fast + reset-timeout = 30 seconds + } + } + } + } +} diff --git a/akka-osgi/src/main/resources/akka-osgi.conf b/akka-osgi/src/main/resources/akka-osgi.conf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/akka-osgi/src/main/resources/akka-remote.conf b/akka-osgi/src/main/resources/akka-remote.conf new file mode 100644 index 0000000000..8cf1adccc7 --- /dev/null +++ b/akka-osgi/src/main/resources/akka-remote.conf @@ -0,0 +1,299 @@ +##################################### +# Akka Remote Reference Config File # +##################################### + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. + +# comments about akka.actor settings left out where they are already in akka- +# actor.jar, because otherwise they would be repeated in config rendering. + +akka { + + actor { + + serializers { + proto = "akka.remote.serialization.ProtobufSerializer" + daemon-create = "akka.remote.serialization.DaemonMsgCreateSerializer" + } + + + serialization-bindings { + # Since com.google.protobuf.Message does not extend Serializable but + # GeneratedMessage does, need to use the more specific one here in order + # to avoid ambiguity + "com.google.protobuf.GeneratedMessage" = proto + "akka.remote.DaemonMsgCreate" = daemon-create + } + + deployment { + + default { + + # if this is set to a valid remote address, the named actor will be + # deployed at that node e.g. "akka://sys@host:port" + remote = "" + + target { + + # A list of hostnames and ports for instantiating the children of a + # non-direct router + # The format should be on "akka://sys@host:port", where: + # - sys is the remote actor system name + # - hostname can be either hostname or IP address the remote actor + # should connect to + # - port should be the port for the remote server on the other node + # The number of actor instances to be spawned is still taken from the + # nr-of-instances setting as for local routers; the instances will be + # distributed round-robin among the given nodes. + nodes = [] + + } + } + } + } + + remote { + + ### General settings + + # Timeout after which the startup of the remoting subsystem is considered to be failed. + # Increase this value if your transport drivers (see the enabled-transports section) + # need longer time to be loaded. + startup-timeout = 5 s + + # Timout after which the graceful shutdown of the remoting subsystem is considered to be failed. + # After the timeout the remoting system is forcefully shut down. + # Increase this value if your transport drivers (see the enabled-transports section) + # need longer time to stop properly. + shutdown-timeout = 5 s + + # Before shutting down the drivers, the remoting subsystem attempts to flush all pending + # writes. This setting controls the maximum time the remoting is willing to wait before + # moving on to shut down the drivers. + flush-wait-on-shutdown = 2 s + + # Reuse inbound connections for outbound messages + use-passive-connections = on + + # Dispatcher that the actors responsible to write to a connection will use. + # The mailbox type must be always a DequeBasedMailbox. + writer-dispatcher { + mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox" + } + + # If enabled, an inbound connection is only considered to be live after the remote + # system sent an explicit acknowledgement. + # It is recommended to leave this setting on when connectionless transports (e.g. UDP) + # are used. + wait-activity-enabled = on + + # Controls the backoff interval after a refused write is reattempted. (Transports may + # refuse writes if their internal buffer is full) + backoff-interval = 0.01 s + + # Acknowledgment timeout of management commands sent to the transport stack. + command-ack-timeout = 30 s + + ### Security settings + + # Enable untrusted mode for full security of server managed actors, prevents + # system messages to be send by clients, e.g. messages like 'Create', + # 'Suspend', 'Resume', 'Terminate', 'Supervise', 'Link' etc. + untrusted-mode = off + + # Should the remote server require that its peers share the same + # secure-cookie (defined in the 'remote' section)? Secure cookies are passed + # between during the initial handshake. Connections are refused if the initial + # message contains a mismatching cookie or the cookie is missing. + require-cookie = off + + # Generate your own with the script availbale in + # '$AKKA_HOME/scripts/generate_config_with_secure_cookie.sh' or using + # 'akka.util.Crypt.generateSecureCookie' + secure-cookie = "" + + ### Logging + + # If this is "on", Akka will log all inbound messages at DEBUG level, + # if off then they are not logged + log-received-messages = off + + # If this is "on", Akka will log all outbound messages at DEBUG level, + # if off then they are not logged + log-sent-messages = off + + # If this is "on", Akka will log all RemoteLifeCycleEvents at the level + # defined for each, if off then they are not logged. Failures to deserialize + # received messages also fall under this flag. + log-remote-lifecycle-events = off + + ### Failure detection and recovery + + # how often should keep-alive heartbeat messages sent to connections. + heartbeat-interval = 1 s + + # Settings for the Phi accrual failure detector (http://ddg.jaist.ac.jp/pub/HDY+04.pdf + # [Hayashibara et al]) used by the remoting subsystem to detect failed connections. + failure-detector { + # defines the failure detector threshold + # A low threshold is prone to generate many wrong suspicions but ensures + # a quick detection in the event of a real crash. Conversely, a high + # threshold generates fewer mistakes but needs more time to detect + # actual crashes + threshold = 7.0 + + # Number of the samples of inter-heartbeat arrival times to adaptively + # calculate the failure timeout for connections. + max-sample-size = 100 + + # Minimum standard deviation to use for the normal distribution in + # AccrualFailureDetector. Too low standard deviation might result in + # too much sensitivity for sudden, but normal, deviations in heartbeat + # inter arrival times. + min-std-deviation = 100 ms + + # Number of potentially lost/delayed heartbeats that will be + # accepted before considering it to be an anomaly. + # It is a factor of heartbeat-interval. + # This margin is important to be able to survive sudden, occasional, + # pauses in heartbeat arrivals, due to for example garbage collect or + # network drop. + acceptable-heartbeat-pause = 3 s + } + + # After failed to establish an outbound connection, the remoting will mark the + # address as failed. This configuration option controls how much time should + # be elapsed before reattempting a new connection. While the address is + # gated, all messages sent to the address are delivered to dead-letters. + # If this setting is 0, the remoting will always immediately reattempt + # to establish a failed outbound connection and will buffer writes until + # it succeeds. + retry-gate-closed-for = 0 s + + # If the retry gate function is disabled (see retry-gate-closed-for) the + # remoting subsystem will always attempt to reestablish failed outbound + # connections. The settings below together control the maximum number of + # reattempts in a given time window. The number of reattempts during + # a window of "retry-window" will be maximum "maximum-retries-in-window". + retry-window = 3 s + maximum-retries-in-window = 5 + + ### Transports and adapters + + # List of the transport drivers that will be loaded by the remoting. + # A list of fully qualified config paths must be provided where + # the given configuration path contains a transport-class key + # pointing to an implementation class of the Transport interface. + # If multiple transports are provided, the address of the first + # one will be used as a default address. + enabled-transports = ["akka.remote.netty.tcp"] + + # Transport drivers can be augmented with adapters by adding their + # name to the applied-adapters setting in the configuration of a + # transport. The available adapters should be configured in this + # section by providing a name, and the fully qualified name of + # their corresponding implementation + adapters { + gremlin = "akka.remote.transport.FailureInjectorProvider" + trttl = "akka.remote.transport.ThrottlerProvider" + } + + ### Default configuration for the Netty based transport drivers + + netty.tcp { + transport-class = "akka.remote.transport.netty.NettyTransport" + + # Transport drivers can be augmented with adapters by adding their + # name to the applied-adapters list. The last adapter in the + # list is the adapter immediately above the driver, while + # the first one is the top of the stack below the standard + # Akka protocol + applied-adapters = [] + + transport-protocol = tcp + + # The default remote server port clients should connect to. + # Default is 2552 (AKKA), use 0 if you want a random available port + # This port needs to be unique for each actor system on the same machine. + port = 2552 + + # The hostname or ip to bind the remoting to, + # InetAddress.getLocalHost.getHostAddress is used if empty + hostname = "" + + # Enables SSL support on this transport + enable-ssl = false + + # Sets the connectTimeoutMillis of all outbound connections, + # i.e. how long a connect may take until it is timed out + connection-timeout = 120s + + # If set to "" then the specified dispatcher + # will be used to accept inbound connections, and perform IO. If "" then + # dedicated threads will be used. + use-dispatcher-for-io = "" + + # Sets the high water mark for the in and outbound sockets, + # set to 0b for platform default + write-buffer-high-water-mark = 0b + + # Sets the low water mark for the in and outbound sockets, + # set to 0b for platform default + write-buffer-low-water-mark = 0b + + # Sets the send buffer size of the Sockets, + # set to 0b for platform default + send-buffer-size = 32000b + + # Sets the receive buffer size of the Sockets, + # set to 0b for platform default + receive-buffer-size = 32000b + + # Sets the size of the connection backlog + backlog = 4096 + + # Used to configure the number of I/O worker threads on server sockets + server-socket-worker-pool { + # Min number of threads to cap factor-based number to + pool-size-min = 2 + + # The pool size factor is used to determine thread pool size + # using the following formula: ceil(available processors * factor). + # Resulting size is then bounded by the pool-size-min and + # pool-size-max values. + pool-size-factor = 1.0 + + # Max number of threads to cap factor-based number to + pool-size-max = 8 + } + + # Used to configure the number of I/O worker threads on client sockets + client-socket-worker-pool { + # Min number of threads to cap factor-based number to + pool-size-min = 2 + + # The pool size factor is used to determine thread pool size + # using the following formula: ceil(available processors * factor). + # Resulting size is then bounded by the pool-size-min and + # pool-size-max values. + pool-size-factor = 1.0 + + # Max number of threads to cap factor-based number to + pool-size-max = 8 + } + } + + netty.udp = ${akka.remote.netty.tcp} + netty.udp { + transport-protocol = udp + } + + netty.ssl = ${akka.remote.netty.tcp} + netty.ssl = { + enable-ssl = true + } + + } + +} diff --git a/akka-osgi/src/main/resources/akka-transactor.conf b/akka-osgi/src/main/resources/akka-transactor.conf new file mode 100644 index 0000000000..d1216bd73e --- /dev/null +++ b/akka-osgi/src/main/resources/akka-transactor.conf @@ -0,0 +1,13 @@ +######################################### +# Akka Transactor Reference Config File # +######################################### + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. + +akka { + transactor { + # The timeout used for coordinated transactions across actors + coordinated-timeout = 5s + } +} diff --git a/akka-osgi/src/main/resources/akka-zeromq.conf b/akka-osgi/src/main/resources/akka-zeromq.conf new file mode 100644 index 0000000000..6a83e1a166 --- /dev/null +++ b/akka-osgi/src/main/resources/akka-zeromq.conf @@ -0,0 +1,26 @@ +##################################### +# Akka ZeroMQ Reference Config File # +##################################### + +# This is the reference config file that contains all the default settings. +# Make your edits/overrides in your application.conf. + +akka { + + zeromq { + + # The default timeout for a poll on the actual zeromq socket. + poll-timeout = 100ms + + # Timeout for creating a new socket + new-socket-timeout = 5s + + socket-dispatcher { + # A zeromq socket needs to be pinned to the thread that created it. + # Changing this value results in weird errors and race conditions within + # zeromq + executor = thread-pool-executor + type = "PinnedDispatcher" + } + } +} diff --git a/akka-osgi/src/main/resources/reference.conf b/akka-osgi/src/main/resources/reference.conf new file mode 100644 index 0000000000..70545b2e2d --- /dev/null +++ b/akka-osgi/src/main/resources/reference.conf @@ -0,0 +1,9 @@ +include "akka-actor.conf" +include "akka-agent.conf" +include "akka-camel.conf" +include "akka-cluster-experimental.conf" +include "akka-file-mailbox.conf" +include "akka-osgi.conf" +include "akka-remote.conf" +include "akka-transactor.conf" +include "akka-zeromq.conf" \ No newline at end of file