com.datastax.driver.core.exceptions.BusyPoolException

前端 未结 1 1224
谎友^
谎友^ 2021-01-19 00:53

Whenever I insert data in table in Cassandra, more than 1000 and fetching the data by id, it throws the following exception:

com.datastax.driver.core.excepti         


        
相关标签:
1条回答
  • 2021-01-19 01:40

    This means that you are submitting too many requests, and not waiting for the futures to complete before submitting more.

    The default maximum number of requests per connection is 1024. If this number is exceeded for all connections, the connection pool will enqueue some requests, up to 256. If the queue gets full, a BusyPoolException is thrown. Of course you can increase the max number of requests per connection, and the number of max connections per host. But the real solution is of course to throttle your thread. You could e.g. submit your requests by batches of 1,000 and then wait on the futures to complete before submitting more, or use a semaphore to regulate the total number of pending requests and make sure they don't exceed a certain number (in theory, this number must stay below num_hosts * max_connections_per_host * max_requests_per_connection – in practice, I don't suggest going above 1,000 as it probably won't bring you more throughput).

    You may find this links useful.

    https://github.com/redisson/redisson/issues/438
    https://groups.google.com/a/lists.datastax.com/forum/#!topic/java-driver-user/p3CwOL0kNrs http://docs.datastax.com/en/developer/java-driver/3.1/manual/pooling

    0 讨论(0)
提交回复
热议问题