edit-icon download-icon

Configure the HiTSDBConfig class

Last Updated: Mar 28, 2018

All HiTSDB-Client configurations are completed by HiTSDBConfig. You can use the config() method to build HiTSDBConfig objects. The following sample code demonstrates specific configurations.

Sample code

HiTSDBConfig config = HiTSDBConfig
    // In configuring an address, the first parameter can be HiTSDB's domain or IP. The second parameter represents the HiTSDB port.
    .address("example.hitsdb.com", 8242)

    // A read-only switch, which is False by default. If readonly is set to True, the asynchronous putting switch is turned off.
    .readonly(false)

     // Size of the network connection pool, which is 64 by default.
    .httpConnectionPool(64)

    // HTTP waiting time (90 by default) in seconds.
    .httpConnectTimeout(90)

    // Quantity of IO threads, which is 1 by default.
    .ioThreadCount(1)

    // Asynchronous putting switch. The default setting is True. We recommend that you use asynchronous putting.
    .asyncPut(true)

    // For asynchronous putting, the length of the buffer queue at the client. 10000 by default.
    .batchPutBufferSize(20000)

    // For asynchronous putting, the quantity of threads consumed by the buffer queue. 1 by default.
    .batchPutConsumerThreadCount(2)

    // For asynchronous putting, the quantity of points submitted to the client in each batch. 500 by default.
    .batchPutSize(500)

    // For asynchronous putting, maximum time for each wait, in milliseconds. 300 by default.
    .batchPutTimeLimit(300)

    // For asynchronous putting, the quantity of write request queues. Equal to the quantity of connection pools by default. Can be configured by proportion of the input/output operations per second.
    .putRequestLimit(100)

    // For asynchronous putting, the quantity of request queues is unlimited. Shutting it down can result in OOM, and is therefore not recommended.
    .closePutRequestLimit()

    // For asynchronous putting, asynchronous batch Put callback interfaces.
    .listenBatchPut(new BatchPutCallback() { 
        @Override public void response(List<Point> input, Result output) {}
    })

    // Traffic limit, specifying the maximum Points submitted per second.
    .maxTPS(50000)

    .config(); // Build HiTSDBConfig objects
Thank you! We've received your feedback.