All Products
Search
Document Center

TSDBConfig.Builder

Last Updated: Aug 25, 2021

Class name: com.aliyun.hitsdb.client.TSDBConfig.Builder

  • java.lang.Object

    • com.aliyun.hitsdb.client.TSDBConfig.Builder

  • Enclosing class:
    TSDBConfig

    publicstaticclassTSDBConfig.BuilderextendsObject
    • Constructor summary

      Constructor and description

      Builder(String host, int port)

      Uses the IP address and port of Time Series Database (TSDB) to create a TSDBConfig.Builder object.
    • Method summary

      Qualifier and type

      Method and description

      TSDBConfig.Builder

      asyncPut(boolean asyncPut)

      Specifies whether to enable asynchronous writes. By default, asynchronous writes are enabled. We recommend that you use the default setting.

      TSDBConfig.Builder

      batchPutBufferSize(int batchPutBufferSize)

      Specifies the length of the buffer queue for a client. By default, the length is 10,000 requests. This method only takes effect when asynchronous writes are enabled.

      TSDBConfig.Builder

      batchPutConsumerThreadCount (int batchPutConsumerThreadCount) Specifies the number of consumer threads for the buffer queue. By default, the number is 1. This method only takes effect when asynchronous writes are enabled.

      TSDBConfig.Builder

      basicAuth (String tsdbUser, String basicPwd) Specifies the authentication information. This includes the TSDB username and password used for authentication. This method is supported by TSDB SDK V0.2.7 and later. The user authentication feature is supported by TSDB V2.5.13 and later.

      TSDBConfig.Builder

      batchPutSize (int batchPutSize) Specifies the number of data points that are submitted at a time to clients. By default, the number is 500. This method only takes effect when asynchronous writes are enabled.

      TSDBConfig.Builder

      batchPutTimeLimit(int batchPutTimeLimit)

      Specifies the timeout period for each asynchronous write. Unit: milliseconds. By default, the timeout period is 300 milliseconds. This method only takes effect when asynchronous writes are enabled.

      TSDBConfig.Builder

      closePutRequestLimit()

      Specifies whether to disable the limit on the number of queues for write requests. We recommend that you disable the limit because out-of-memory (OOM) errors may occur if you enable the limit. This method only takes effect when asynchronous writes are enabled.

      TSDBConfig

      config()

      Constructs a TSDBConfig object.

      TSDBConfig.Builder

      deduplicationEnable()

      Deduplicates data points in each batch. This method only takes effect when asynchronous writes are enabled.

      Specifies the rules for deduplicating data points in a batch. The following rules are supported:

      • Same metric

      • Same key-value pair of each tag

      • Same fields in the multi-value data model

      • Same timestamp

      TSDBConfig.Builder

      httpCompress(boolean httpCompress)

      Specifies whether to enable HTTP compression.

      TSDBConfig.Builder

      httpConnectionLiveTime(int httpConnectionLiveTime)

      Specifies the duration during which a connection is alive. Unit: seconds. By default, the duration is 0. The value 0 specifies that this method does not take effect and your connections are persistent connections. For information about how to configure the duration, see the following note for httpConnectionLiveTime.

      TSDBConfig.Builder

      httpConnectionPool(int connectionPool)

      Specifies the size of the HTTP connection pool.

      TSDBConfig.Builder

      httpConnectTimeout(int httpConnectTimeout)

      Specifies the timeout period for each HTTP request. Unit: seconds. By default, the timeout period is 90 seconds.

      TSDBConfig.Builder

      httpKeepaliveTime(int httpKeepaliveTime)

      Specifies the period during which each HTTP persistent connection is alive.

      TSDBConfig.Builder

      ioThreadCount(int ioThreadCount)

      Specifies the number of I/O threads. By default, the number is 1.

      TSDBConfig.Builder

      listenBatchPut(AbstractBatchPutCallback<?> cb)

      Specifies the callback interface for asynchronous batch writes.

      TSDBConfig.Builder

      maxTPS(int maxTPS)

      Specifies the limit on the transactions per second (TPS) for clients. By default, no limit is applied on the TPS for clients.

      TSDBConfig.Builder

      openHttpCompress()

      Enables HTTP compression.

      TSDBConfig.Builder

      putRequestLimit(int limit)

      Specifies the number of queues for write requests. By default, the number is equal to the number of connection pools. This method only takes effect when asynchronous writes are enabled. You can configure the number of queues for asynchronous write requests based on the read/write ratio in your environment.

      TSDBConfig.Builder

      readonly()

      Turns on the read-only switch. If the value true is passed, asynchronous writes are disabled.

      TSDBConfig.Builder

      readonly(boolean readonly)

      Specifies whether to turn on the read-only switch. By default, the read-only switch is turned off. If the value true is passed, asynchronous writes are disabled.
      • Methods inherited from the java.lang.Object class

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait

    • Constructor details

      • Builder

        public Builder(String host,int port)
      • Builder

        public Builder(TSDBNetAddress... netAddresses)
    • Method details

      • putRequestLimit

        public TSDBConfig.Builder putRequestLimit(int limit)
      • batchPutBufferSize

        public TSDBConfig.Builder batchPutBufferSize(int batchPutBufferSize)
      • batchPutConsumerThreadCount

        public TSDBConfig.Builder batchPutConsumerThreadCount(int batchPutConsumerThreadCount)
      • batchPutRetryCount

        public TSDBConfig.Builder batchPutRetryCount(int batchPutRetryCount)
      • batchPutSize

        public TSDBConfig.Builder batchPutSize(int batchPutSize)
      • batchPutTimeLimit

        public TSDBConfig.Builder batchPutTimeLimit(int batchPutTimeLimit)
      • closePutRequestLimit

        public TSDBConfig.Builder closePutRequestLimit()
      • closeBackpressure

        public TSDBConfig.Builder closeBackpressure()
      • deduplicationEnable

        public TSDBConfig.Builder deduplicationEnable()

      Note

      For multi-value data points, deduplication is accurate to the field. If only one field in a MultiFieldPoint object meets the deduplication rules, the deduplication logic is implemented to deduplicate only the data points of the field.

      • httpConnectionLiveTime

        public TSDBConfig.Builder httpConnectionLiveTime(int httpConnectionLiveTime
        Note

        The default value of the httpConnectionLiveTime parameter is 0. The value 0 specifies that all connections are persistent connections. If you use persistent connections in production environments, the performance of servers may deteriorate due to load imbalance. This is because TSDB uses multiple nodes to provide services. If a node is faulty, connections to the node are switched to other nodes. After the node is restored, the connections are not switched back to the node because the connections are persistent connections. In this case, if no new connection requests are initiated from clients, the node cannot provide services. To prevent load imbalance among TSDB nodes, you can configure the httpConnectionLiveTime parameter to reestablish connections between clients and TSDB on a regular basis.

      • httpKeepaliveTime

        public TSDBConfig.Builder httpKeepaliveTime(int httpKeepaliveTime)
      • readonly

        public TSDBConfig.Builder readonly()
      • readonly

        public TSDBConfig.Builder readonly(boolean readonly)
      • asyncPut

        public TSDBConfig.Builder asyncPut(boolean asyncPut)
      • maxTPS

        public TSDBConfig.Builder maxTPS(int maxTPS)
      • config

        public TSDBConfig config()
      • httpCompress

        public TSDBConfig.Builder httpCompress(boolean httpCompress)
      • httpConnectionPool

        public TSDBConfig.Builder httpConnectionPool(int connectionPool)
      • httpConnectTimeout

        public TSDBConfig.Builder httpConnectTimeout(int httpConnectTimeout)
      • ioThreadCount

        public TSDBConfig.Builder ioThreadCount(int ioThreadCount)
      • listenBatchPut

        public TSDBConfig.Builder listenBatchPut(AbstractBatchPutCallback<?> cb)
      • openHttpCompress

        public TSDBConfig.Builder openHttpCompress()
    • Note

      The default value of the httpConnectionLiveTime parameter is 0. The value 0 specifies that all connections are persistent connections. If you use persistent connections in production environments, the performance of servers may deteriorate due to load imbalance. This is because TSDB uses multiple nodes to provide services. If a node is faulty, connections to the node are switched to other nodes. After the node is restored, the connections are not switched back to the node because the connections are persistent connections. In this case, if no new connection requests are initiated from clients, the node cannot provide services. To prevent load imbalance among TSDB nodes, you can configure the httpConnectionLiveTime parameter to reestablish connections between clients and TSDB on a regular basis.