title: How to configure specific dispatcher for Akka HTTP?
body: <p>I have simple Akka HTTP application, which is used websocket. My request handler has blocking calls (like, JDBC). So, I need to use some fixed size thread pool to work with such code.</p>
  
  <p>So, as I understand, I should use <strong>application.conf</strong> (like this - <a href="https://github.com/mkuthan/example-akka-http/blob/master/src/main/resources/application.conf" rel="nofollow noreferrer"><a href="https://github.com/mkuthan/example-akka-http/blob/master/src/main/resources/application.conf" rel="nofollow noreferrer">https://github.com/mkuthan/example-akka-http/blob/master/src/main/resources/application.conf</a></a>). But I have no idea, how to configure custom thread pool with fixed constantly threads.</p>
  
  <p>When I run my application and do thread dump, I see two name of threads:</p>
  
  <ul>
  <li>akka-system-akka.actor.default-dispatcher-62</li>
  <li>Routes-akka.actor.default-dispatcher-79</li>
  </ul>
  
  <p>I don't understand, what are it these thread pools. </p>
  
  <p>I tried to set up default thread pool, like this:</p>
  
  <pre><code>akka {
    actor {
      default-dispatcher {
        type = Dispatcher
        executor = "thread-pool-executor"
        thread-pool-executor {
          fixed-pool-size = 40
        }
      }
    }
  }
  </code></pre>
  
  <p>it works super strange:</p>
  
  <ul>
  <li>Each thread pool have own 40 threads, so I have 80 threads. As I understand, each started dispatcher will have own 40 threads. It is bad.</li>
  <li>It is not FixedThreadPool - <a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)" rel="nofollow noreferrer"><a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)" rel="nofollow noreferrer">https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)</a></a>. When application starts. there is no any threads. Then, when application has processed some requests, threads are spawned. When there is no incoming requests for a while, threads have died. </li>
  </ul>