Giter Club home page Giter Club logo

Comments (9)

sundy-li avatar sundy-li commented on July 19, 2024

The flushInterval config must not be zero, it holds a time ticker to flush the message into ClickHouse, maybe you could find the errorr msgs like:

panic: non-positive interval for NewTicker

from clickhouse_sinker.

freemanlutsk avatar freemanlutsk commented on July 19, 2024

I've tried to set flushInterval 2 for e.g., the same.

from clickhouse_sinker.

sundy-li avatar sundy-li commented on July 19, 2024

Is that any logs?
Maybe it will be better to paste all the configs.

from clickhouse_sinker.

freemanlutsk avatar freemanlutsk commented on July 19, 2024
2020/01/09 12:30:05 Initial [clickhouse_sinker]
&creator.Config{
  Kafka: {
    "kafka1": &creator.KafkaConfig{
      Brokers: "kafka-broker1-int.test.com:9091",
      Sasl:    struct { Password string; Username string }{
        Password: "",
        Username: "",
      },
      Version: "2.0.1",
    },
    "kafka2": &creator.KafkaConfig{
      Brokers: "kafka-broker2-int.test.com:9091",
      Sasl:    struct { Password string; Username string }{
        Password: "",
        Username: "",
      },
      Version: "2.0.1",
    },
    "kafka3": &creator.KafkaConfig{
      Brokers: "kafka-broker3-int.test.com:9091",
      Sasl:    struct { Password string; Username string }{
        Password: "",
        Username: "",
      },
      Version: "2.0.1",
    },
  },
  Clickhouse: {
    "clickhouse-r1-s1": &creator.ClickHouseConfig{
      Db:          "test",
      Host:        "r1s1-clickhouse-int.test.com",
      Port:        9000,
      Username:    "test",
      Password:    "password",
      MaxLifeTime: 300,
      RetryTimes:  5,
    },
    "clickhouse-r1-s2": &creator.ClickHouseConfig{
      Db:          "test",
      Host:        "r1s2-clickhouse-int.test.com",
      Port:        9000,
      Username:    "test",
      Password:    "password",
      MaxLifeTime: 300,
      RetryTimes:  5,
    },
    "clickhouse-r1-s3": &creator.ClickHouseConfig{
      Db:          "test",
      Host:        "r1s3-clickhouse-int.test.com",
      Port:        9000,
      Username:    "test",
      Password:    "password",
      MaxLifeTime: 300,
      RetryTimes:  5,
    },
    "clickhouse-r1-s4": &creator.ClickHouseConfig{
      Db:          "test",
      Host:        "r1s4-clickhouse-int.test.com",
      Port:        9000,
      Username:    "test",
      Password:    "password",
      MaxLifeTime: 300,
      RetryTimes:  5,
    },
    "clickhouse-r1-s5": &creator.ClickHouseConfig{
      Db:          "test",
      Host:        "r1s5-clickhouse-int.test.com",
      Port:        9000,
      Username:    "test",
      Password:    "password",
      MaxLifeTime: 300,
      RetryTimes:  5,
    },
    "clickhouse-r1-s6": &creator.ClickHouseConfig{
      Db:          "test",
      Host:        "r1s6-clickhouse-int.test.com",
      Port:        9000,
      Username:    "test",
      Password:    "password",
      MaxLifeTime: 300,
      RetryTimes:  5,
    },
  },
  Tasks: []*creator.Task{
    &creator.Task{
      Name:           "test_requests_ch",
      Kafka:          "kafka1",
      Topic:          "test_requests_ch",
      ConsumerGroup:  "test_test_requests_ch_qe",
      Earliest:       true,
      Parser:         "json",
      CsvFormat:      []string{},
      Delimiter:      "",
      Clickhouse:     "clickhouse-r1-s1",
      TableName:      "test_test_requests",
      AutoSchema:     true,
      ExcludeColumns: []string{},
      Dims:           []struct { Name string; Type string }{},
      Metrics:        []struct { Name string; Type string }{},
      FlushInterval:  0,
      BufferSize:     0,
      MinBufferSize:  0,
    },
  },
  Common: struct { FlushInterval int; BufferSize int; MinBufferSize int; LogLevel string }{
    FlushInterval: 2,
    BufferSize:    9000000,
    MinBufferSize: 2000,
    LogLevel:      "info",
  },
}
2020/01/09 12:30:05 Initial [clickhouse_sinker] complete
2020/01/09 12:30:05 [I] Prepare sql=> INSERT INTO test.test_test_requests (date,ad_type,app_id,platform_id,campaign_id,campaign_image_id,campaign_type,country_id,user_id,manager_id,user_only,segment_id,placement_id,account_id,request_count) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
2020/01/09 12:30:05 [I] start to dial kafka  kafka-broker1-int.test.com:9091
2020/01/09 12:30:05 [I] TaskService test_requests_ch TaskService has started
2020/01/09 12:30:07 [I] test_requests_ch tick
2020/01/09 12:30:07 [I] buf size: 465448
2020/01/09 12:30:13 [I] test_requests_ch tick
2020/01/09 12:30:13 [I] test_requests_ch tick
2020/01/09 12:30:13 [I] buf size: 296500
2020/01/09 12:30:16 [I] test_requests_ch tick
2020/01/09 12:30:17 [I] test_requests_ch tick
2020/01/09 12:30:17 [I] buf size: 556270
2020/01/09 12:30:23 [I] test_requests_ch tick
....

kafka1, kafka2, kafka3 - cluster with RF 3.

INSERT INTO test.test_test_requests ... - test.test_test_requests is distributed table.

from clickhouse_sinker.

sundy-li avatar sundy-li commented on July 19, 2024

The logs show it works well, it shows single sinker could achieve TPS about 50k/s, do you mean that the speed is too slow?

There are some tips to improve it

  1. Multi-node clickhouse_sinker, better as the same number as the kafka topic partition.
  2. Parsing the messages on parallel,now we just parse it with single goroutine, it's ok for most cases, and it depends on your data size.

Later we will add some metrics to show which step is the bottleneck, parsing or flushing to ck.

from clickhouse_sinker.

freemanlutsk avatar freemanlutsk commented on July 19, 2024

Thank you for tips. I've configured as you recommended. Need few days for monitoring this.

from clickhouse_sinker.

freemanlutsk avatar freemanlutsk commented on July 19, 2024

As you've recommended it works quite well!
Thank You!

from clickhouse_sinker.

FinnWang2077 avatar FinnWang2077 commented on July 19, 2024

@sundy-li Hi May I know how to set multi-node sinker for the same topic ? thx

from clickhouse_sinker.

yuzhichang avatar yuzhichang commented on July 19, 2024

@FinnWang2077 clickhouse_sinker 2.0+ config file format differ with 1.x. Please use latest release.
You can let multiple sinker use the same config file so that they consume a Kafka topic with the same consume group.

from clickhouse_sinker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.