Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin putting one record at a time to Kinesis #1

Closed
uskudnik opened this issue Aug 18, 2014 · 2 comments
Closed

Plugin putting one record at a time to Kinesis #1

uskudnik opened this issue Aug 18, 2014 · 2 comments

Comments

@uskudnik
Copy link

I am experimenting with putting our data to Kinesis with fluentd but as it seems this plug-in is putting one record at a time to the kinesis and waiting for the response, basically making it useless for high traffic data volumes.

Nothing too fancy in my fluentd.conf:

<source>
    type tail
    path var/spool/tracking-logs/%Y-%m-%d_%H-%M.events
    pos_file var/spool/tracking-logs/events.log.pos
    tag kinesis.eventtracker
    read_from_head true
    format json
    refresh_interval 5
</source>

# Kinesis
<match kinesis.eventtracker>
type kinesis

stream_name eventStream

aws_key_id ID
aws_sec_key KEY

region us-east-1
debug true
#partition_key sessionId
partition_key timestamp
</match>

Basically, in a 5 minute interval roughly 800 records are put into stream, making throughput something like 3 records per second, way below 1000 RpS that a single Kinesis shard is able to process. Switching debug mode on/off doesn't affect performance. Is there a way to fire up more events to the kinesis/make it perform async calls?

Any hints of how to improve performance or is this an underlying problem related to AWS SDK for Ruby?

@jasonmcmunn
Copy link

Have you tried passing in num_threads > 1? The library itself isn't multithreaded, but it looks like the buffered output plugin is designed to be concurrent.

@yuta-imai
Copy link
Contributor

Hi, we have released Version0.2.0 which supports DetachMultiProcessMixin. Also you can use num_threads. You can find how we leverage it on our README.

0e50b32

yuta-imai pushed a commit that referenced this issue Jul 17, 2015
JiHyunSong added a commit to JiHyunSong/aws-fluent-plugin-kinesis that referenced this issue Mar 16, 2020
caused by below exception

```
2020-03-16 23:14:09 +0900 [warn]: awslabs#1 got unrecoverable error in primary and no secondary error_class=Aws::Errors::MissingRegionError error="missing region; use :region option or export region name to ENV['AWS_REGION']"
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/aws-sdk-core/plugins/regional_endpoint.rb:51:in `after_initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:78:in `block in after_initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:77:in `each'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:77:in `after_initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:21:in `initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/aws-sdk-sts/client.rb:310:in `initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:99:in `new'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/client.rb:137:in `setup_credentials'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/client.rb:102:in `client_options'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/client.rb:85:in `client'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/out_kinesis_firehose.rb:51:in `block in write'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/api.rb:91:in `batch_request_with_retry'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis.rb:151:in `block (2 levels) in write_records_batch'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/api.rb:86:in `split_to_batches'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis.rb:149:in `block in write_records_batch'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/buffer/memory_chunk.rb:81:in `open'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/buffer/memory_chunk.rb:81:in `open'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis.rb:147:in `write_records_batch'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/out_kinesis_firehose.rb:47:in `write'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/output.rb:1122:in `try_flush'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/output.rb:1428:in `flush_thread_run'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/output.rb:458:in `block (2 levels) in start'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
```

with fluentd config

```
      @type "kinesis_firehose"
      region "ap-northeast-2"
      http_proxy xxxxxx
      delivery_stream_name "xxxxxx"
```

Signed-off-by: JiHyunSong <[email protected]>
JiHyunSong added a commit to JiHyunSong/aws-fluent-plugin-kinesis that referenced this issue Mar 23, 2020
caused by below exception

```
2020-03-16 23:14:09 +0900 [warn]: awslabs#1 got unrecoverable error in primary and no secondary error_class=Aws::Errors::MissingRegionError error="missing region; use :region option or export region name to ENV['AWS_REGION']"
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/aws-sdk-core/plugins/regional_endpoint.rb:51:in `after_initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:78:in `block in after_initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:77:in `each'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:77:in `after_initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:21:in `initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/aws-sdk-sts/client.rb:310:in `initialize'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/aws-sdk-core-3.91.0/lib/seahorse/client/base.rb:99:in `new'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/client.rb:137:in `setup_credentials'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/client.rb:102:in `client_options'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/client.rb:85:in `client'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/out_kinesis_firehose.rb:51:in `block in write'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/api.rb:91:in `batch_request_with_retry'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis.rb:151:in `block (2 levels) in write_records_batch'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis_helper/api.rb:86:in `split_to_batches'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis.rb:149:in `block in write_records_batch'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/buffer/memory_chunk.rb:81:in `open'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/buffer/memory_chunk.rb:81:in `open'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/kinesis.rb:147:in `write_records_batch'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-kinesis-3.2.1/lib/fluent/plugin/out_kinesis_firehose.rb:47:in `write'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/output.rb:1122:in `try_flush'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/output.rb:1428:in `flush_thread_run'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin/output.rb:458:in `block (2 levels) in start'
  2020-03-16 23:14:09 +0900 [warn]: awslabs#1 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.7.0/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
```

with fluentd config

```
      @type "kinesis_firehose"
      region "ap-northeast-2"
      http_proxy xxxxxx
      delivery_stream_name "xxxxxx"
```

Signed-off-by: JiHyunSong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants