Configuration
Loading

Configuration

You can start using Akka without defining any configuration, since sensible default values are provided. Later on you might need to amend the settings to change the default behavior or adapt for specific runtime environments. Typical examples of settings that you might amend:

  • log level and logger backend
  • enable remoting
  • message serializers
  • definition of routers
  • tuning of dispatchers

Akka uses the Typesafe Config Library, which might also be a good choice for the configuration of your own application or library built with or without Akka. This library is implemented in Java with no external dependencies; you should have a look at its documentation (in particular about ConfigFactory), which is only summarized in the following.

Warning

If you use Akka from the Scala REPL from the 2.9.x series, and you do not provide your own ClassLoader to the ActorSystem, start the REPL with "-Yrepl-sync" to work around a deficiency in the REPLs provided Context ClassLoader.

Where configuration is read from

All configuration for Akka is held within instances of ActorSystem, or put differently, as viewed from the outside, ActorSystem is the only consumer of configuration information. While constructing an actor system, you can either pass in a Config object or not, where the second case is equivalent to passing ConfigFactory.load() (with the right class loader). This means roughly that the default is to parse all application.conf, application.json and application.properties found at the root of the class path—please refer to the aforementioned documentation for details. The actor system then merges in all reference.conf resources found at the root of the class path to form the fallback configuration, i.e. it internally uses

  1. appConfig.withFallback(ConfigFactory.defaultReference(classLoader))

The philosophy is that code never contains default values, but instead relies upon their presence in the reference.conf supplied with the library in question.

Highest precedence is given to overrides given as system properties, see the HOCON specification (near the bottom). Also noteworthy is that the application configuration—which defaults to application—may be overridden using the config.resource property (there are more, please refer to the Config docs).

Note

If you are writing an Akka application, keep you configuration in application.conf at the root of the class path. If you are writing an Akka-based library, keep its configuration in reference.conf at the root of the JAR file.

When using JarJar, OneJar, Assembly or any jar-bundler

Warning

Akka's configuration approach relies heavily on the notion of every module/jar having its own reference.conf file, all of these will be discovered by the configuration and loaded. Unfortunately this also means that if you put/merge multiple jars into the same jar, you need to merge all the reference.confs as well. Otherwise all defaults will be lost and Akka will not function.

Custom application.conf

A custom application.conf might look like this:

  1. # In this file you can override any option defined in the reference files.
  2. # Copy in parts of the reference files and modify as you please.
  3.  
  4. akka {
  5.  
  6. # Event handlers to register at boot time (Logging$DefaultLogger logs to STDOUT)
  7. event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
  8.  
  9. # Log level used by the configured loggers (see "event-handlers") as soon
  10. # as they have been started; before that, see "stdout-loglevel"
  11. # Options: OFF, ERROR, WARNING, INFO, DEBUG
  12. loglevel = "DEBUG"
  13.  
  14. # Log level for the very basic logger activated during AkkaApplication startup
  15. # Options: OFF, ERROR, WARNING, INFO, DEBUG
  16. stdout-loglevel = "DEBUG"
  17.  
  18. actor {
  19. default-dispatcher {
  20. # Throughput for default Dispatcher, set to 1 for as fair as possible
  21. throughput = 10
  22. }
  23. }
  24.  
  25. remote {
  26. server {
  27. # The port clients should connect to. Default is 2552 (AKKA)
  28. port = 2562
  29. }
  30. }
  31. }

Including files

Sometimes it can be useful to include another configuration file, for example if you have one application.conf with all environment independent settings and then override some settings for specific environments.

Specifying system property with -Dconfig.resource=/dev.conf will load the dev.conf file, which includes the application.conf

dev.conf:

  1. include "application"
  2.  
  3. akka {
  4. loglevel = "DEBUG"
  5. }

More advanced include and substitution mechanisms are explained in the HOCON specification.

Logging of Configuration

If the system or config property akka.log-config-on-start is set to on, then the complete configuration at INFO level when the actor system is started. This is useful when you are uncertain of what configuration is used.

If in doubt, you can also easily and nicely inspect configuration objects before or after using them to construct an actor system:

  1. Welcome to Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
  2. Type in expressions to have them evaluated.
  3. Type :help for more information.
  4.  
  5. scala> import com.typesafe.config._
  6. import com.typesafe.config._
  7.  
  8. scala> ConfigFactory.parseString("a.b=12")
  9. res0: com.typesafe.config.Config = Config(SimpleConfigObject({"a" : {"b" : 12}}))
  10.  
  11. scala> res0.root.render
  12. res1: java.lang.String =
  13. {
  14. # String: 1
  15. "a" : {
  16. # String: 1
  17. "b" : 12
  18. }
  19. }

The comments preceding every item give detailed information about the origin of the setting (file & line number) plus possible comments which were present, e.g. in the reference configuration. The settings as merged with the reference and parsed by the actor system can be displayed like this:

  1. final ActorSystem system = ActorSystem.create();
  2. println(system.settings());
  3. // this is a shortcut for system.settings().config().root().render()

A Word About ClassLoaders

In several places of the configuration file it is possible to specify the fully-qualified class name of something to be instantiated by Akka. This is done using Java reflection, which in turn uses a ClassLoader. Getting the right one in challenging environments like application containers or OSGi bundles is not always trivial, the current approach of Akka is that each ActorSystem implementation stores the current thread’s context class loader (if available, otherwise just its own loader as in this.getClass.getClassLoader) and uses that for all reflective accesses. This implies that putting Akka on the boot class path will yield NullPointerException from strange places: this is simply not supported.

Application specific settings

The configuration can also be used for application specific settings. A good practice is to place those settings in an Extension, as described in:

Configuring multiple ActorSystem

If you have more than one ActorSystem (or you're writing a library and have an ActorSystem that may be separate from the application's) you may want to separate the configuration for each system.

Given that ConfigFactory.load() merges all resources with matching name from the whole class path, it is easiest to utilize that functionality and differentiate actor systems within the hierarchy of the configuration:

  1. myapp1 {
  2. akka.loglevel = "WARNING"
  3. my.own.setting = 43
  4. }
  5. myapp2 {
  6. akka.loglevel = "ERROR"
  7. app2.setting = "appname"
  8. }
  9. my.own.setting = 42
  10. my.other.setting = "hello"
  1. val config = ConfigFactory.load()
  2. val app1 = ActorSystem("MyApp1", config.getConfig("myapp1").withFallback(config))
  3. val app2 = ActorSystem("MyApp2",
  4. config.getConfig("myapp2").withOnlyPath("akka").withFallback(config))

These two samples demonstrate different variations of the “lift-a-subtree” trick: in the first case, the configuration accessible from within the actor system is this

  1. akka.loglevel = "WARNING"
  2. my.own.setting = 43
  3. my.other.setting = "hello"
  4. // plus myapp1 and myapp2 subtrees

while in the second one, only the “akka” subtree is lifted, with the following result

  1. akka.loglevel = "ERROR"
  2. my.own.setting = 42
  3. my.other.setting = "hello"
  4. // plus myapp1 and myapp2 subtrees

Note

The configuration library is really powerful, explaining all features exceeds the scope affordable here. In particular not covered are how to include other configuration files within other files (see a small example at Including files) and copying parts of the configuration tree by way of path substitutions.

You may also specify and parse the configuration programmatically in other ways when instantiating the ActorSystem.

  1. import akka.actor.ActorSystem
  2. import com.typesafe.config.ConfigFactory
  3. val customConf = ConfigFactory.parseString("""
  4. akka.actor.deployment {
  5. /my-service {
  6. router = round-robin
  7. nr-of-instances = 3
  8. }
  9. }
  10. """)
  11. // ConfigFactory.load sandwiches customConfig between default reference
  12. // config and default overrides, and then resolves it.
  13. val system = ActorSystem("MySystem", ConfigFactory.load(customConf))

Reading configuration from a custom location

You can replace or supplement application.conf either in code or using system properties.

If you're using ConfigFactory.load() (which Akka does by default) you can replace application.conf by defining -Dconfig.resource=whatever, -Dconfig.file=whatever, or -Dconfig.url=whatever.

From inside your replacement file specified with -Dconfig.resource and friends, you can include "application" if you still want to use application.{conf,json,properties} as well. Settings specified before include "application" would be overridden by the included file, while those after would override the included file.

In code, there are many customization options.

There are several overloads of ConfigFactory.load(); these allow you to specify something to be sandwiched between system properties (which override) and the defaults (from reference.conf), replacing the usual application.{conf,json,properties} and replacing -Dconfig.file and friends.

The simplest variant of ConfigFactory.load() takes a resource basename (instead of application); myname.conf, myname.json, and myname.properties would then be used instead of application.{conf,json,properties}.

The most flexible variant takes a Config object, which you can load using any method in ConfigFactory. For example you could put a config string in code using ConfigFactory.parseString() or you could make a map and ConfigFactory.parseMap(), or you could load a file.

You can also combine your custom config with the usual config, that might look like:

  1. // make a Config with just your special setting
  2. Config myConfig =
  3. ConfigFactory.parseString("something=somethingElse");
  4. // load the normal config stack (system props,
  5. // then application.conf, then reference.conf)
  6. Config regularConfig =
  7. ConfigFactory.load();
  8. // override regular stack with myConfig
  9. Config combined =
  10. myConfig.withFallback(regularConfig);
  11. // put the result in between the overrides
  12. // (system props) and defaults again
  13. Config complete =
  14. ConfigFactory.load(combined);
  15. // create ActorSystem
  16. ActorSystem system =
  17. ActorSystem.create("myname", complete);

When working with Config objects, keep in mind that there are three "layers" in the cake:

  • ConfigFactory.defaultOverrides() (system properties)
  • the app's settings
  • ConfigFactory.defaultReference() (reference.conf)

The normal goal is to customize the middle layer while leaving the other two alone.

  • ConfigFactory.load() loads the whole stack
  • the overloads of ConfigFactory.load() let you specify a different middle layer
  • the ConfigFactory.parse() variations load single files or resources

To stack two layers, use override.withFallback(fallback); try to keep system props (defaultOverrides()) on top and reference.conf (defaultReference()) on the bottom.

Do keep in mind, you can often just add another include statement in application.conf rather than writing code. Includes at the top of application.conf will be overridden by the rest of application.conf, while those at the bottom will override the earlier stuff.

Listing of the Reference Configuration

Each Akka module has a reference configuration file with the default values.

akka-actor

  1. ####################################
  2. # Akka Actor Reference Config File #
  3. ####################################
  4.  
  5. # This is the reference config file that contains all the default settings.
  6. # Make your edits/overrides in your application.conf.
  7.  
  8. akka {
  9. # Akka version, checked against the runtime version of Akka.
  10. version = "2.1.4"
  11.  
  12. # Home directory of Akka, modules in the deploy directory will be loaded
  13. home = ""
  14.  
  15. # Event handlers to register at boot time (Logging$DefaultLogger logs to STDOUT)
  16. event-handlers = ["akka.event.Logging$DefaultLogger"]
  17.  
  18. # Event handlers are created and registered synchronously during ActorSystem
  19. # start-up, and since they are actors, this timeout is used to bound the
  20. # waiting time
  21. event-handler-startup-timeout = 5s
  22.  
  23. # Log level used by the configured loggers (see "event-handlers") as soon
  24. # as they have been started; before that, see "stdout-loglevel"
  25. # Options: OFF, ERROR, WARNING, INFO, DEBUG
  26. loglevel = "INFO"
  27.  
  28. # Log level for the very basic logger activated during AkkaApplication startup
  29. # Options: OFF, ERROR, WARNING, INFO, DEBUG
  30. stdout-loglevel = "WARNING"
  31.  
  32. # Log the complete configuration at INFO level when the actor system is started.
  33. # This is useful when you are uncertain of what configuration is used.
  34. log-config-on-start = off
  35.  
  36. # List FQCN of extensions which shall be loaded at actor system startup.
  37. # Should be on the format: 'extensions = ["foo", "bar"]' etc.
  38. # See the Akka Documentation for more info about Extensions
  39. extensions = []
  40.  
  41. # Toggles whether threads created by this ActorSystem should be daemons or not
  42. daemonic = off
  43.  
  44. # JVM shutdown, System.exit(-1), in case of a fatal error,
  45. # such as OutOfMemoryError
  46. jvm-exit-on-fatal-error = on
  47.  
  48. actor {
  49.  
  50. # FQCN of the ActorRefProvider to be used; the below is the built-in default,
  51. # another one is akka.remote.RemoteActorRefProvider in the akka-remote bundle.
  52. provider = "akka.actor.LocalActorRefProvider"
  53.  
  54. # The guardian "/user" will use this class to obtain its supervisorStrategy.
  55. # It needs to be a subclass of akka.actor.SupervisorStrategyConfigurator.
  56. # In addition to the default there is akka.actor.StoppingSupervisorStrategy.
  57. guardian-supervisor-strategy = "akka.actor.DefaultSupervisorStrategy"
  58.  
  59. # Timeout for ActorSystem.actorOf
  60. creation-timeout = 20s
  61.  
  62. # Frequency with which stopping actors are prodded in case they had to be
  63. # removed from their parents
  64. reaper-interval = 5s
  65.  
  66. # Serializes and deserializes (non-primitive) messages to ensure immutability,
  67. # this is only intended for testing.
  68. serialize-messages = off
  69.  
  70. # Serializes and deserializes creators (in Props) to ensure that they can be
  71. # sent over the network, this is only intended for testing.
  72. serialize-creators = off
  73.  
  74. # Timeout for send operations to top-level actors which are in the process
  75. # of being started. This is only relevant if using a bounded mailbox or the
  76. # CallingThreadDispatcher for a top-level actor.
  77. unstarted-push-timeout = 10s
  78.  
  79. typed {
  80. # Default timeout for typed actor methods with non-void return type
  81. timeout = 5s
  82. }
  83.  
  84. deployment {
  85.  
  86. # deployment id pattern - on the format: /parent/child etc.
  87. default {
  88.  
  89. # routing (load-balance) scheme to use
  90. # - available: "from-code", "round-robin", "random", "smallest-mailbox",
  91. # "scatter-gather", "broadcast"
  92. # - or: Fully qualified class name of the router class.
  93. # The class must extend akka.routing.CustomRouterConfig and
  94. # have a constructor with com.typesafe.config.Config
  95. # parameter.
  96. # - default is "from-code";
  97. # Whether or not an actor is transformed to a Router is decided in code
  98. # only (Props.withRouter). The type of router can be overridden in the
  99. # configuration; specifying "from-code" means that the values specified
  100. # in the code shall be used.
  101. # In case of routing, the actors to be routed to can be specified
  102. # in several ways:
  103. # - nr-of-instances: will create that many children
  104. # - routees.paths: will look the paths up using actorFor and route to
  105. # them, i.e. will not create children
  106. # - resizer: dynamically resizable number of routees as specified in
  107. # resizer below
  108. router = "from-code"
  109.  
  110. # number of children to create in case of a router;
  111. # this setting is ignored if routees.paths is given
  112. nr-of-instances = 1
  113.  
  114. # within is the timeout used for routers containing future calls
  115. within = 5 seconds
  116.  
  117. # number of virtual nodes per node for consistent-hashing router
  118. virtual-nodes-factor = 10
  119.  
  120. routees {
  121. # Alternatively to giving nr-of-instances you can specify the full
  122. # paths of those actors which should be routed to. This setting takes
  123. # precedence over nr-of-instances
  124. paths = []
  125. }
  126.  
  127. # Routers with dynamically resizable number of routees; this feature is
  128. # enabled by including (parts of) this section in the deployment
  129. resizer {
  130.  
  131. # The fewest number of routees the router should ever have.
  132. lower-bound = 1
  133.  
  134. # The most number of routees the router should ever have.
  135. # Must be greater than or equal to lower-bound.
  136. upper-bound = 10
  137.  
  138. # Threshold used to evaluate if a routee is considered to be busy
  139. # (under pressure). Implementation depends on this value (default is 1).
  140. # 0: number of routees currently processing a message.
  141. # 1: number of routees currently processing a message has
  142. # some messages in mailbox.
  143. # > 1: number of routees with at least the configured pressure-threshold
  144. # messages in their mailbox. Note that estimating mailbox size of
  145. # default UnboundedMailbox is O(N) operation.
  146. pressure-threshold = 1
  147.  
  148. # Percentage to increase capacity whenever all routees are busy.
  149. # For example, 0.2 would increase 20% (rounded up), i.e. if current
  150. # capacity is 6 it will request an increase of 2 more routees.
  151. rampup-rate = 0.2
  152.  
  153. # Minimum fraction of busy routees before backing off.
  154. # For example, if this is 0.3, then we'll remove some routees only when
  155. # less than 30% of routees are busy, i.e. if current capacity is 10 and
  156. # 3 are busy then the capacity is unchanged, but if 2 or less are busy
  157. # the capacity is decreased.
  158. # Use 0.0 or negative to avoid removal of routees.
  159. backoff-threshold = 0.3
  160.  
  161. # Fraction of routees to be removed when the resizer reaches the
  162. # backoffThreshold.
  163. # For example, 0.1 would decrease 10% (rounded up), i.e. if current
  164. # capacity is 9 it will request an decrease of 1 routee.
  165. backoff-rate = 0.1
  166.  
  167. # When the resizer reduce the capacity the abandoned routee actors are
  168. # stopped with PoisonPill after this delay. The reason for the delay is
  169. # to give concurrent messages a chance to be placed in mailbox before
  170. # sending PoisonPill.
  171. # Use 0s to skip delay.
  172. stop-delay = 1s
  173.  
  174. # Number of messages between resize operation.
  175. # Use 1 to resize before each message.
  176. messages-per-resize = 10
  177. }
  178. }
  179. }
  180.  
  181. # Default dispatcher for Actors that extend Stash
  182. default-stash-dispatcher {
  183. mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox"
  184. }
  185.  
  186. default-dispatcher {
  187. # Must be one of the following
  188. # Dispatcher, (BalancingDispatcher, only valid when all actors using it are
  189. # of the same type), PinnedDispatcher, or a FQCN to a class inheriting
  190. # MessageDispatcherConfigurator with a constructor with
  191. # both com.typesafe.config.Config parameter and
  192. # akka.dispatch.DispatcherPrerequisites parameters.
  193. # PinnedDispatcher must be used toghether with executor=thread-pool-executor.
  194. type = "Dispatcher"
  195.  
  196. # Which kind of ExecutorService to use for this dispatcher
  197. # Valid options:
  198. # - "fork-join-executor" requires a "fork-join-executor" section
  199. # - "thread-pool-executor" requires a "thread-pool-executor" section
  200. # - A FQCN of a class extending ExecutorServiceConfigurator
  201. executor = "fork-join-executor"
  202.  
  203. # This will be used if you have set "executor = "fork-join-executor""
  204. fork-join-executor {
  205. # Min number of threads to cap factor-based parallelism number to
  206. parallelism-min = 8
  207.  
  208. # The parallelism factor is used to determine thread pool size using the
  209. # following formula: ceil(available processors * factor). Resulting size
  210. # is then bounded by the parallelism-min and parallelism-max values.
  211. parallelism-factor = 3.0
  212.  
  213. # Max number of threads to cap factor-based parallelism number to
  214. parallelism-max = 64
  215. }
  216.  
  217. # This will be used if you have set "executor = "thread-pool-executor""
  218. thread-pool-executor {
  219. # Keep alive time for threads
  220. keep-alive-time = 60s
  221.  
  222. # Min number of threads to cap factor-based core number to
  223. core-pool-size-min = 8
  224.  
  225. # The core pool size factor is used to determine thread pool core size
  226. # using the following formula: ceil(available processors * factor).
  227. # Resulting size is then bounded by the core-pool-size-min and
  228. # core-pool-size-max values.
  229. core-pool-size-factor = 3.0
  230.  
  231. # Max number of threads to cap factor-based number to
  232. core-pool-size-max = 64
  233.  
  234. # Minimum number of threads to cap factor-based max number to
  235. # (if using a bounded task queue)
  236. max-pool-size-min = 8
  237.  
  238. # Max no of threads (if using a bounded task queue) is determined by
  239. # calculating: ceil(available processors * factor)
  240. max-pool-size-factor = 3.0
  241.  
  242. # Max number of threads to cap factor-based max number to
  243. # (if using a bounded task queue)
  244. max-pool-size-max = 64
  245.  
  246. # Specifies the bounded capacity of the task queue (< 1 == unbounded)
  247. task-queue-size = -1
  248.  
  249. # Specifies which type of task queue will be used, can be "array" or
  250. # "linked" (default)
  251. task-queue-type = "linked"
  252.  
  253. # Allow core threads to time out
  254. allow-core-timeout = on
  255. }
  256.  
  257. # How long time the dispatcher will wait for new actors until it shuts down
  258. shutdown-timeout = 1s
  259.  
  260. # Throughput defines the number of messages that are processed in a batch
  261. # before the thread is returned to the pool. Set to 1 for as fair as possible.
  262. throughput = 5
  263.  
  264. # Throughput deadline for Dispatcher, set to 0 or negative for no deadline
  265. throughput-deadline-time = 0ms
  266.  
  267. # If negative (or zero) then an unbounded mailbox is used (default)
  268. # If positive then a bounded mailbox is used and the capacity is set using
  269. # the property
  270. # NOTE: setting a mailbox to 'blocking' can be a bit dangerous, could lead
  271. # to deadlock, use with care
  272. # The following mailbox-push-timeout-time is only used for type=Dispatcher
  273. # and only if mailbox-capacity > 0
  274. mailbox-capacity = -1
  275.  
  276. # Specifies the timeout to add a new message to a mailbox that is full -
  277. # negative number means infinite timeout. It is only used for type=Dispatcher
  278. # and only if mailbox-capacity > 0
  279. mailbox-push-timeout-time = 10s
  280.  
  281. # FQCN of the MailboxType, if not specified the default bounded or unbounded
  282. # mailbox is used. The Class of the FQCN must have a constructor with
  283. # (akka.actor.ActorSystem.Settings, com.typesafe.config.Config) parameters.
  284. mailbox-type = ""
  285.  
  286. # For BalancingDispatcher: If the balancing dispatcher should attempt to
  287. # schedule idle actors using the same dispatcher when a message comes in,
  288. # and the dispatchers ExecutorService is not fully busy already.
  289. attempt-teamwork = on
  290.  
  291. # For Actor with Stash: The default capacity of the stash.
  292. # If negative (or zero) then an unbounded stash is used (default)
  293. # If positive then a bounded stash is used and the capacity is set using
  294. # the property
  295. stash-capacity = -1
  296. }
  297.  
  298. debug {
  299. # enable function of Actor.loggable(), which is to log any received message
  300. # at DEBUG level, see the “Testing Actor Systems” section of the Akka
  301. # Documentation at https://akka.io/docs
  302. receive = off
  303.  
  304. # enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill et.c.)
  305. autoreceive = off
  306.  
  307. # enable DEBUG logging of actor lifecycle changes
  308. lifecycle = off
  309.  
  310. # enable DEBUG logging of all LoggingFSMs for events, transitions and timers
  311. fsm = off
  312.  
  313. # enable DEBUG logging of subscription changes on the eventStream
  314. event-stream = off
  315.  
  316. # enable DEBUG logging of unhandled messages
  317. unhandled = off
  318.  
  319. # enable WARN logging of misconfigured routers
  320. router-misconfiguration = off
  321. }
  322.  
  323. # Entries for pluggable serializers and their bindings.
  324. serializers {
  325. java = "akka.serialization.JavaSerializer"
  326. bytes = "akka.serialization.ByteArraySerializer"
  327. }
  328.  
  329. # Class to Serializer binding. You only need to specify the name of an
  330. # interface or abstract base class of the messages. In case of ambiguity it
  331. # is using the most specific configured class, or giving a warning and
  332. # choosing the “first” one.
  333. #
  334. # To disable one of the default serializers, assign its class to "none", like
  335. # "java.io.Serializable" = none
  336. serialization-bindings {
  337. "[B" = bytes
  338. "java.io.Serializable" = java
  339. }
  340.  
  341. # Configuration items which are used by the akka.actor.ActorDSL._ methods
  342. dsl {
  343. # Maximum queue size of the actor created by newInbox(); this protects
  344. # against faulty programs which use select() and consistently miss messages
  345. inbox-size = 1000
  346.  
  347. # Default timeout to assume for operations like Inbox.receive et al
  348. default-timeout = 5s
  349. }
  350. }
  351.  
  352. # Used to set the behavior of the scheduler.
  353. # Changing the default values may change the system behavior drastically so make
  354. # sure you know what you're doing! See the Scheduler section of the Akka
  355. # Documentation for more details.
  356. scheduler {
  357. # The HashedWheelTimer (HWT) implementation from Netty is used as the default
  358. # scheduler in the system.
  359. # HWT does not execute the scheduled tasks on exact time.
  360. # It will, on every tick, check if there are any tasks behind the schedule
  361. # and execute them. You can increase or decrease the accuracy of the execution
  362. # timing by specifying smaller or larger tick duration.
  363. # If you are scheduling a lot of tasks you should consider increasing the
  364. # ticks per wheel.
  365. # For more information see: http://www.jboss.org/netty/
  366. tick-duration = 100ms
  367. ticks-per-wheel = 512
  368. }
  369.  
  370. io {
  371. # In bytes, the size of the shared read buffer. In the span 0b..2GiB.
  372. #
  373. read-buffer-size = 8KiB
  374.  
  375. # Specifies how many ops are done between every descriptor selection
  376. select-interval = 100
  377.  
  378. # Number of connections that are allowed in the backlog.
  379. # 0 or negative means that the platform default will be used.
  380. default-backlog = 1000
  381. }
  382. }

akka-remote

  1. #####################################
  2. # Akka Remote Reference Config File #
  3. #####################################
  4.  
  5. # This is the reference config file that contains all the default settings.
  6. # Make your edits/overrides in your application.conf.
  7.  
  8. # comments about akka.actor settings left out where they are already in akka-
  9. # actor.jar, because otherwise they would be repeated in config rendering.
  10.  
  11. akka {
  12.  
  13. actor {
  14.  
  15. serializers {
  16. proto = "akka.remote.serialization.ProtobufSerializer"
  17. daemon-create = "akka.remote.serialization.DaemonMsgCreateSerializer"
  18. }
  19.  
  20.  
  21. serialization-bindings {
  22. # Since com.google.protobuf.Message does not extend Serializable but
  23. # GeneratedMessage does, need to use the more specific one here in order
  24. # to avoid ambiguity
  25. "com.google.protobuf.GeneratedMessage" = proto
  26. "akka.remote.DaemonMsgCreate" = daemon-create
  27. }
  28.  
  29. deployment {
  30.  
  31. default {
  32.  
  33. # if this is set to a valid remote address, the named actor will be
  34. # deployed at that node e.g. "akka://sys@host:port"
  35. remote = ""
  36.  
  37. target {
  38.  
  39. # A list of hostnames and ports for instantiating the children of a
  40. # router
  41. # The format should be on "akka://sys@host:port", where:
  42. # - sys is the remote actor system name
  43. # - hostname can be either hostname or IP address the remote actor
  44. # should connect to
  45. # - port should be the port for the remote server on the other node
  46. # The number of actor instances to be spawned is still taken from the
  47. # nr-of-instances setting as for local routers; the instances will be
  48. # distributed round-robin among the given nodes.
  49. nodes = []
  50.  
  51. }
  52. }
  53. }
  54. }
  55.  
  56. remote {
  57.  
  58. # Which implementation of akka.remote.RemoteTransport to use
  59. # default is a TCP-based remote transport based on Netty
  60. transport = "akka.remote.netty.NettyRemoteTransport"
  61.  
  62. # Enable untrusted mode for full security of server managed actors, prevents
  63. # system messages to be send by clients, e.g. messages like 'Create',
  64. # 'Suspend', 'Resume', 'Terminate', 'Supervise', 'Link' etc.
  65. untrusted-mode = off
  66.  
  67. # Timeout for ACK of cluster operations, like checking actor out etc.
  68. remote-daemon-ack-timeout = 30s
  69.  
  70. # If this is "on", Akka will log all inbound messages at DEBUG level,
  71. # if off then they are not logged
  72. log-received-messages = off
  73.  
  74. # If this is "on", Akka will log all outbound messages at DEBUG level,
  75. # if off then they are not logged
  76. log-sent-messages = off
  77.  
  78. # If this is "on", Akka will log all RemoteLifeCycleEvents at the level
  79. # defined for each, if off then they are not logged Failures to deserialize
  80. # received messages also fall under this flag.
  81. log-remote-lifecycle-events = on
  82.  
  83. # Each property is annotated with (I) or (O) or (I&O), where I stands for
  84. # “inbound” and O for “outbound” connections. The NettyRemoteTransport always
  85. # starts the server role to allow inbound connections, and it starts active
  86. # client connections whenever sending to a destination which is not yet
  87. # connected; if configured it reuses inbound connections for replies, which
  88. # is called a passive client connection (i.e. from server to client).
  89. netty {
  90.  
  91. # (O) In case of increased latency / overflow how long should we wait
  92. # (blocking the sender) until we deem the send to be cancelled?
  93. # 0 means "never backoff", any positive number will indicate the time to
  94. # block at most.
  95. backoff-timeout = 0ms
  96.  
  97. # (I&O) Generate your own with the script availbale in
  98. # '$AKKA_HOME/scripts/generate_config_with_secure_cookie.sh' or using
  99. # 'akka.util.Crypt.generateSecureCookie'
  100. secure-cookie = ""
  101.  
  102. # (I) Should the remote server require that its peers share the same
  103. # secure-cookie (defined in the 'remote' section)?
  104. require-cookie = off
  105.  
  106. # (I) Reuse inbound connections for outbound messages
  107. use-passive-connections = on
  108.  
  109. # (I) EXPERIMENTAL If "<id.of.dispatcher>" then the specified dispatcher
  110. # will be used to accept inbound connections, and perform IO. If "" then
  111. # dedicated threads will be used.
  112. #
  113. # CAUTION: This might lead to the used dispatcher not shutting down properly!
  114. # - may prevent the JVM from shutting down normally
  115. # - may leak threads when shutting down an ActorSystem
  116. #
  117. use-dispatcher-for-io = ""
  118.  
  119. # (I) The hostname or ip to bind the remoting to,
  120. # InetAddress.getLocalHost.getHostAddress is used if empty
  121. hostname = ""
  122.  
  123. # (I) The default remote server port clients should connect to.
  124. # Default is 2552 (AKKA), use 0 if you want a random available port
  125. # This port needs to be unique for each actor system on the same machine.
  126. port = 2552
  127.  
  128. # (O) The address of a local network interface (IP Address) to bind to when
  129. # creating outbound connections. Set to "" or "auto" for automatic selection
  130. # of local address.
  131. outbound-local-address = "auto"
  132.  
  133. # (I&O) Increase this if you want to be able to send messages with large
  134. # payloads
  135. message-frame-size = 1 MiB
  136.  
  137. # (O) Sets the connectTimeoutMillis of all outbound connections,
  138. # i.e. how long a connect may take until it is timed out
  139. connection-timeout = 120s
  140.  
  141. # (I) Sets the size of the connection backlog
  142. backlog = 4096
  143.  
  144. # (I) Sets the SO_REUSE_ADDR flag, valid values are "on", "off" and "off-for-windows"
  145. # due to the following Windows bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4476378
  146. # "off-for-windows" of course means that it's "on" for all other platforms
  147. reuse-address = off-for-windows
  148.  
  149. # (I) Length in akka.time-unit how long core threads will be kept alive if
  150. # idling
  151. execution-pool-keepalive = 60s
  152.  
  153. # (I) Size in number of threads of the core pool of the remote execution
  154. # unit.
  155. # A value of 0 will turn this off, which is can lead to deadlocks under
  156. # some configurations!
  157. execution-pool-size = 4
  158.  
  159. # (I) Maximum channel size, 0 for off
  160. max-channel-memory-size = 0b
  161.  
  162. # (I) Maximum total size of all channels, 0 for off
  163. max-total-memory-size = 0b
  164.  
  165. # (I&O) Sets the high water mark for the in and outbound sockets,
  166. # set to 0b for platform default
  167. write-buffer-high-water-mark = 0b
  168.  
  169. # (I&O) Sets the low water mark for the in and outbound sockets,
  170. # set to 0b for platform default
  171. write-buffer-low-water-mark = 0b
  172.  
  173. # (I&O) Sets the send buffer size of the Sockets,
  174. # set to 0b for platform default
  175. send-buffer-size = 0b
  176.  
  177. # (I&O) Sets the receive buffer size of the Sockets,
  178. # set to 0b for platform default
  179. receive-buffer-size = 0b
  180.  
  181. # (O) Time between reconnect attempts for active clients
  182. reconnect-delay = 5s
  183.  
  184. # (O) Read inactivity period (lowest resolution is seconds)
  185. # after which active client connection is shutdown;
  186. # will be re-established in case of new communication requests.
  187. # A value of 0 will turn this feature off
  188. read-timeout = 0s
  189.  
  190. # (O) Write inactivity period (lowest resolution is seconds)
  191. # after which a heartbeat is sent across the wire.
  192. # A value of 0 will turn this feature off
  193. write-timeout = 10s
  194.  
  195. # (O) Inactivity period of both reads and writes (lowest resolution is
  196. # seconds) after which active client connection is shutdown; will be
  197. # re-established in case of new communication requests.
  198. # A value of 0 will turn this feature off
  199. all-timeout = 0s
  200.  
  201. # (O) Maximum time window that a client should try to reconnect for
  202. reconnection-time-window = 600s
  203.  
  204. ssl {
  205. # (I&O) Enable SSL/TLS encryption.
  206. # This must be enabled on both the client and server to work.
  207. enable = off
  208.  
  209. # (I) This is the Java Key Store used by the server connection
  210. key-store = "keystore"
  211.  
  212. # This password is used for decrypting the key store
  213. key-store-password = "changeme"
  214.  
  215. # (O) This is the Java Key Store used by the client connection
  216. trust-store = "truststore"
  217.  
  218. # This password is used for decrypting the trust store
  219. trust-store-password = "changeme"
  220.  
  221. # (I&O) Protocol to use for SSL encryption, choose from:
  222. # Java 6 & 7:
  223. # 'SSLv3', 'TLSv1'
  224. # Java 7:
  225. # 'TLSv1.1', 'TLSv1.2'
  226. protocol = "TLSv1"
  227.  
  228. # Example: ["TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_256_CBC_SHA"]
  229. # You need to install the JCE Unlimited Strength Jurisdiction Policy
  230. # Files to use AES 256.
  231. # More info here:
  232. # http://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.html#SunJCEProvider
  233. enabled-algorithms = ["TLS_RSA_WITH_AES_128_CBC_SHA"]
  234.  
  235. # Using /dev/./urandom is only necessary when using SHA1PRNG on Linux to
  236. # prevent blocking. It is NOT as secure because it reuses the seed.
  237. # '' => defaults to /dev/random or whatever is set in java.security for
  238. # example: securerandom.source=file:/dev/random
  239. # '/dev/./urandom' => NOT '/dev/urandom' as that doesn't work according
  240. # to: http://bugs.sun.com/view_bug.do?bug_id=6202721
  241. sha1prng-random-source = ""
  242.  
  243. # There are three options, in increasing order of security:
  244. # "" or SecureRandom => (default)
  245. # "SHA1PRNG" => Can be slow because of blocking issues on Linux
  246. # "AES128CounterSecureRNG" => fastest startup and based on AES encryption
  247. # algorithm
  248. # "AES256CounterSecureRNG"
  249. # The following use one of 3 possible seed sources, depending on
  250. # availability: /dev/random, random.org and SecureRandom (provided by Java)
  251. # "AES128CounterInetRNG"
  252. # "AES256CounterInetRNG" (Install JCE Unlimited Strength Jurisdiction
  253. # Policy Files first)
  254. # Setting a value here may require you to supply the appropriate cipher
  255. # suite (see enabled-algorithms section above)
  256. random-number-generator = ""
  257. }
  258.  
  259. # (I&O) Used to configure the number of I/O worker threads on server sockets
  260. server-socket-worker-pool {
  261. # Min number of threads to cap factor-based number to
  262. pool-size-min = 2
  263.  
  264. # The pool size factor is used to determine thread pool size
  265. # using the following formula: ceil(available processors * factor).
  266. # Resulting size is then bounded by the pool-size-min and
  267. # pool-size-max values.
  268. pool-size-factor = 1.0
  269.  
  270. # Max number of threads to cap factor-based number to
  271. pool-size-max = 8
  272. }
  273.  
  274. # (I&O) Used to configure the number of I/O worker threads on client sockets
  275. client-socket-worker-pool {
  276. # Min number of threads to cap factor-based number to
  277. pool-size-min = 2
  278.  
  279. # The pool size factor is used to determine thread pool size
  280. # using the following formula: ceil(available processors * factor).
  281. # Resulting size is then bounded by the pool-size-min and
  282. # pool-size-max values.
  283. pool-size-factor = 1.0
  284.  
  285. # Max number of threads to cap factor-based number to
  286. pool-size-max = 8
  287. }
  288. }
  289. }
  290. }

akka-testkit

  1. ######################################
  2. # Akka Testkit Reference Config File #
  3. ######################################
  4.  
  5. # This is the reference config file that contains all the default settings.
  6. # Make your edits/overrides in your application.conf.
  7.  
  8. akka {
  9. test {
  10. # factor by which to scale timeouts during tests, e.g. to account for shared
  11. # build system load
  12. timefactor = 1.0
  13.  
  14. # duration of EventFilter.intercept waits after the block is finished until
  15. # all required messages are received
  16. filter-leeway = 3s
  17.  
  18. # duration to wait in expectMsg and friends outside of within() block
  19. # by default
  20. single-expect-default = 3s
  21.  
  22. # The timeout that is added as an implicit by DefaultTimeout trait
  23. default-timeout = 5s
  24.  
  25. calling-thread-dispatcher {
  26. type = akka.testkit.CallingThreadDispatcherConfigurator
  27. }
  28. }
  29. }

akka-transactor

  1. #########################################
  2. # Akka Transactor Reference Config File #
  3. #########################################
  4.  
  5. # This is the reference config file that contains all the default settings.
  6. # Make your edits/overrides in your application.conf.
  7.  
  8. akka {
  9. transactor {
  10. # The timeout used for coordinated transactions across actors
  11. coordinated-timeout = 5s
  12. }
  13. }

akka-agent

  1. ####################################
  2. # Akka Agent Reference Config File #
  3. ####################################
  4.  
  5. # This is the reference config file that contains all the default settings.
  6. # Make your edits/overrides in your application.conf.
  7.  
  8. akka {
  9. agent {
  10.  
  11. # The dispatcher used for agent-send-off actor
  12. send-off-dispatcher {
  13. executor = thread-pool-executor
  14. type = PinnedDispatcher
  15. }
  16.  
  17. # The dispatcher used for agent-alter-off actor
  18. alter-off-dispatcher {
  19. executor = thread-pool-executor
  20. type = PinnedDispatcher
  21. }
  22. }
  23. }

akka-zeromq

  1. #####################################
  2. # Akka ZeroMQ Reference Config File #
  3. #####################################
  4.  
  5. # This is the reference config file that contains all the default settings.
  6. # Make your edits/overrides in your application.conf.
  7.  
  8. akka {
  9.  
  10. zeromq {
  11.  
  12. # The default timeout for a poll on the actual zeromq socket.
  13. poll-timeout = 100ms
  14.  
  15. # Timeout for creating a new socket
  16. new-socket-timeout = 5s
  17.  
  18. socket-dispatcher {
  19. # A zeromq socket needs to be pinned to the thread that created it.
  20. # Changing this value results in weird errors and race conditions within
  21. # zeromq
  22. executor = thread-pool-executor
  23. type = "PinnedDispatcher"
  24. thread-pool-executor.allow-core-timeout = off
  25. }
  26. }
  27. }

akka-file-mailbox

  1. #############################################
  2. # Akka File Mailboxes Reference Config File #
  3. #############################################
  4.  
  5. # This is the reference config file that contains all the default settings.
  6. # Make your edits/overrides in your application.conf.
  7. #
  8. # For more information see <https://github.com/robey/kestrel/>
  9.  
  10. akka {
  11. actor {
  12. mailbox {
  13. file-based {
  14. # directory below which this queue resides
  15. directory-path = "./_mb"
  16.  
  17. # attempting to add an item after the queue reaches this size (in items)
  18. # will fail.
  19. max-items = 2147483647
  20.  
  21. # attempting to add an item after the queue reaches this size (in bytes)
  22. # will fail.
  23. max-size = 2147483647 bytes
  24.  
  25. # attempting to add an item larger than this size (in bytes) will fail.
  26. max-item-size = 2147483647 bytes
  27.  
  28. # maximum expiration time for this queue (seconds).
  29. max-age = 0s
  30.  
  31. # maximum journal size before the journal should be rotated.
  32. max-journal-size = 16 MiB
  33.  
  34. # maximum size of a queue before it drops into read-behind mode.
  35. max-memory-size = 128 MiB
  36.  
  37. # maximum overflow (multiplier) of a journal file before we re-create it.
  38. max-journal-overflow = 10
  39.  
  40. # absolute maximum size of a journal file until we rebuild it,
  41. # no matter what.
  42. max-journal-size-absolute = 9223372036854775807 bytes
  43.  
  44. # whether to drop older items (instead of newer) when the queue is full
  45. discard-old-when-full = on
  46.  
  47. # whether to keep a journal file at all
  48. keep-journal = on
  49.  
  50. # whether to sync the journal after each transaction
  51. sync-journal = off
  52.  
  53. # circuit breaker configuration
  54. circuit-breaker {
  55. # maximum number of failures before opening breaker
  56. max-failures = 3
  57.  
  58. # duration of time beyond which a call is assumed to be timed out and
  59. # considered a failure
  60. call-timeout = 3 seconds
  61.  
  62. # duration of time to wait until attempting to reset the breaker during
  63. # which all calls fail-fast
  64. reset-timeout = 30 seconds
  65. }
  66. }
  67. }
  68. }
  69. }