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

ANDPAD における Ruby on Rails と開発者達の衝動について 2022

ANDPAD における Ruby on Rails と開発者達の衝動について 2022

古橋 一真 (秒速@284km)
Qiita Night 登壇資料
https://increments.connpass.com/event/241385/

ANDPAD inc

April 07, 2022
Tweet

More Decks by ANDPAD inc

Other Decks in Technology

Transcript

  1. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    ANDPAD における Ruby on Rails と
    開発者達の衝動について 2022
    2022/4/7
    株式会社 アンドパッド 古橋一真
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止

    View full-size slide

  2. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    ANDPAD における Ruby on Rails
    と 開発者達の衝動について 2022

    View full-size slide

  3. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    桜の季節ですね 🌸
    Hanami

    View full-size slide

  4. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Ruby on Rails

    View full-size slide

  5. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    どういう立ち位置から話すのかという説明

    View full-size slide

  6. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    自己紹介
    ● @284km
    ○ 古橋 一真 (Kazuma Furuhashi)
    ○ 秒速@284km
    ● ANDPAD
    ○ SWE
    ○ Tech Lead
    ○ VP of Technology

    View full-size slide

  7. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Rails の開発現場

    View full-size slide

  8. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    諸説あるかと思いますが、日常の
    開発の中で ”Rails” が指す範囲と
    いうのは、実際けっこう広いこと
    が多いと思います。

    View full-size slide

  9. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    Rails の開発現場
    ● api
    ● view
    ● job / worker
    ● model / RDB 設計
    ● SQL そのもの
    ● cache, elasticsearch, redis
    ● mailer
    ● インフラ
    ● security
    ● 認証や権限管理にまつわる機能
    ● 運用 / 障害対応
    ● 調査 / logger
    ● 開発時の役割分担
    ● デザインとの接点は
    ● view と frontend, mobile
    ● module / gem
    ● protocol
    ● データ基盤との関連
    ● 要件との接続 / ユビキタス言語

    View full-size slide

  10. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    The Rails Doctrin.
    https://rubyonrails.org/doctrine
    Convention over Configuration
    Rails is omakase
    https://dhh.dk/2012/rails-is-omakase.html
    Rail

    View full-size slide

  11. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    Rails アプリケーションとしての ANDPAD
    ● 創業期(2015 - 2017年)
    ○ 〜 MVPまで 〜 高速な機能改修、実証実験、何度も作り直し移行
    ● 拡大期(2018年)
    ○ エンジニアチームの、サービスの拡大、障害発生も、画面打鍵!!!が通用しない
    ● 改善活動の土台作り(2019年)
    ○ ANDPAD は幅広い業界・業務範囲で、今後も拡大させてゆきたいので! rspec
    ● 改善活動中(2020年〜継続)
    ○ 好転が始まった
    ● 改善活動と新規開発の両輪
    ○ 安定と衝動と

    View full-size slide

  12. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    刻一刻と事業のフェーズが進行するので、プロダク
    トも変化していく必要がある!

    View full-size slide

  13. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    Rails アプリケーション upgrade のようす
    ● 2015年05月: Rails 4.2 で開発開始
    ● 2016年12月: Rails 5.0 にアップグレード
    ● 2017年06月: Rails 5.1 にアップグレード
    ● 2020年10月: Rails 5.2 にアップグレード
    ● 2021年02月: Rails 6.0 にアップグレード
    ● 6.1 to 7 now
    https://rubygems.org/gems/rails/versions
    ● 2014年12月 Rails 4.2リリース
    ● 2016年06月 Rails 5.0リリース
    ● 2017年04月 Rails 5.1リリース
    ● 2018年04月 Rails 5.2リリース
    ● 2019年08月 Rails 6.0リリース
    ● 2020年12月 Rails 6.1リリース
    ● 2021年12月 Rails 7.0 リリース

    View full-size slide

  14. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    最近の取り組み / 改善について

    View full-size slide

  15. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    2021 年
    https://speakerdeck.com/andpad/hutuufalsehitogaganbarazuniwe
    n-ti-er-kodowogai-shan-siteiruhua
    ふつうのひとががんばらずに問題児コードを改善している話
    過去に突き進んだ独自実装、不必要なメタプロに対する改善
    https://speakerdeck.com/andpad/railstefalsekuerigai-shan-falseh
    uaua
    Rails でのクエリ改善の話

    View full-size slide

  16. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    計測するな、推測せよ
    ● 推測するな、計測せよ
    ○ ボトルネックを置い続ける
    ○ 構造を理解した上で、改善を行うことがだ
    いじ
    ● 複雑な要件(特にだいじなところに現
    れがち)
    ○ ニーズは、ユースケースは
    ○ => 要件定義
    ○ => model, api 設計に反映される
    ○ => 運用コスト/難易度 に反映される
    ● クエリ
    ○ 過去 n ヶ月
    ○ 90 percentile
    ○ 99 percentile
    ○ リクエストのパフォーマンス

    ○ SQL, index 見直し
    ○ キャッシュテーブル
    ○ 非同期実行 (sidekiq pro)

    ○ 運用
    ○ ユーザ体験
    ○ 検索順位

    ○ deadlock

    View full-size slide

  17. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    https://tech.andpad.co.jp/entry/2021/02/10/170000
    Webアプリケーションのパフォーマンス勉強会を開催しました!
    https://tech.andpad.co.jp/entry/2022/01/12/110000
    ANDPAD TECH TALK 第8回 - アンドパッド1人目DBREに聞く!前
    編 アンドパッドのDBREは何をするの?
    (pull requst / db migration / reviewer)

    View full-size slide

  18. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    インフラ
    ● 2020年末
    ○ 猛烈に成長するSaaSのインフラを猛烈にカイゼンする技術
    ○ https://tech.andpad.co.jp/entry/2020/12/14/170000
    ○ SRE しんのすけさん
    ○ たぶんそのうち書かれるだろう「Dockerコンテナ移行しました」記事の先史時代の記録として、また、事業の成長
    に併走してきたEC2でのアーキテクチャの御焚上として奏上するものです。
    ● 2022 年 つい最近
    ○ ANDPAD本体サービスをEKSに移行しました。めでたい!
    ○ https://tech.andpad.co.jp/entry/2022/04/06/100000
    ■ SWE 浜田さん執筆 EKS に移行完了
    ■ 2020/11頃から開始し、2021/12に第一弾の本番リリースが完了しました
    ■ リリース作業に要する時間が大幅に短縮された。(20min 前後の短縮) めでたい
    ■ Rails アプリケーション平時の運用に加え、切り戻し対応など発生する場合にも速いのは心強い
    ■ レスポンスタイムが改善したことも超ありがたい (Rails app 側の工夫ではないにしても)
    ■ アプリケーション開発と運用はセットで考えていきたい。今後も継続改善!(DevOps)

    View full-size slide

  19. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    アーキテクチャ
    ● チャット プロダクト
    ○ RDB(mysql) Firestore に移行 適材適所 && やってみたいという気持ち && やり
    きるぞの意思 => 素晴らしいなと誇れる点
    ○ 理論 + 衝動
    ○ 5000万件越えのRDS大量データをFirestoreに移行する勘所
    ○ https://tech.andpad.co.jp/entry/2021/03/23/170000)

    View full-size slide

  20. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    理論 + 衝動

    View full-size slide

  21. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    理論と衝動
    ● プロダクトが多い
    ● 違ったフェーズのプロダクトがたくさん並行して走る
    ● 各プロダクト、変化し続けるし、変化は要求されもする
    ● MVP
    ● PMF
    ● グロース
    ● 守るのが得意、突き進むことができる。協力
    ● 目的の共有はめっちゃ大事。走る。

    View full-size slide

  22. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    2022年 〜 未来へ

    View full-size slide

  23. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    Rails アプリケーションとしての ANDPAD の特徴
    ● Rails アプリケーション = 事業と密接な関係にある(当然ではある)

    ● Rails アプリケーションとしての ANDPAD の特徴
    ○ 今現在、既にある程度大きい
    ○ さらに大きくなっている最中 (機能拡張や、プロダクトが増えるから。建設・建築業界でかい )
    ○ プロダクトは多いと言える (refs. andpad.jp/products)

    ● プロダクトが = 事業が = 組織が 成長を続ける

    View full-size slide

  24. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    開発における責務と協力することについて api 境界
    ● - Ruby on Rails
    ● - Go
    ● - React / Vue
    ● - iOS
    ● - Android
    ● - Flutter

    ● - controller
    ● - private api / public api
    ● - model
    ● - view
    ● - job
    ● - 認証認可や utility 系の実装達

    View full-size slide

  25. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    protocol / service 境界
    ● http(s)
    ● graphql, BFF
    ● grpc

    ● account / auth
    ● user info

    ● designdoc
    ● 人の衝動は強い / 自由であること / 安定と学習と前進

    View full-size slide

  26. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    The Rails Doctrin.
    https://rubyonrails.org/doctrine
    Convention over Configuration
    Rails is omakase
    https://dhh.dk/2012/rails-is-omakase.html
    Rail

    View full-size slide

  27. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. 無断転載・無断複製の禁止
    協働
    ● リモートワークが標準である
    ● 地方在住メンバーがいる
    ● 海外在住メンバーもいる
    ● コミュニケーション平準化

    ● Rails のレールが有効なシーン
    ● 世界中の開発者と、レールに沿った開発ができる強み

    ● Rails のレールをレール外から見る開発者達との協力
    ● Rails の model には知見がたくさん

    ● 人も増える!!

    View full-size slide

  28. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    The Rails Doctrin.
    https://rubyonrails.org/doctrine
    Convention over Configuration
    Rails is omakase
    https://dhh.dk/2012/rails-is-omakase.html
    Rail

    View full-size slide

  29. Copyright © 2020 Present ANDPAD Inc. This information is confidential and was prepared by ANDPAD Inc. for the use of our client. It is not to be relied on by and 3rd party. Proprietary & Confidential 無断転載・無断複製の禁止
    Rails との良き関係を 2022 年も
    改善継続
    自由な領域を持つため、衝動で突き進める余地を
    持ち続けるため
    境界を整理する
    2022 年のひとつの開発現場から

    View full-size slide