This account is not set to public on notestock.
This account is not set to public on notestock.
このまえ Twitter でみた,Excel は ex-(外に出る)cell(セルの)が語源だっていう嘘語源がすき
リレーサーバの実装の話。
現在のリレーサーバ実装(pub-relay)は、登録インスタンスのリスト(ドメインとinboxのアドレス)と、登録を拒否(ブロック)するドメインのリストだけをデータベースに持っています。
relay@リレーサーバ というアカウントが直接生えているので、各インスタンスはこれとやりとりしています。
登録インスタンスがrelayのinboxに投稿を投げてよこしたら、全登録インスタンスのinboxにそれを投げ直します(パススルー)。
relayへのフォローリクエストの体で、リレーに登録し、フォロー取り消しで削除。
sidekiqでProcessWorkerとDeliverWorkerが走っていて、ProcessWorkerがrelayに対するリクエストの処理、DeliverWorkerが各インスタンスへトゥートを配信する処理を行います。
sidekiqのキューはdefaultのみ、リトライは行いません。
登録インスタンス一覧と、ブロックの登録・削除を行う、シンプルなコマンドラインツールがついています。
実に美しく読みやすい。
※個人の感想です #dtp
7a6860823 (upstream/master, origin/master, origin/HEAD, master) Fix index detection a migration to revert index change (#8026)
dc62195a0 Upgrade Node.js to v8.x on nvmrc (#8023)
をまじマージ中。起動せんしになりませぬよう
いや起動はするんだけどね。Postgresにつなごうとすると落ちるんよね。落ちないといいね。
\マスター/ \ますたー/
Merged tootsuite/mastodon at 7a686082370ad6d1c7a7d0ad331c22bf3e1fbede.
警告をエラーにする設定でリリース出すやつ、お前は未来に現れる全ての仕様準拠コンパイラの警告の実装を知っているのかと問い詰めたい
heroku-18でlibpq-devを入れてビルドするだけじゃSEGVをもらうpg gemはできないなあ。jemalloc.shを通してもおなじ。うーむ。
This account is not set to public on notestock.
Heroku-18で作ったMastodon、
require 'pg'
uri = URI.parse(ENV['DATABASE_URL'])
conn = PG.connect(uri.hostname, uri.port, nil, nil, uri.path[1..-1], uri.user, uri.password)
は通った。
$ rake db:migrate は何もしない(あれれ?)
PumaはちゃんとSEGVをもらう。
むーん。
This account is not set to public on notestock.
This account is not set to public on notestock.
このインスタンスのPuma+SidekiqのCPU負荷が定常的に1を超えるようになってきた。何が変化したのだろう
This account is not set to public on notestock.
インスタンスのDBやメディアの保存容量圧縮について
リレーによるトラフィック増大を受けて、マジで考えなくてはいけなくなってきた件。
ちょうど今 @Gargron さんがpostした内容がぴったりです。
https://mastodon.social/@Gargron/100386555690511875
こちらのissueです。
https://github.com/tootsuite/mastodon/issues/1554
問題は認識されています。
掃除する基準、それを実行するsidekiqタスクが膨大になる件、など、相応に難しい問題だということですが、解決したいですねー。 #relay考
あ、リレイサーバからのトゥートの内容ってSubway Tooterの疑似アカウントで購読してみればプレビューできるのかな?
\ますたー/ \ますたー/
Merged tootsuite/mastodon at 2bcdfcdee3551a81a5e23b30d3f5bc54c2dcf39e.
いろいろあってadmin dashboardまだ入ってなかったのでした
いっぱいしゃべるとbacklogが増えるぞ! (Interaction数はこの機能を入れてから数え始めた感じかな?)
This account is not set to public on notestock.
This account is not set to public on notestock.
3スレッドで192/minの爆速トゥート配信。なんと2スレッドの1.5倍 (ちゃんとリニア)。それでも遅延は2分を超えるけどな!
そうそう、お久し振りに、Postgresのデータ行数の変化。だいたいリニアに伸びてるねー。
@ykzts Redisが統計を持っててくれる感じなんですねえ
app/controllers/admin/dashboard_controller.rb
@registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0
@logins_week = Redis.current.pfcount("activity:logins:#{current_week}")
@interactions_week = Redis.current.get("activity:interactions:#{current_week}") || 0
@usa 賄賂もらって危険な距離まで近づいたのかもーw #不謹慎 http://www.hawaiinewsnow.com/story/38655817/at-least-23-injured-after-lava-explosion-near-tour-boat-off-big-island
@usa 動画を見た限り、溶岩が海に流入してる場所で水蒸気爆発かなにかが起きたように見えました。
heroku run でシェル以外を指定するのはスクリプトの中で単体のコマンドを走らせたい時くらいですねー
usとeuにアプリをデプロイしておくとheroku runからcurl -wとかでレイテンシを測るのにも使えたりしますよw
このインスタンスのProcfileでございます
$ grep web: Procfile
web: if [ "$RUN_STREAMING" != "true" ]; then jemalloc.sh puma -C config/puma.rb & fi; if [ "$RUN_WORKER" == "true" ]; then jemalloc.sh sidekiq -c ${SIDEKIQ_THREADS:-5} & fi; if [ "$RUN_STREAMING" == "true" ]; then npm start & fi; wait -n
マイグレーションもRelease commandでお手軽に
$ grep release: Procfile
release: if [ "$RUN_STREAMING" != "true" ]; then rake db:migrate; else echo Not migrating on this app; fi
あ、web: で起動するプロセスは$PORTにバインドするまでに時間制限があるので起動ごとに必要のない作業はデプロイのときに、データベースの用意はリリースコマンドでやっておくといいっす
This account is not set to public on notestock.
This account is not set to public on notestock.
heroku runの間に作ったファイル、heroku runが終わったら消えちゃうから注意ですー https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem
@S_H_ 詳しくないのですが、Sprokets(かな?)が必要なCSSを認識してくれてない感じかも。ファイル名をリストしておくとバージョンのハッシユ付の公開用ファイルをプリコンパイル時に作ってくれるファイルがどこかに有った気がします(情報が増えてなーい。すみません。
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
\お仕事いっぱいなのでmasterに追随しますたー/
Merged tootsuite/mastodon at 6277a6db2a70b798aed71ff7e722d23b975182cd.
Heroku-18でビルドしたMastodonのpg gemがSEGVするのもなんとかせんとか
$ heroku pg:info -a zundan-mastodon
=== HEROKU_POSTGRESQL_ORANGE_URL, DATABASE_URL
Plan: Hobby-basic
Status: Available
Connections: 5/20
PG Version: 10.4
Created: 2017-12-16 18:16 UTC
Data Size: 1.96 GB
Tables: 46
Rows: 4142290/10000000 (In compliance)
This account is not set to public on notestock.
外付けSSDからのOS起動もオッケーなら、自宅に転がっている240GBないし480GBのSSDをブートキャンプ用に転用してもいいけど、そんな使い方出来るのかな?
ぼくのMacBook Air、Ubuntuのインスールイメージを入れたUSBメモリを起動できたよ
$ xchat
No command 'xchat' found, did you mean:
Command 'qchat' from package 'qchat' (universe)
Command 'chat' from package 'ppp' (main)
xchat: command not found
え…
\マスター/ \ますたー/
Merged tootsuite/mastodon at 7e638043b953b80ee0af11dc62d87eed14e98c98.
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
職場チャットで✨IPv6✨熱が再燃しててやっぱり家ネットワークをデュアルスタックにしようかねえ、と思い始めてる。けど急いだら怖そう。インターネットからラップトップへのIPv6でのルーティングを確実に止めたいんだよね。
This account is not set to public on notestock.
IPv6を有効にしようかねえ、と思ってルータのダッシュボード開いたらファームウェアの更新がありましたよ
@yakitama どちらのホストからも共通のPostgresとRedisにアクセスできるようにしておいて、それぞれのプロセスにPostgresとRedisの接続先を知らせてあげれば良さそうです。
Herokuだとホストはだいたいばらばらで、PumaとSidekiqはDATABASE_URLとREDIS_URL環境変数を直接読んでくれて、streamingのためには https://github.com/zunda/mastodon/blob/zunda-ninja-master-on-heroku/.profile#L4-L19 みたいに環境変数を設定してあげてます。
@yakitama そそ。SidekiqはRedisからお仕事もらってますからねえ。あ、ただ、Sidekiqのホストだけ移動させるんだったらstreamingの部分のスクリプトは忘れていいのでそれほど大変じゃないかも。
This account is not set to public on notestock.
ちな
基盤: Infrastructure
基板: Printed circuit board
こまけーことはいいんだよ←
7e63804しか無いし追従しなくていいかあって思ってたけど中身見てみたら日本語の翻訳もいっぱいだあ (( ))
\ますたー/ \ますたー/
Merged tootsuite/mastodon at 7e638043b953b80ee0af11dc62d87eed14e98c98.
This account is not set to public on notestock.
This account is not set to public on notestock.
2分の遅延で詰まってることになるならこのインスタンスなんて詰まらないこと無い!(つまらない)
日本のオクトーバーフェスト、10月以外でも平気で開催されてるしなあ(ミュンヘンのは9月下司からだw
Linux
Apache
Mastodon
Postgres
This account is not set to public on notestock.
そうそう、他のインスタンスからのトゥートの配達の遅延を可視化するとどこの調子が悪いか見えちゃうかもだよね(いじわる)
dataclipsでできるかも(いじわる)
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
最近1時間に届いたトゥートが古い順に10インスタンスを教えてくれるいじわるクエリだよ
SELECT
avg(updated_at - created_at) AS delay,
substring(uri from '.*://([^/]*)') as host
FROM statuses
WHERE
uri IS NOT NULL AND
updated_at > current_timestamp + '-1 hour'
GROUP BY host
ORDER BY delay DESC
LIMIT 10;
54日前とか1週間前とかあってドキドキしてる。
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
最小の遅延も確認すると.jpが流れはじめてるのも見えそう
SELECT
min(updated_at - created_at) AS delay_min,
avg(updated_at - created_at) AS delay_avg,
max(updated_at - created_at) AS delay_max,
substring(uri from '.*://([^/]*)') as host
FROM statuses
WHERE
uri IS NOT NULL AND
updated_at > current_timestamp + '-1 hour'
GROUP BY host
ORDER BY delay_avg DESC
LIMIT 10;
@yotii23 Herokuとかいうサービスだと割と楽らしいですよw https://github.com/zunda/mastodon/wiki
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
ここ数年は独立なハードディスクにrsyncで1日に1度だけ同期してデータは失なってない。ハードディスクは何度か壊れて交換したけど。
本田さんぽいGitHubアカウント、草は1コミット分(アカウントが分かな?)でレポジトリ1個もないのに52フォロワもいらっしゃってさすがです。そのうちレポジトリを作るだけで実装がPRされてくるよきっと!!
> WITH deliveries AS (
SELECT
id, (updated_at - created_at) as delay,
text,
uri,
substring(uri from '.*://([^/]*)') as host
FROM statuses
WHERE
uri IS NOT NULL AND
updated_at > current_timestamp + '-1 hour'
)
SELECT delay, uri FROM deliveries WHERE host = 'mastodon.zunda.ninja'
ORDER BY delay DESC LIMIT 1;
delay | 00:38:30.788266
uri | https://mastodon.zunda.ninja/users/zundan/statuses/100404194581416397
ブーストとかファボかでupdated_atが更新されるんだな、きっと。
最近1時間に届いたトゥートが古い順に10インスタンスを教えてくれるいじわるクエリだよ
SELECT
avg(updated_at - created_at) AS delay,
substring(uri from '.*://([^/]*)') as host
FROM statuses
WHERE
uri IS NOT NULL AND
updated_at > current_timestamp + '-1 hour'
GROUP BY host
ORDER BY delay DESC
LIMIT 10;54日前とか1週間前とかあってドキドキしてる。
@ashphy オイデオイデw (近くにMastodonユーザーいらっさってるのかと思って喜んで覗きに行ったらどうもオアフ島にいらっしゃるようでした)
@ashphy 羽田からJALとHawaiianが飛んでると思いますー。ハワイ島の西側は観光地っぽく観光に良さそう♪
@ashphy むかーしここに引っ越す前に学会で出張したことあります!! むっさい服でみんなで浮くのw
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
@mzp クーラーはビールの醸造の(下面発酵してるのを冷やす)ために発明されたって聞いたことあるのでたぶんだいじょび!
だいたい合ってたw -- No.38 「冷たい場所」への飽くなき欲求ーリンデの「アンモニア式冷凍機」│史学部│キリンビール大学|キリン https://www.kirin.co.jp/entertainment/daigaku/HST/hst/no38/
クーラーがない世界線の人「あつくてクーラークーラーするー(ばたり)」w
@ksmakoto どういうことなのw てか、黒電話でもモジューラジャックにしたら使えそうな感じですね。さすがに電源が足りないかな?
ElasticSearch、なかなか容量が増えない。悪いことでは無いんだけど何か間違ってるような…
SEGVするMastodon、rails cしてUser.find(1)しても落ちないんだけど
$ puma -C config/puma.rb &
$ curl -H 'X-Forwarded-Proto: https' localhost:$PORT
するとむっちゃ落ちる
というわけでやっとこバックトレースが取れました
https://gist.github.com/zunda/051847b7a3ac2d754cb1194b1483c7d5
This account is not set to public on notestock.
@kunimi_komichi Postgresの場合はWrite Ahead Log (WAL)というデータへの操作履歴をファイルとして取り出すことができるので、それを随時待機側のサーバに食べさせる(ストリーミング・レプリケーション)ことで同じ内容の読み取り専用のサーバを走らせておくことができます。親が壊れたらその時点で待機側を書き込み可にして親に(フェイルオーバー)します。
AWSのコンソールにログインする時のぐるぐるって微妙に回転中心がずれてるような気がするんだよね
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
! [rejected] master -> master (fetch first)
またやっちまった
zundanさんを酔わせるには
ワイン1杯 125ml
缶チューハイ 1缶 350ml
缶チューハイ 1缶 350ml
缶ビール3本 1500ml
が必要でしょう。
#あなたはどこまで飲ませると酔うのか
https://shindanmaker.com/810951
ていうかせっかくお好み焼き焼いてるのにビール切れてるんですけど 💢
ちょっとビンビンな気分のzundanさんには、
「ゴールワーズ・レッド ベリー」がおすすめです。
#beer_match
https://shindanmaker.com/796323
瓶ビールなのかしら?
This account is not set to public on notestock.
This account is not set to public on notestock.