Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2561

Allow for limited threadpool size in the Async driver

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0
    • Affects Version/s: None
    • Component/s: Async
    • Labels:
      None
    • Environment:
      Using MongoDB Reactive Streams driver 1.5

      Allow users to provide to limit the thread pool size or to supply an own ExecutorService.

      Was:

      Unlimited thread pool growth using AsynchronousSocketChannel

      Mongo Driver async uses AsynchronousSocketChannel without channel grouping that leads to the creation of an unbounded default thread pool. The pool grows with concurrent connection use, and it's not possible to limit the thread pool size or to supply an own ExecutorService.

      This arrangement can allocate a lot of resources which is not desirable in the particular scenario of nonblocking usage. It's not possible to limit resources or a strategy for back-pressure caused by higher workload than available resources (reject, queue, allocate resources). Supplying an ExecutorService via AsynchronousSocketChannelStreamFactoryFactory could help to address the issue.

      The issue originated in MongoDB RS driver usage, hence I'm filing the ticket here and not in the JAVA (async) driver project.

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            mp911de Mark Paluch
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: