Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10240

CamelHttpClient default pool size does not work on system with large number of cpus

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.17.2
    • 2.17.4, 2.18.0
    • camel-jetty
    • None
    • Novice

    Description

      In CamelHttpClient a default threadpool is being created with a hardcoded size of 16:

          @Override
          protected void doStart() throws Exception {
              if (!hasThreadPool()) {
                  // if there is no thread pool then create a default thread pool using daemon threads
                  QueuedThreadPool qtp = new QueuedThreadPool();
                  // 16 max threads is the default in the http client
                  qtp.setMaxThreads(16);
                  qtp.setDaemon(true);
                  // let the thread names indicate they are from the client
                  qtp.setName("CamelJettyClient(" + ObjectHelper.getIdentityHashCode(this) + ")");
                  setThreadPoolOrExecutor(qtp);
              }
              super.doStart();
          }
      

      this configuration does not work because number of selectors is calculated relative to the number of CPUs in HttpClientTransportOverHTTP:

         public HttpClientTransportOverHTTP()
          {
              this(Math.max(1, Runtime.getRuntime().availableProcessors() / 2));
          }
      

      As a result by default camel simply hangs on these systems...

      It would be nice if CamelHttpClient would have a constructor that set the HttpClientTransport or at least the number of selectors.

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              zolyfarkas Zoltan Farkas
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: