Akka application.conf does not override values in reference.conf

765 views
Skip to first unread message

Kilic Ali-Firat

unread,
Dec 15, 2016, 3:53:55 AM12/15/16
to Akka User List
Hi Akka Team,

I wrote an Akka application using actors and now, I want to make some load tests and plays with the akka configurations. It's a sbt project with the following structure :

.
├── main
│   ├── resources
│   │   ├── akka.conf
│   │   ├── application.conf
│   │   └── log4j.properties
│   └── scala
│       ├── Main_App.scala



I wrote my akka.conf in a separate file and include it in the application.conf as below :

akka.conf :

  akka {




   
# Loggers to register at boot time (akka.event.Logging$DefaultLogger logs
   
# to STDOUT)
    loggers
= ["akka.event.Logging$DefaultLogger"]


   
# Filter of log events that is used by the LoggingAdapter before
   
# publishing log events to the eventStream. It can perform
   
# fine grained filtering based on the log source. The default
   
# implementation filters on the `loglevel`.
   
# FQCN of the LoggingFilter. The Class of the FQCN must implement
   
# akka.event.LoggingFilter and have a public constructor with
   
# (akka.actor.ActorSystem.Settings, akka.event.EventStream) parameters.
   
#logging-filter = "akka.event.DefaultLoggingFilter"


   
# Specifies the default loggers dispatcher
    loggers
-dispatcher = "akka.actor.default-dispatcher"


   
# Loggers are created and registered synchronously during ActorSystem
   
# start-up, and since they are actors, this timeout is used to bound the
   
# waiting time
    logger
-startup-timeout = 5s


   
# Log level used by the configured loggers (see "loggers") as soon
   
# as they have been started; before that, see "stdout-loglevel"
   
# Options: OFF, ERROR, WARNING, INFO, DEBUG
    loglevel
= "INFO"


   
# Log level for the very basic logger activated during ActorSystem startup.
   
# This logger prints the log messages to stdout (System.out).
   
# Options: OFF, 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 = on


   
# Log at info level when messages are sent to dead letters.
   
# Possible values:
   
# on: all dead letters are logged
   
# off: no logging of dead letters
   
# n: positive integer, number of dead letters that will be logged
    log
-dead-letters = 10


   
# Possibility to turn off logging of dead letters while the actor system
   
# is shutting down. Logging is only done when enabled by 'log-dead-letters'
   
# setting.
    log
-dead-letters-during-shutdown = on




   
# 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
{


     
# Either one of "local", "remote" or "cluster" or the
     
# FQCN of the ActorRefProvider to be used; the below is the built-in default,
     
# note that "remote" and "cluster" requires the akka-remote and akka-cluster
     
# artifacts to be on the classpath.
      provider
= "local"


     
# 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




     
default-dispatcher {
       
# Must be one of the following
       
# Dispatcher, PinnedDispatcher, or a FQCN to a class inheriting
       
# MessageDispatcherConfigurator with a public constructor with
       
# both com.typesafe.config.Config parameter and
       
# akka.dispatch.DispatcherPrerequisites parameters.
       
# PinnedDispatcher must be used together with executor=thread-pool-executor.
        type
= "Dispatcher"


       
# Which kind of ExecutorService to use for this dispatcher
       
# Valid options:
       
#  - "default-executor" requires a "default-executor" section
       
#  - "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
= "default-executor"


       
# This will be used if you have set "executor = "default-executor"".
       
# If an ActorSystem is created with a given ExecutionContext, this
       
# ExecutionContext will be used as the default executor for all
       
# dispatchers in the ActorSystem configured with
       
# executor = "default-executor". Note that "default-executor"
       
# is the default value for executor, and therefore used if not
       
# specified otherwise. If no ExecutionContext is given,
       
# the executor configured in "fallback" will be used.
       
default-executor {
          fallback
= "fork-join-executor"
       
}


       
# This will be used if you have set "executor = "fork-join-executor""
       
# Underlying thread pool implementation is scala.concurrent.forkjoin.ForkJoinPool
        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


         
# Max number of threads to cap factor-based parallelism number to
          parallelism
-max = 64


         
# Setting to "FIFO" to use queue like peeking mode which "poll" or "LIFO" to use stack
         
# like peeking mode which "pop".
          task
-peeking-mode = "FIFO"
       
}




       
# 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
= 1


       
# Throughput deadline for Dispatcher, set to 0 or negative for no deadline
        throughput
-deadline-time = 0ms




     
}
   
}
 
}

application.conf :

include "akka.conf"

To be sure that I overwrite the default values, I set to "on" the value of log-config-on-start. In the Main_app of my application, I load the akka config like this but the configuration is never print in stdout. If I change the name of "application.conf" to "reference.conf" it works but in the akka documentation about the configuration, I read :

  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.
 
So rename application.conf to reference.conf seems not be the good solution of my problem.  So if anyone can say to me how to deal with Akka config, I'm listening !

object App extends LazyLogging {
val config = ConfigFactory.load()
val akkaConfig = config.getConfig("akka")
val actorSystemName = config.getString("fgs.actor_system_name")
  val system = ActorSystem(actorSystemName, akkaConfig)

Kilic Ali-Firat

unread,
Dec 15, 2016, 4:02:02 AM12/15/16
to Akka User List
And I forgot to mention that : I also tried to have one application.conf file with the akka config but it's not working too ..

Roland Kuhn

unread,
Dec 15, 2016, 4:04:08 AM12/15/16
to akka-user
Hi Kilic,

the config you are passing to the ActorSystem is not the right one: the ActorSystem expects a config with an `akka` element at the root, so you should just pass the `config` to the system, not the `akkaConfig`.

Regards,

Roland

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Kilic Ali-Firat

unread,
Dec 15, 2016, 4:25:13 AM12/15/16
to Akka User List
Hi,

Thank for your response, it's working now :)
Reply all
Reply to author
Forward
0 new messages