{"id":1811,"date":"2026-03-26T20:23:02","date_gmt":"2026-03-26T11:23:02","guid":{"rendered":"https:\/\/www.ambulo.tv\/blog\/?p=1811"},"modified":"2026-03-31T18:25:23","modified_gmt":"2026-03-31T09:25:23","slug":"%e3%82%a2%e3%83%97%e3%83%aa%e3%81%8c%e9%81%85%e3%81%84%e3%81%a8%e3%81%8d%e3%81%ab%e8%80%83%e3%81%88%e3%82%8b%e3%81%93%e3%81%a8","status":"publish","type":"post","link":"https:\/\/www.ambulo.tv\/blog\/%e3%82%a2%e3%83%97%e3%83%aa%e3%81%8c%e9%81%85%e3%81%84%e3%81%a8%e3%81%8d%e3%81%ab%e8%80%83%e3%81%88%e3%82%8b%e3%81%93%e3%81%a8\/","title":{"rendered":"WEB\u30a2\u30d7\u30ea\u304c\u9045\u3044\u3068\u304d\u306b\u8003\u3048\u308b\u3053\u3068"},"content":{"rendered":"\n<p>Rails\u304c\u9045\u3044\u3068\u8a00\u308f\u308c\u305f\u3068\u304d\u306b\u3084\u308b\u3053\u3068\u5b8c\u5168\u30ac\u30a4\u30c9 <a href=\"https:\/\/zenn.dev\/okamyuji\/articles\/rails-performance-practical-guide\" target=\"_blank\" rel=\"noreferrer noopener\">\ud83d\udd17<\/a><\/p>\n\n\n\n<p>APM (\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0) \u3068\u306f\u4f55\u3067\u3059\u304b?\u3000<a href=\"http:\/\/APM (\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30e2\u30cb\u30bf\u30ea\u30f3\u30b0) \u3068\u306f\u4f55\u3067\u3059\u304b?\" target=\"_blank\" rel=\"noreferrer noopener\">\ud83d\udd17<\/a><\/p>\n\n\n\n<p>SKYLIGHT <\/p>\n\n\n\n<p>\u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u753b\u9762\u9077\u79fb\u304c\u9045\u3044\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u3068\u3057\u3066\u306f\u5c11\u3057\u4e0d\u5b89\u306b\u306a\u308a\u307e\u3059\u3002\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001<strong>\u539f\u56e0\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff08MySQL\uff09\u3060\u3051\u3067\u306a\u304f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\uff08Rails\uff09\u5074\u3001\u3042\u308b\u3044\u306f\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u3068\u306e\u9023\u643a\u306a\u3069\u3001\u8907\u6570\u306e\u53ef\u80fd\u6027<\/strong>\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u306f\u300c\u3069\u3053\u3067\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3044\u308b\u304b\u300d\u3092\u7279\u5b9a\u3059\u308b\u306e\u304c\u89e3\u6c7a\u3078\u306e\u8fd1\u9053\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u30b9\u30c6\u30c3\u30d7\u3067\u78ba\u8a8d\u3092\u9032\u3081\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. \u30ed\u30b0\uff08development.log \/ production.log\uff09\u3092\u78ba\u8a8d\u3059\u308b<\/h4>\n\n\n\n<p>Rails\u306e\u30ed\u30b0\u306b\u306f\u3001\u51e6\u7406\u6642\u9593\u306e\u5185\u8a33\u304c\u8a18\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30ed\u30b0\u30a4\u30f3\u6642\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u63a2\u3057\u3001\u4ee5\u4e0b\u306e\u6570\u5024\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Completed 200 OK in XXXms (Views: XXms | ActiveRecord: XXms)<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>ActiveRecord<\/strong> \u306e\u6570\u5024\u304c\u5927\u304d\u3044\u5834\u5408\uff1aMySQL\u306e\u30af\u30a8\u30ea\uff08\u691c\u7d22\u3084\u66f4\u65b0\uff09\u306b\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>Views<\/strong> \u306e\u6570\u5024\u304c\u5927\u304d\u3044\u5834\u5408\uff1a\u9077\u79fb\u5148\u753b\u9762\u306e\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\uff08HTML\u751f\u6210\uff09\u304c\u91cd\u3044\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u305d\u308c\u4ee5\u5916\uff08\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5185\u3067\u306e\u51e6\u7406\uff09<\/strong> \u304c\u5927\u304d\u3044\u5834\u5408\uff1a\u5916\u90e8API\u547c\u3073\u51fa\u3057\u3084\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u30cf\u30c3\u30b7\u30e5\u5316\u3001\u8907\u96d1\u306a\u30ed\u30b8\u30c3\u30af\u304c\u539f\u56e0\u3067\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. \u78ba\u8a8d\u3059\u3079\u304d\u30b3\u30fc\u30c9\u306e\u7b87\u6240<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">\u2460 SessionsController#create\uff08\u30ed\u30b0\u30a4\u30f3\u5b9f\u884c\u30e1\u30bd\u30c3\u30c9\uff09<\/h5>\n\n\n\n<p>\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u76f4\u5f8c\u306b\u52d5\u304f\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30d1\u30b9\u30ef\u30fc\u30c9\u691c\u8a3c:<\/strong> user.authenticate(params[:password]) \u306f\u610f\u56f3\u7684\u306b\u8ca0\u8377\u3092\u304b\u3051\u308b\u51e6\u7406\u3067\u3059\u304c\u3001\u6975\u7aef\u306b\u9045\u3044\u5834\u5408\u306f\u30b5\u30fc\u30d0\u30fc\u306e\u30b9\u30da\u30c3\u30af\u4e0d\u8db3\u306e\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u5916\u90e8\u901a\u4fe1:<\/strong> \u30ed\u30b0\u30a4\u30f3\u6642\u306b\u300c\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u3078\u901a\u77e5\u300d\u3084\u300cSNS\u9023\u643a\u306e\u30c7\u30fc\u30bf\u540c\u671f\u300d\u306a\u3069\u3092\u540c\u671f\u51e6\u7406\uff08\u975e\u540c\u671f\u3067\u306f\u306a\u304f\uff09\u3067\u884c\u3063\u3066\u3044\u307e\u305b\u3093\u304b\uff1f<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>\u2461 \u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\uff08home#index \u306a\u3069\uff09<\/strong><\/h5>\n\n\n\n<p>\u300c\u30ed\u30b0\u30a4\u30f3\u51e6\u7406\u300d\u81ea\u4f53\u3067\u306f\u306a\u304f\u3001**\u300c\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u5f8c\u306b\u8868\u793a\u3059\u308b\u753b\u9762\u300d**\u306b\u539f\u56e0\u304c\u3042\u308b\u30d1\u30bf\u30fc\u30f3\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>N+1\u554f\u984c:<\/strong> \u30ed\u30b0\u30a4\u30f3\u5f8c\u306e\u30c8\u30c3\u30d7\u753b\u9762\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u6295\u7a3f\u3001\u30b3\u30e1\u30f3\u30c8\u3001\u30d5\u30a9\u30ed\u30fc\u72b6\u6cc1\u306a\u3069\u3092\u4e00\u6c17\u306b\u53d6\u5f97\u3057\u3066\u3044\u307e\u305b\u3093\u304b\uff1f<\/li>\n\n\n\n<li><strong>\u91cd\u3044\u96c6\u8a08\u30af\u30a8\u30ea:<\/strong> \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067 COUNT \u3084 SUM \u306a\u3069\u3092\u5927\u91cf\u306b\u5b9f\u884c\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001MySQL\u5074\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u8cbc\u3089\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u304c\u5fc5\u8981\u3067\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u2462 ApplicationController \u306e before_action<\/h5>\n\n\n\n<p>\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u5fc5\u305a\u52d5\u304f\u5171\u901a\u51e6\u7406\uff08current_user \u306e\u53d6\u5f97\u3084\u6a29\u9650\u30c1\u30a7\u30c3\u30af\uff09\u3067\u3001\u91cd\u3044\u30af\u30a8\u30ea\u304c\u8d70\u3063\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. \u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u3092\u7279\u5b9a\u3059\u308b\u30c4\u30fc\u30eb<\/strong><\/h4>\n\n\n\n<p>\u30b3\u30fc\u30c9\u3092\u76ee\u3067\u8ffd\u3046\u3088\u308a\u3082\u3001\u4ee5\u4e0b\u306e\u30c4\u30fc\u30eb\u3092\u4f7f\u3046\u3068\u4e00\u767a\u3067\u539f\u56e0\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>rack-mini-profiler:<\/strong> \u958b\u767a\u74b0\u5883\u306e\u753b\u9762\u5de6\u4e0a\u306b\u3001\u305d\u306e\u753b\u9762\u3092\u8868\u793a\u3059\u308b\u306e\u306b\u304b\u304b\u3063\u305f\u6642\u9593\uff08SQL\u306e\u767a\u884c\u56de\u6570\u3084\u6642\u9593\uff09\u3092\u8868\u793a\u3057\u3066\u304f\u308c\u307e\u3059\u3002Rails\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u5fc5\u9808\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>bullet:<\/strong> N+1\u554f\u984c\u304c\u767a\u751f\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u8b66\u544a\u3092\u51fa\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u307e\u3068\u3081\uff1a\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/strong><\/h4>\n\n\n\n<p>\u307e\u305a\u306f\u3053\u308c\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\u78ba\u8a8d\u9805\u76ee<\/td><td>\u30c1\u30a7\u30c3\u30af\u5185\u5bb9<\/td><\/tr><tr><td><strong>SQL\u30ed\u30b0<\/strong><\/td><td>\u540c\u3058\u3088\u3046\u306a SELECT \u6587\u304c\u5927\u91cf\u306b\u767a\u884c\u3055\u308c\u3066\u3044\u306a\u3044\u304b\uff1f\uff08N+1\uff09<\/td><\/tr><tr><td><strong>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9<\/strong><\/td><td>\u691c\u7d22\uff08email \u306a\u3069\uff09\u306b\u4f7f\u3063\u3066\u3044\u308b\u30ab\u30e9\u30e0\u306b index \u306f\u8cbc\u3063\u3066\u3042\u308b\u304b\uff1f<\/td><\/tr><tr><td><strong>\u5916\u90e8\u901a\u4fe1<\/strong><\/td><td>API\u9023\u643a\u306a\u3069\u3092 delay\uff08\u975e\u540c\u671f\uff09\u306b\u305b\u305a\u5b9f\u884c\u3057\u3066\u3044\u306a\u3044\u304b\uff1f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u307e\u305a\u306f\u958b\u767a\u74b0\u5883\u306e\u30ed\u30b0\u3067 <strong>&#8220;ActiveRecord&#8221; \u306e\u6570\u5024<\/strong>\u304c\u3069\u308c\u304f\u3089\u3044\u5360\u3081\u3066\u3044\u308b\u304b\u898b\u3066\u307f\u307e\u305b\u3093\u304b\uff1f\u3082\u3057\u305d\u306e\u6570\u5024\u304c\u5927\u304d\u3051\u308c\u3070\u3001\u5177\u4f53\u7684\u306aSQL\u306e\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\uff08\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f5c\u6210\u306a\u3069\uff09\u3092\u304a\u624b\u4f1d\u3044\u3067\u304d\u307e\u3059\u3088\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u539f\u56e0\u3067\u300c\u9045\u304f\u300d\u306a\u308b\u552f\u4e00\u306e\u30b1\u30fc\u30b9\uff1a\u5916\u90e8\u901a\u4fe1\u306e\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8<\/h3>\n\n\n\n<p>\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001<strong>\u300c\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u5f8c\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u300d\u3068\u3044\u3046\u72b6\u6cc1\u306b\u304a\u3044\u3066\u3001\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u539f\u56e0\u3067\u3042\u308b\u53ef\u80fd\u6027\u306f\u304b\u306a\u308a\u4f4e\u3044<\/strong>\u3002<\/p>\n\n\n\n<p>\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u539f\u56e0\u3067\u3042\u308c\u3070\u3001\u901a\u5e38\u306f\u300c\u9045\u3044\u300d\u306e\u3067\u306f\u306a\u304f\u3001\u63a5\u7d9a\u305d\u306e\u3082\u306e\u304c\u62d2\u5426\u3055\u308c\u3066**\u300c\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\uff08\u63a5\u7d9a\u4e0d\u53ef\uff09\u300d**\u306b\u306a\u308b\u304b\u3001\u6700\u521d\u304b\u3089\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u306f\u305a\u3060\u304b\u3089\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3057\u3001<strong>1\u70b9\u3060\u3051\u300c\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\uff08\u307e\u305f\u306f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u8a2d\u5b9a\uff09\u304c\u539f\u56e0\u3067\u9045\u304f\u306a\u308b\u300d\u4f8b\u5916\u7684\u306a\u30d1\u30bf\u30fc\u30f3<\/strong>\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>Rails\u30a2\u30d7\u30ea\u304c\u30ed\u30b0\u30a4\u30f3\u51e6\u7406\u306e\u6700\u4e2d\u306b\u3001<strong>\u300c\u81ea\u5206\u4ee5\u5916\u306e\u30b5\u30fc\u30d0\u30fc\u300d\u306b\u901a\u4fe1\u3057\u3088\u3046\u3068\u3057\u3066\u3001\u305d\u308c\u3092\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u308b\u5834\u5408<\/strong>\u3067\u3059\u3002<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u30e6\u30fc\u30b6\u30fc\u304c\u30ed\u30b0\u30a4\u30f3\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3002<\/li>\n\n\n\n<li>Rails\u304c\u300c\u30ed\u30b0\u30a4\u30f3\u5b8c\u4e86\u300d\u3092\u8a18\u9332\u3057\u3088\u3046\u3068\u3059\u308b\u3002<\/li>\n\n\n\n<li>\u305d\u306e\u969b\u3001\u30b3\u30fc\u30c9\u306e\u4e2d\u3067\u300c\u8a8d\u8a3c\u30ed\u30b0\u3092\u5916\u90e8\u306e\u30ed\u30b0\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u308b\u300d\u3084\u300c\u5916\u90e8API\u306b\u901a\u77e5\u3059\u308b\u300d\u3068\u3044\u3063\u305f\u51e6\u7406\u304c\u8d70\u308b\u3002<\/li>\n\n\n\n<li>**\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u305d\u306e\u5916\u90e8\u901a\u4fe1\u3092\u906e\u65ad\uff08Drop\uff09**\u3057\u3066\u3044\u308b\u3068\u3001Rails\u306f\u300c\u5fdc\u7b54\u304c\u306a\u3044\u306a\u2026\u300d\u3068\u6570\u79d2\u301c\u6570\u5341\u79d2\u5f85\u3061\u7d9a\u3051\uff08\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u5f85\u3061\uff09\u3001\u305d\u306e\u9593\u30e6\u30fc\u30b6\u30fc\u306e\u753b\u9762\u306f\u6b62\u307e\u3063\u305f\u307e\u307e\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u6700\u7d42\u7684\u306b\u901a\u4fe1\u3092\u8ae6\u3081\u3066\u304b\u3089\u3001\u3088\u3046\u3084\u304f\u753b\u9762\u304c\u9077\u79fb\u3059\u308b\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3082\u3057\u5fc3\u5f53\u305f\u308a\u304c\u3042\u308c\u3070\u3001config\/environments\/production.rb \u3084\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5185\u3067\u3001\u5916\u90e8\u30b5\u30fc\u30d3\u30b9\uff08\u5206\u6790\u30c4\u30fc\u30eb\u3001\u30e1\u30fc\u30eb\u914d\u4fe1\u3001Slack\u901a\u77e5\u306a\u3069\uff09\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3089\u304c**\u300c\u540c\u671f\u51e6\u7406\uff08\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u5f85\u3063\u3066\u304b\u3089\u6b21\u306b\u9032\u3080\u8a2d\u5b9a\uff09\u300d**\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u3001\u5916\u90e8\u30b5\u30fc\u30d0\u30fc\u306e\u5fdc\u7b54\u5f85\u3061\u6642\u9593\u304c\u305d\u306e\u307e\u307e\u753b\u9762\u9077\u79fb\u306e\u9045\u5ef6\uff08\u6570\u79d2\u301c\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u307e\u3067\uff09\u306b\u7e4b\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. \u8a8d\u8a3c\u30fb\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u7cfb<\/h4>\n\n\n\n<p>\u6700\u3082\u53ef\u80fd\u6027\u304c\u9ad8\u3044\u306e\u304c\u3053\u308c\u3089\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>OAuth \/ SNS\u30ed\u30b0\u30a4\u30f3 (Google, LINE, GitHub\u306a\u3069):<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30e6\u30fc\u30b6\u30fc\u304c\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u5f8c\u3001Rails\u5074\u304b\u3089\u5404\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306eAPI\u3092\u53e9\u3044\u3066\u300c\u3053\u306e\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306f\u6b63\u3057\u3044\u304b\uff1f\u300d\u3092\u78ba\u8a8d\u3057\u306b\u884c\u304d\u307e\u3059\u3002\u76f8\u624b\u65b9\u306e\u30b5\u30fc\u30d0\u30fc\u304c\u91cd\u3044\u3001\u307e\u305f\u306f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u7d4c\u8def\u3067\u8a70\u307e\u308b\u3068\u9045\u5ef6\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>ReCAPTCHA (Google):<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30dc\u30c3\u30c8\u5bfe\u7b56\u3067\u5c0e\u5165\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3060\u3051\u3067\u306a\u304f\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\uff08Rails\uff09\u304b\u3089\u3082\u300c\u3053\u306e\u30e6\u30fc\u30b6\u30fc\u306f\u4eba\u9593\u304b\uff1f\u300d\u3068\u3044\u3046\u5224\u5b9a\u30ea\u30af\u30a8\u30b9\u30c8\u3092Google\u306b\u9001\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>IP\u30a2\u30c9\u30ec\u30b9\u306b\u3088\u308b\u4f4d\u7f6e\u60c5\u5831\u7279\u5b9a:<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30ed\u30b0\u30a4\u30f3\u5143\u306e\u56fd\u3084\u5730\u57df\u3092\u7279\u5b9a\u3059\u308b\u305f\u3081\u306b\u3001geocoder \u306a\u3069\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u3066\u5916\u90e8\u306eIP\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9API\u306b\u554f\u3044\u5408\u308f\u305b\u3066\u3044\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. \u901a\u77e5\u30fb\u30ed\u30b0\u9001\u4fe1\u7cfb<\/strong><\/h4>\n\n\n\n<p>\u300c\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u300d\u3068\u3044\u3046\u30a4\u30d9\u30f3\u30c8\u3092\u304d\u3063\u304b\u3051\u306b\u52d5\u304f\u51e6\u7406\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30e1\u30fc\u30eb\u9001\u4fe1 (SendGrid, Amazon SES\u306a\u3069):<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u300c\u65b0\u3057\u3044\u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30ed\u30b0\u30a4\u30f3\u304c\u3042\u308a\u307e\u3057\u305f\u300d\u3068\u3044\u3063\u305f\u901a\u77e5\u30e1\u30fc\u30eb\u3092<strong>\u975e\u540c\u671f\uff08Sidekiq\u3084Active Job\uff09\u306b\u305b\u305a<\/strong>\u3001\u305d\u306e\u5834\u3067\u9001\u308d\u3046\u3068\u3059\u308b\u3068\u3001\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u3068\u306e\u901a\u4fe1\u304c\u7d42\u308f\u308b\u307e\u3067\u753b\u9762\u304c\u5207\u308a\u66ff\u308f\u308a\u307e\u305b\u3093\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30c1\u30e3\u30c3\u30c8\u901a\u77e5 (Slack, Discord, Microsoft Teams):<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u7ba1\u7406\u7528\u30c1\u30e3\u30c3\u30c8\u306b\u300c\u30e6\u30fc\u30b6\u30fcA\u304c\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3057\u305f\u300d\u3068\u901a\u77e5\u3092\u98db\u3070\u3059WebHook\u51e6\u7406\u3067\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30a2\u30af\u30bb\u30b9\u89e3\u6790\u30fbCRM (HubSpot, Salesforce, Mixpanel\u306a\u3069):<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u30c4\u30fc\u30eb\u306b\u300c\u30ed\u30b0\u30a4\u30f3\u65e5\u6642\u300d\u3092\u540c\u671f\u3059\u308b\u51e6\u7406\u304c\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u5834\u5408\u3067\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. \u30a4\u30f3\u30d5\u30e9\u30fb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u95a2\u9023\uff08API\u3067\u306f\u306a\u3044\u304c\u4f3c\u305f\u6319\u52d5\uff09<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30b9\u30c8\u30ec\u30fc\u30b8 (Amazon S3):<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30ed\u30b0\u30a4\u30f3\u76f4\u5f8c\u306b\u30e6\u30fc\u30b6\u30fc\u306e\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306a\u3069\u3092S3\u304b\u3089\u53d6\u5f97\u3057\u3001\u305d\u306e\u300c\u7f72\u540d\u4ed8\u304dURL\u300d\u3092\u767a\u884c\u3059\u308b\u51e6\u7406\u304c\u91cd\u3044\u3001\u3042\u308b\u3044\u306f\u901a\u4fe1\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u3066\u3044\u308b\u30b1\u30fc\u30b9\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>DNS\u89e3\u6c7a\u306e\u9045\u5ef6:<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff08RDS\u306a\u3069\uff09\u3078\u306e\u63a5\u7d9a\u306b\u30db\u30b9\u30c8\u540d\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u3001DNS\u30b5\u30fc\u30d0\u30fc\u306e\u5fdc\u7b54\u304c\u9045\u3044\u3068\u3001\u63a5\u7d9a\u306e\u305f\u3073\u306b\u6570\u79d2\u5f85\u305f\u3055\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5\uff1a\u30b3\u30fc\u30c9\u306e\u3069\u3053\u3092\u898b\u308b\u3079\u304d\u304b\uff1f<\/strong><\/h4>\n\n\n\n<p>Rails\u3067\u5916\u90e8\u901a\u4fe1\u304c\u767a\u751f\u3057\u3066\u3044\u308b\u304b\u8abf\u3079\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u5358\u8a9e\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u3092\u691c\u7d22\uff08Grep\uff09\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>HTTParty \/ Faraday \/ Net::HTTP<\/strong>: \u3053\u308c\u3089\u306fRuby\u3067\u5916\u90e8\u901a\u4fe1\u3092\u884c\u3046\u969b\u306b\u3088\u304f\u4f7f\u308f\u308c\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>deliver_now<\/strong>: \u30e1\u30fc\u30eb\u306e\u9001\u4fe1\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002\u3053\u308c\u304c\u3042\u308b\u3068\u3001\u30e1\u30fc\u30eb\u9001\u4fe1\u304c\u7d42\u308f\u308b\u307e\u3067\u51e6\u7406\u304c\u6b62\u307e\u308a\u307e\u3059\uff08deliver_later \u306a\u3089\u975e\u540c\u671f\u306a\u306e\u3067\u901f\u3044\u3067\u3059\uff09\u3002<\/li>\n\n\n\n<li><strong>Devise \u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af<\/strong>: after_set_user \u3084 after_authentication \u3068\u3044\u3063\u305f\u30e1\u30bd\u30c3\u30c9\u304c config\/initializers\/devise.rb \u3084 User \u30e2\u30c7\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u3078\u306e\u63d0\u6848<\/strong><\/h3>\n\n\n\n<p>\u3082\u3057\u5916\u90e8API\u306e\u95a2\u4e0e\u3092\u7591\u3046\u306a\u3089\u3001**\u300c\u610f\u56f3\u7684\u306b\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3092\u30aa\u30d5\u306b\u3057\u305f\u72b6\u614b\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u30ed\u30b0\u30a4\u30f3\u3092\u8a66\u3059\u300d**\u306e\u304c\u4e00\u756a\u624b\u3063\u53d6\u308a\u65e9\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3082\u3057\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30aa\u30d5\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u308a\u3001\u9006\u306b\u30b5\u30af\u30b5\u30af\u52d5\u3044\u305f\u308a\u3059\u308b\u306a\u3089\u3001\u305d\u3053\u304c\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u3067\u3059\u3002\u4e00\u5ea6\u3001**Gemfile \u306b\u5165\u3063\u3066\u3044\u308b\u901a\u4fe1\u7cfb\u306eGem\uff08octokit, rest-client, sendgrid-ruby \u306a\u3069\uff09**\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u307e\u305b\u3093\u304b\uff1f<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff08MySQL\uff09\u5468\u308a\u3067\u78ba\u8a8d\u3059\u3079\u304d\u30b3\u30fc\u30c9<\/h3>\n\n\n\n<p>\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u3067\u306a\u3044\u3068\u3059\u308c\u3070\u3001\u3084\u306f\u308a\u300c\u30c7\u30fc\u30bf\u91cf\u300d\u3084\u300c\u30af\u30a8\u30ea\u306e\u66f8\u304d\u65b9\u300d\u304c\u602a\u3057\u3044\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u6709\u7121\uff08db\/schema.rb\uff09<\/h4>\n\n\n\n<p>\u30ed\u30b0\u30a4\u30f3\u6642\u306f\u901a\u5e38 email \u306a\u3069\u3067\u30e6\u30fc\u30b6\u30fc\u3092\u691c\u7d22\u3057\u307e\u3059\u3002\u305d\u306e\u30ab\u30e9\u30e0\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u306a\u3044\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u6570\u304c\u5897\u3048\u305f\u6642\u306b\u6fc0\u91cd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>Ruby<\/p>\n\n\n\n<p># db\/schema.rb \u5185\u3067 email \u306b index \u304c\u3042\u308b\u304b\u78ba\u8a8d<\/p>\n\n\n\n<p>t.string<\/p>\n\n\n\n<p>&#8220;email&#8221;, default: &#8220;&#8221;, null: false<\/p>\n\n\n\n<p>t.index [<\/p>\n\n\n\n<p>&#8220;email&#8221;], name: &#8220;index_users_on_email&#8221;, unique: true # \u3053\u308c\u304c\u3042\u308b\u304b\uff01<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. N+1 \u554f\u984c\uff08app\/controllers\/sessions_controller.rb\uff09<\/h4>\n\n\n\n<p>\u30ed\u30b0\u30a4\u30f3\u5f8c\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u5148\u306e\u300c\u30c8\u30c3\u30d7\u753b\u9762\u300d\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u898b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>Ruby<\/p>\n\n\n\n<p># \u30c0\u30e1\u306a\u4f8b\uff1aView\u3067\u6295\u7a3f\u8005\u306e\u540d\u524d\u3092\u8868\u793a\u3059\u308b\u306e\u306b\u3001\u6295\u7a3f\u6570\u5206\u3060\u3051SQL\u304c\u8d70\u308b<\/p>\n\n\n\n<p>@posts<\/p>\n\n\n\n<p>= Post.all<\/p>\n\n\n\n<p># \u826f\u3044\u4f8b\uff1a\u4e00\u62ec\u3067\u53d6\u5f97\u3059\u308b<\/p>\n\n\n\n<p>@posts = Post.includes(:user<\/p>\n\n\n\n<p>).all<\/p>\n\n\n\n<p>\u307e\u305a\u306f**\u300c\u30ed\u30fc\u30ab\u30eb\u306e\u958b\u767a\u74b0\u5883\u3067\u3082\u540c\u3058\u3088\u3046\u306b\u9045\u3044\u304b\u300d**\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u958b\u767a\u74b0\u5883\u3067\u3082\u9045\u3044\u5834\u5408\uff1a<\/strong> \u30b3\u30fc\u30c9\uff08SQL\u3084\u30ed\u30b8\u30c3\u30af\uff09\u306e\u554f\u984c\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u672c\u756a\u74b0\u5883\u3060\u3051\u9045\u3044\u5834\u5408\uff1a<\/strong> \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30b9\u30da\u30c3\u30af\u4e0d\u8db3\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\uff08\u524d\u8ff0\u306e\u5916\u90e8\u901a\u4fe1\u30d6\u30ed\u30c3\u30af\uff09\u3001\u307e\u305f\u306f\u672c\u756a\u7279\u6709\u306e\u30c7\u30fc\u30bf\u91cf\u306e\u591a\u3055\u304c\u539f\u56e0\u3067\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u307e\u305a\u306f\u958b\u767a\u74b0\u5883\u306e\u30ed\u30b0\u306b\u8868\u793a\u3055\u308c\u308b <strong>ActiveRecord: XXms<\/strong> \u306e\u6570\u5024\u304c\u4f55\u79d2\u304f\u3089\u3044\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u3001\u898b\u3066\u307f\u3066\u3082\u3089\u3048\u307e\u3059\u304b\uff1f\u305d\u3053\u304c 100ms \u3092\u8d85\u3048\u3066\u3044\u308b\u3088\u3046\u306a\u3089\u3001SQL\u306e\u6539\u5584\u30dd\u30a4\u30f3\u30c8\u3092\u7d5e\u308a\u8fbc\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3042\u306a\u305f\u306e\u30d7\u30ed\u30f3\u30d7\u30c8<\/p>\n\n\n\n<p>\u3069\u306e\u3088\u3046\u306a\u5916\u90e8API\u3078\u306e\u30a2\u30af\u30bb\u30b9\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u304b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rails\u304c\u9045\u3044\u3068\u8a00\u308f\u308c\u305f\u3068\u304d\u306b\u3084\u308b\u3053\u3068\u5b8c\u5168\u30ac\u30a4\u30c9 \ud83d\udd17 AP&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58,23],"tags":[],"class_list":["post-1811","post","type-post","status-publish","format-standard","hentry","category-58","category-23","article","has-background","has-excerpt","has-avatar","has-author","has-date","has-comment-count","has-category-meta","has-read-more","thumbnail-"],"_links":{"self":[{"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/posts\/1811"}],"collection":[{"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/comments?post=1811"}],"version-history":[{"count":2,"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/posts\/1811\/revisions"}],"predecessor-version":[{"id":1813,"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/posts\/1811\/revisions\/1813"}],"wp:attachment":[{"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/media?parent=1811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/categories?post=1811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ambulo.tv\/blog\/wp-json\/wp\/v2\/tags?post=1811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}