Fork Join Pool will not pre-allocate threads. It will also stop threads when they are not used. That configuration is correct, it will allocate up to 50 threads (possibly more if you use some special Scala constructs).
If the reason for 50 threads is that you are doing blocking I strongly advice that you instead define a separate dispatcher for that and use that for the blocking actors/tasks. Starving the default dispatcher will cause instability since Akka internal tasks may need to run on that. See dispatcher documentation for how to define a fixed size pool. /Patrik sön 2 apr. 2017 kl. 12:40 skrev Thibault Meyer <[email protected]>: > Hi, > > I'm using Akka 2.4.17 and I try to configure the "default-dispatcher" to > have at least 50 thread (arbitrary). But Java Mission Control only show 6 > or 8. > > How I can pre-allocate a pool of 50 ready to go threads ? > > Thanks > > > *MainEntry.java* > > /** > * Entry point. > * > * @param args The program arguments > * @since 17.04.02 > */ > public static void main(final String[] args) { > final Injector injector = Guice.createInjector(new ApplicationModules()); > final ActorSystem akkaSystem = ActorSystem.create( > "akka-system", > injector.getInstance(Config.class) > ); > > final Camel camel = CamelExtension.get(akkaSystem); > final SimpleRegistry simpleRegistry = new SimpleRegistry(); > camel.context().setRegistry(simpleRegistry); > camel.context().addComponent( > "rabbitmq", > new RabbitMQComponent(camel.context()) > ); > camel.activationFutureFor( > akkaSystem.actorOf(Props.create(TransformActorConsumer.class)), > new Timeout(Duration.create(5, TimeUnit.SECONDS)), > akkaSystem.dispatcher() > ); > > LOG.debug("Hello World!"); > } > > > > > *application.conf* > > akka { > > # Tell to Akka to use Slf4J rather than built-in logger. > # http://doc.akka.io/docs/akka/2.4/java/logging.html > loggers = ["akka.event.slf4j.Slf4jLogger"] > loglevel = "DEBUG" > logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" > > actor { > default-dispatcher { > # Dispatcher is the name of the event-based dispatcher > type = Dispatcher > > # What kind of ExecutionService to use > executor = "fork-join-executor" > > # Configuration for the fork join pool > fork-join-executor { > # Min number of threads to cap factor-based parallelism number to > parallelism-min = 50 > # Parallelism (threads) ... ceil(available processors * factor) > parallelism-factor = 1.0 > # Max number of threads to cap factor-based parallelism number to > parallelism-max = 125 > } > > # Throughput defines the maximum number of messages to be > # processed per actor before the thread jumps to the next actor. > # Set to 1 for as fair as possible. > throughput = 1 > } > } > } > > > > > sdf > > -- > >>>>>>>>>> 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- >>>>>>>>>> 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
