Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Railsでサーバレスなバッチ処理 / Rails Batch Serverless

Railsでサーバレスなバッチ処理 / Rails Batch Serverless

https://shuuu-mai.connpass.com/event/132249/

の登壇時の資料です。

Daishi Kakinoki

June 19, 2019
Tweet

More Decks by Daishi Kakinoki

Other Decks in Programming

Transcript

  1. 3 3

  2. 7 7

  3. 28 InnoDBインデックスの最大キー長を考慮 • 絵文字に対応するため文字コードは utf8mb4を使用している。 • utf8mb4の場合は1文字あたり最大で 4バイト使用する。 • 単一カラムインデックスの最大キー長は

    767バイトまで作成可能。 • RDS(MySQL)やAuroraでは3072バイトまで拡張可能だが、 Aurora Serverlessでは拡張に必要なパラ メータのinnodb_large_prefixを有効にできない。 • 結果的にRailsデフォルトのstring(varchar)255文字でカラムを作成しようとすると、 255 x 4 = 1020(>767)でカラム作成時にエラーになる。 • stringでカラムを作る時には文字数をきちんと絞る必要があり、今回は要件的に問題なかった。
  4. 30 ざっくりとした比較 従来
 (常時起動)
 今回
 (実績)
 データベース (例)Aurora
 t3.small: 約5,000円/month

    
 t3.medium: 約10,000円/month 
 約1800円/month( 約½ ~ ¼ )
 アプリケーション (バッチ) (例)
 c5.large: 約8,500円
 約1500円/month( ⅕ 以下 )
 ※ インスタンス利用費のみの比較 ※ AWS Batchのコンピューティング環境は optimalにすると、C、M、Rいずれかのタイプが 使われる (インスタンスタイプを指定することも可能 ) ※ ちなみに、AWS Batchの利用自体は無料