urin.github.io - fluent-plugin-dstatで取得した値が不正になる問題を解決









Search Preview

fluent-plugin-dstatで取得した値が不正になる問題を解決 - URIN HACK

urin.github.io
shun0102/fluent-plugin-dstat at v0.3.2で1秒周期にデータ収集していたら取得した値が明らかに不正になる時があったので、それを解決してPull Requestしv0.3.3としてマージされた。
.io > urin.github.io

SEO audit: Content analysis

Language Error! No language localisation is found.
Title fluent-plugin-dstatで取得した値が不正になる問題を解決 - URIN HACK
Text / HTML ratio 36 %
Frame Excellent! The website does not use iFrame solutions.
Flash Excellent! The website does not have any flash contents.
Keywords cloud dstat fluentplugindstat fluentd Jekyll Ruby Linux コメント Windowsのバッチファイルでログローテート logrotatebat GitHub jQuery tmpdstatcsv Linuxローカル環境用に最小限のyumリポジトリを作成する方法 fluentplugindstatで取得した値が不正になる問題を解決 Requestしv033としてマージされた。 Bootstrap makefile Hosted Managed
Keywords consistency
Keyword Content Title Description Headings
dstat 9
fluentplugindstat 7
fluentd 4
Jekyll 4
Ruby 3
Linux 3
Headings
H1 H2 H3 H4 H5 H6
2 7 3 0 0 0
Images We found 5 images on this web page.

SEO Keywords (Single)

Keyword Occurrence Density
dstat 9 0.45 %
fluentplugindstat 7 0.35 %
fluentd 4 0.20 %
Jekyll 4 0.20 %
Ruby 3 0.15 %
Linux 3 0.15 %
コメント 2 0.10 %
2 0.10 %
Windowsのバッチファイルでログローテート 2 0.10 %
logrotatebat 2 0.10 %
GitHub 2 0.10 %
jQuery 2 0.10 %
tmpdstatcsv 2 0.10 %
Linuxローカル環境用に最小限のyumリポジトリを作成する方法 2 0.10 %
fluentplugindstatで取得した値が不正になる問題を解決 2 0.10 %
Requestしv033としてマージされた。 2 0.10 %
Bootstrap 1 0.05 %
makefile 1 0.05 %
Hosted 1 0.05 %
Managed 1 0.05 %

SEO Keywords (Two Word)

Keyword Occurrence Density
20161112 コメント 2 0.10 %
5 Linux 2 0.10 %
コメント fluentd 2 0.10 %
Linux 4 2 0.10 %
logrotatebat Windowsのバッチファイルでログローテート 2 0.10 %
Ruby 5 2 0.10 %
fluentd 1 2 0.10 %
1 Ruby 2 0.10 %
html C 1 0.05 %
設置が超簡単でカスタマイズ性の高い吹き出しホバー用jQueryプラグインjqueryballoonjs 20130811 1 0.05 %
20130811 要素の高さを揃える超軽量なjQueryプラグインjquerytilejs 1 0.05 %
要素の高さを揃える超軽量なjQueryプラグインjquerytilejs Tags 1 0.05 %
Tags makefile 1 0.05 %
makefile fluentd 1 0.05 %
fluentd html 1 0.05 %
Jekyll Ruby 1 0.05 %
C Jekyll 1 0.05 %
Ruby bash 1 0.05 %
bash Batch 1 0.05 %
Batch Octopress 1 0.05 %

SEO Keywords (Three Word)

Keyword Occurrence Density Possible Spam
20161112 コメント fluentd 2 0.10 % No
fluentd 1 Ruby 2 0.10 % No
1 Ruby 5 2 0.10 % No
Ruby 5 Linux 2 0.10 % No
5 Linux 4 2 0.10 % No
コメント fluentd 1 2 0.10 % No
fluentd html C 1 0.05 % No
20140212 設置が超簡単でカスタマイズ性の高い吹き出しホバー用jQueryプラグインjqueryballoonjs 20130811 1 0.05 % No
設置が超簡単でカスタマイズ性の高い吹き出しホバー用jQueryプラグインjqueryballoonjs 20130811 要素の高さを揃える超軽量なjQueryプラグインjquerytilejs 1 0.05 % No
20130811 要素の高さを揃える超軽量なjQueryプラグインjquerytilejs Tags 1 0.05 % No
要素の高さを揃える超軽量なjQueryプラグインjquerytilejs Tags makefile 1 0.05 % No
Tags makefile fluentd 1 0.05 % No
makefile fluentd html 1 0.05 % No
Ruby bash Batch 1 0.05 % No
html C Jekyll 1 0.05 % No
C Jekyll Ruby 1 0.05 % No
Jekyll Ruby bash 1 0.05 % No
142をRuby 200Windowsに導入 20140212 1 0.05 % No
bash Batch Octopress 1 0.05 % No
Batch Octopress GitHub 1 0.05 % No

SEO Keywords (Four Word)

Keyword Occurrence Density Possible Spam
20161112 コメント fluentd 1 2 0.10 % No
Ruby 5 Linux 4 2 0.10 % No
コメント fluentd 1 Ruby 2 0.10 % No
1 Ruby 5 Linux 2 0.10 % No
fluentd 1 Ruby 5 2 0.10 % No
200Windowsに導入 20140212 設置が超簡単でカスタマイズ性の高い吹き出しホバー用jQueryプラグインjqueryballoonjs 20130811 1 0.05 % No
20140212 設置が超簡単でカスタマイズ性の高い吹き出しホバー用jQueryプラグインjqueryballoonjs 20130811 要素の高さを揃える超軽量なjQueryプラグインjquerytilejs 1 0.05 % No
設置が超簡単でカスタマイズ性の高い吹き出しホバー用jQueryプラグインjqueryballoonjs 20130811 要素の高さを揃える超軽量なjQueryプラグインjquerytilejs Tags 1 0.05 % No
20130811 要素の高さを揃える超軽量なjQueryプラグインjquerytilejs Tags makefile 1 0.05 % No
要素の高さを揃える超軽量なjQueryプラグインjquerytilejs Tags makefile fluentd 1 0.05 % No
Tags makefile fluentd html 1 0.05 % No
makefile fluentd html C 1 0.05 % No
html C Jekyll Ruby 1 0.05 % No
fluentd html C Jekyll 1 0.05 % No
C Jekyll Ruby bash 1 0.05 % No
Jekyll Ruby bash Batch 1 0.05 % No
Ruby bash Batch Octopress 1 0.05 % No
bash Batch Octopress GitHub 1 0.05 % No
Batch Octopress GitHub jQuery 1 0.05 % No
Octopress GitHub jQuery Linux 1 0.05 % No

Internal links in - urin.github.io

CSSのみでラジオボタンとチェックボックスをトグルボタンにする
CSSのみでラジオボタンとチェックボックスをトグルボタンにする - URIN HACK
特定のユーザ権限でのみ実行されるシェルスクリプト
特定のユーザ権限でのみ実行されるシェルスクリプト - URIN HACK
Linuxローカル環境用に最小限のyumリポジトリを作成する方法
Linuxローカル環境用に最小限のyumリポジトリを作成する方法 - URIN HACK
fluent-plugin-dstatで取得した値が不正になる問題を解決
fluent-plugin-dstatで取得した値が不正になる問題を解決 - URIN HACK
logrotate.bat - Windowsのバッチファイルでログローテート
logrotate.bat - Windowsのバッチファイルでログローテート - URIN HACK
C++で無名関数の関数ポインタを作る
C++で無名関数の関数ポインタを作る - URIN HACK
Jekyll 2.3.0をWindowsに導入
Jekyll 2.3.0をWindowsに導入 - URIN HACK
Jekyll 1.4.2をRuby 2.0.0+Windowsに導入
Jekyll 1.4.2をRuby 2.0.0+Windowsに導入 - URIN HACK
要素の高さを揃える超軽量なjQueryプラグインjquery.tile.js
要素の高さを揃える超軽量なjQueryプラグインjquery.tile.js - URIN HACK
makefile
タグ別記事一覧 - URIN HACK
fluentd
タグ別記事一覧 - URIN HACK
html
タグ別記事一覧 - URIN HACK
C++
タグ別記事一覧 - URIN HACK
Jekyll
タグ別記事一覧 - URIN HACK
Ruby
タグ別記事一覧 - URIN HACK
bash
タグ別記事一覧 - URIN HACK
Batch
タグ別記事一覧 - URIN HACK
Octopress
タグ別記事一覧 - URIN HACK
GitHub
タグ別記事一覧 - URIN HACK
jQuery
タグ別記事一覧 - URIN HACK
Linux
タグ別記事一覧 - URIN HACK
Windows
タグ別記事一覧 - URIN HACK
gcc
タグ別記事一覧 - URIN HACK
JavaScript
タグ別記事一覧 - URIN HACK
css
タグ別記事一覧 - URIN HACK
jquery.tile.js
jquery.tile.js Demo page
jquery.balloon.js
jquery.balloon.js Demo page

Urin.github.io Spined HTML


fluent-plugin-dstatで取得した値が不正になる問題を解決 - URIN HACK  2016-11-12 コメント fluentd 1 Ruby 5 Linux 4 fluent-plugin-dstatで取得した値が不正になる問題を解決 shun0102/fluent-plugin-dstat at v0.3.2で1秒周期にデータ収集していたら取得した値が明らかに不正になる時があったので、それを解決してPull Requestしv0.3.3としてマージされた。 問題を確認した環境 td-agent 2.3.1 (fluentd 0.12.20) fluent-plugin-dstat 0.3.2 問題の内容 dstatから取得した値がリソースなどに依らず全て不正な値となることがある。 常時ある程度の負荷(CPU負荷20%程度)がかかっている環境で1秒周期で収集した場合、発生頻度は5~15分に1度程度。 不正な値となる原因 fluent-plugin-dstat は 子プロセスとして dstat プロセスを生成し dstat は /tmp/dstat.csv というファイルに収集したデータを書く。 fluent-plugin-dstat はそのファイルを0.5秒周期で監視し変化があった時、ファイルの内容を解析しJSON化する。 このように一時ファイル経由でのデータ授受をしているが、読みだす側のプロセス fluent-plugin-dstat と書き込む側のプロセス dstat 間で同期(排他)を取っていない。 つまり何らかの要因(主にOS)で書き込み側のバッファがflushされた時、読み込んだデータは不完全な(カラムが欠落した)行を含む可能性があるが、それが考慮されていなかった。 対策 ファイルから読み込んだデータが改行で終わっていなかったら、その行はJSON化せず内部に保持し、次に読み込んだ先頭行と連結するようにした。 これで不正値になることはなくなりかなり安定した。が、ほぼ一定の周期でデータが数点抜ける。 ソースを見ると fluent-plugin-dstat は100行読み込む度に /tmp/dstat.csv をクリアしていた。 同期なしに2つのプロセスが同一のファイルに書き込むので、データ抜けが起こるのも当然だった。 確かに誰かが一時ファイルをクリアしないとファイルが肥大化し続けてしまう。 そもそも dstat が標準出力に吐いてくれればファイルの肥大化など気にする必要もないのだが、解析に適したCSV形式の出力先に標準出力や標準エラー出力を選ぶオプションはなかった。 やりたいことは単なるデータの受け渡しで、しかも dstat はLinux限定のコマンドなので、一時ファイルとしてfifo(名前付きパイプ)を使うことにした。そうするとファイルのクリア処理自体が不要となる。 解決!と思ったら・・・ まだほぼ一定の周期(15分程度)でデータが数点抜ける・・・。調べるとほぼ一定の周期で dstat が死んで fluent-plugin-dstat が dstat プロセスを再生成してた。 dstatが死ぬ原因と対策 fluent-plugin-dstat はIO.popenで dstat プロセスを生成していたが、ここで作成されるパイプが満杯になると dstat が死ぬようだった。パイプのサイズは大体 65536 バイト。対策は簡単。パイプが満杯にならないよう標準出力と標準エラー出力を捨てるようにすればいい。 結果 これらを全て解決してPull Requestしv0.3.3としてマージされた。  2016-11-12 コメント fluentd 1 Ruby 5 Linux 4 logrotate.bat - Windowsのバッチファイルでログローテート Linuxローカル環境用に最小限のyumリポジトリを作成する方法 Please enable JavaScript to view the comments powered by Disqus. Recent Entries 2018-02-04 CSSのみでラジオボタンとチェックボックスをトグルボタンにする 2017-11-30 特定のユーザ権限でのみ実行されるシェルスクリプト 2017-02-25 Linuxローカル環境用に最小限のyumリポジトリを作成する方法 2016-11-12 fluent-plugin-dstatで取得した値が不正になる問題を解決 2015-09-19 logrotate.bat - Windowsのバッチファイルでログローテート 2015-04-05 C++で無名関数の関数ポインタを作る 2014-08-14 Jekyll 2.3.0をWindowsに導入 2014-03-02 Jekyll 1.4.2をRuby 2.0.0+Windowsに導入 2014-02-12 設置が超簡単でカスタマイズ性の高い吹き出しホバー用jQueryプラグインjquery.balloon.js 2013-08-11 要素の高さを揃える超軽量なjQueryプラグインjquery.tile.js Tags makefile fluentd html C++ Jekyll Ruby whack Batch Octopress GitHub jQuery Linux Windows gcc JavaScript css Repositories jquery.tile.js 要素の高さを揃える超軽量なjQueryプラグイン jquery.balloon.js 設置もカスタマイズも超簡単な吹き出しホバー用jQueryプラグイン wers Windows用Rubyバージョン管理ツール(rbenvのWindows版) jquery.stretchable.js 要素を浮かせて伸ばすボタンを付けるjQueryプラグイン .vimrc Vim用設定ファイル Styled with Twitter Bootstrap 3. Scripted with jQuery. Powered by Jekyll version 3.4.1. Hosted on GitHub. Managed with git. © 2013 - 2018 うりん