{"id":324476,"date":"2021-06-07T09:00:46","date_gmt":"2021-06-07T09:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=324476"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2021-06-07T09:00:46","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=324476","title":{"rendered":"\u0421 4 \u0447\u0430\u0441\u043e\u0432 \u0434\u043e 1 \u043c\u0438\u043d\u0443\u0442\u044b. \u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0441\u043a\u043e\u0440\u0438\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 Ruby"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437 \u0443 \u043d\u0430\u0441 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441. \u041d\u0438\u043a\u0442\u043e \u0434\u0430\u0432\u043d\u043e \u0435\u0433\u043e \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u043b, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043d\u0438\u043b, \u043a\u0442\u043e \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 &#8212; \u0438 \u043b\u0430\u0434\u043d\u043e. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b CSV \u043e\u0442\u0447\u0435\u0442\u044b \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0432 Sidekiq \u0432\u043e\u0440\u043a\u0435\u0440\u0435 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e). \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0442\u0430\u043b\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0439 \u0442\u043e \u043b\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u0432\u043e\u043f\u0441\u044b \u043f\u0435\u0440\u0435\u0435\u0445\u0430\u043b\u0438 \u043d\u0430 Kubernetes, \u0442\u043e \u043b\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0442\u0430\u043a\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0442\u0447\u0435\u0442\u043e\u0432. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u00ab\u043f\u0440\u043e\u0436\u0435\u0432\u0430\u0442\u044c\u00bb 38_000 \u0437\u0430\u044f\u0432\u043e\u043a, \u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0430\u043b \u0432 &#8216;in_progress&#8217;. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u043f\u0443\u0441\u0442\u044f \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0431\u0438\u0432\u0430\u043b\u0441\u044f \u043a\u0443\u0431\u0435\u0440\u043e\u043c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044e\u0437\u0435\u0440\u044b \u0441\u0430\u043c\u0438, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u043e\u0442\u043c\u0435\u043d\u044f\u043b\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u043f\u043e \u043d\u043e\u0432\u043e\u0439.<\/p>\n<p>\u0421\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0434\u043e \u0441\u043c\u0435\u0448\u043d\u043e\u0433\u043e \u043c\u0435\u043b\u043a\u043e\u0439. \u041d\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u044f \u043d\u0430\u0448\u0435\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435. <\/p>\n<p><a class=\"anchor\" name=\"metric\" id=\"metric\"><\/a><\/p>\n<h2>\u041c\u0435\u0442\u0440\u0438\u043a\u0430<\/h2>\n<p>\u041f\u043e\u043d\u044f\u0432, \u0447\u0442\u043e \u043d\u0430 \u043c\u0430\u043b\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0447\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u044f \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u043c\u0435\u0440\u0438\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 Ruby \u043c\u043e\u0434\u0443\u043b\u044c Benchmark.  \u041f\u043e\u043b\u043e\u0436\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b\u0438\u043a \u0432 \u043f\u0430\u043f\u043a\u0443 &#8216;profilers&#8217;:<\/p>\n<p><strong>performance_evaluation.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'benchmark'  class PerformanceEvaluation   def self.call(applications_ids, export_id)     puts \"Start\"      time = Benchmark.realtime do       ApplicationsManagement::Export.new(applications_ids, export_id).call     end      puts \"Finish in #{time.round(2)}\"   end end <\/code><\/pre>\n<p>\u0418 \u0437\u0430\u0442\u0435\u043c \u0434\u0435\u0440\u043d\u0435\u043c \u0435\u0433\u043e \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">require '.\/profilers\/performance_evaluation'  applications_ids = Application.where(id: (1..100)).pluck(:id) export_id = FactoryBot.create(:export).id PerformanceEvaluation.call(applications_ids, export_id) ... Finish in 40.13 =&gt; nil<\/code><\/pre>\n<p>\u0421\u043e\u0442\u043d\u044e \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0431\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b \u043e\u043a\u043e\u043b\u043e 40 \u0441\u0435\u043a\u0443\u043d\u0434. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0430 \u043d\u0430\u0448\u0438 38_000 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0435\u043c\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0431\u043e\u043b\u044c\u0448\u0435 4 \u0447\u0430\u0441\u043e\u0432! \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0446\u0438\u0444\u0440\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u043c\u0438. <\/p>\n<h2>\u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0443\u0434\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0433\u0435\u043c <a href=\"https:\/\/ruby-prof.github.io\/#installation\" rel=\"noopener noreferrer nofollow\">ruby-prof<\/a>. \u041e\u043d \u0443\u043c\u0435\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u00ab\u0443\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430\u00bb, \u043d\u043e \u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0444\u043e\u0440\u043c\u0430\u0442 &#8216;callgrind&#8217;, \u0438 \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <a href=\"https:\/\/brewinstall.org\/install-qcachegrind-on-mac-with-brew\" rel=\"noopener noreferrer nofollow\">qcachegrind<\/a>. \u041f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0432 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043f\u043a\u0443 &#8216;profilers&#8217;:<\/p>\n<p><strong>time_profiler.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'ruby-prof'  class TimeProfiler   def run(applications_ids, export_id)     RubyProf.measure_mode = RubyProf::WALL_TIME      result = RubyProf.profile do       ApplicationsManagement::Export.new(applications_ids, export_id).call     end      printer = RubyProf::CallTreePrinter.new(result)     printer.print(path: 'profilers\/ruby_prof_reports', profile: 'callgrind')   end end <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0432\u044b\u0448\u0435, \u043e\u0442\u0447\u0435\u0442\u044b \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 &#8216;profilers\/ruby_prof_reports\/&#8217;. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">require_relative 'profilers\/time_profiler' applications_ids = Application.pluck(:id).last(100) export_id = FactoryBot.create(:export).id TimeProfiler.new.run(applications_ids, export_id)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u043e\u0442\u0447\u0435\u0442\u0430\u043c\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b <strong>callgrind.callgrind.out.10176<\/strong>. \u0415\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u043c\u044f \u043f\u043e\u043a\u043e\u0440\u043e\u0447\u0435. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b qcachegrind:<\/p>\n<pre><code class=\"bash\">qcachegrind profilers\/ruby_prof_reports\/callgrind.callgrind.out.10176<\/code><\/pre>\n<p>\u0418 \u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0435 \u043e\u043a\u043d\u043e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa9\/82f\/cfb\/aa982fcfb9d4abecfbf9b3457916d1e6.png\" width=\"2038\" height=\"1320\"><figcaption><\/figcaption><\/figure>\n<p>(\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u0438\u0434 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c Settings -&gt; Sidebars -&gt; Flat Profile). \u0417\u0434\u0435\u0441\u044c \u042f \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0435 self &#8212; \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0441\u0432\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. (\u041a\u043e\u043b\u043e\u043d\u043a\u0430 Incl. \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 &#8212; \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u043d \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0435\u0431\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432). \u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u043a\u043d\u0435\u043c \u043f\u043e \u0438\u043a\u043e\u043d\u043a\u0435 % \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u043c\u0435\u043d\u044e, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e IO::wait_readable \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 90% \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/add\/b6d\/fc1\/addb6dfc13577a100ad99a69e5bcc8b0.png\" width=\"1416\" height=\"452\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043e\u043a\u0438 Ruby \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u044b \u043e \u043c\u043e\u0434\u0443\u043b\u0435 <a href=\"https:\/\/ruby-doc.org\/core-2.7.0\/IO\/WaitReadable.html\" rel=\"noopener noreferrer nofollow\">IO::WaitReadable<\/a>: <br \/>&#8216;exception to wait for reading. see IO.select.&#8217; <br \/>\u041d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c, \u0447\u0442\u043e \u0442\u0443\u0442 \u0435\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c &#8212; \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 input\/output. \u0412\u043e\u043f\u0440\u043e\u0441 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442?<\/p>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0433\u0438\u043f\u043e\u0442\u0435\u0437<\/h2>\n<p>\u041f\u0435\u0440\u0432\u043e\u0439 \u043c\u043e\u0435\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u043e\u0439 \u0431\u044b\u043b\u043e &#8212; \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 CSV \u0444\u0430\u0439\u043b. \u042f \u0440\u0435\u0448\u0438\u043b \u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0438 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0435 \u0432\u0435\u0441\u044c \u0441\u0435\u0440\u0432\u0438\u0441, \u0430 \u043b\u0438\u0448\u044c \u044d\u0442\u043e\u0442 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434. \u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p><strong>time_profiler.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'ruby-prof'  class TimeProfiler   attr_reader :applications_ids, :file_path, :errors    def initialize(applications_ids)     @applications_ids = applications_ids     @file_path = Tempfile.new(['', '.csv']).to_path     @errors = []   end    def run     RubyProf.measure_mode = RubyProf::WALL_TIME     result = RubyProf.profile do       to_csv_export     end      printer = RubyProf::CallTreePrinter.new(result)     printer.print(path: 'profilers\/ruby_prof_reports', profile: 'callgrind')   end    private    def to_csv_export     CSV.open(file_path, 'w') do |csv|       csv &lt;&lt; export_headers # \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043e\u0442\u0447\u0435\u0442\u0430 \u043f\u043e\u0447\u0442\u0438 \u043d\u0430 90 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432        # ActiveRecord::Relation \u0441 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438       export_collection.find_each do |instance|         begin           # \u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0437\u0434\u0435\u0441\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f           # export_row(instance.decorate) -           # \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043e\u0442\u0447\u0435\u0442\u0430.           # \u0417\u0430\u043c\u0435\u043d\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438,           # \u0447\u0442\u043e\u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c,           # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043d\u0430\u0448 IO::WaitReadable \u0441\u0430\u043c\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 CSV           # \u0438\u043b\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0442\u0435\u0445 \u0441\u0430\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043e\u0442\u0447\u0435\u0442\u0430            csv &lt;&lt; instance.attributes.values         rescue StandardError =&gt; e           errors &lt;&lt; \"#{instance.id}: #{e}\"         end       end     end   end    def export_headers # rubocop:disable Metrics\/MethodLength     [       'ID',       'Status',       ... # \u0415\u0449\u0435 \u043f\u043e\u0447\u0442\u0438 90 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432     ]   end    def export_collection     Application.where(id: applications_ids).includes(       ... # \u0443\u0432\u0435\u0441\u0438\u0441\u0442\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438     ).order(created_at: :desc)   end end<\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 callgrind \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/489\/2f1\/1e2\/4892f11e2085102ee156ee016392402e.png\" width=\"1112\" height=\"536\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f, \u0438 \u00ab\u043f\u0440\u043e\u0449\u0443\u043f\u0430\u0442\u044c\u00bb \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 export_row.<\/p>\n<p><strong>time_profiler.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'ruby-prof'  class TimeProfiler   def run     RubyProf.measure_mode = RubyProf::WALL_TIME     app = Application.last     result = RubyProf.profile do       export_row(app.decorate)     end     printer = RubyProf::CallTreePrinter.new(result)     printer.print(path: 'profilers\/ruby_prof_reports', profile: 'callgrind')   end    private    # Data for writing for each application   def export_row(application) # rubocop:disable Metrics\/MethodLength, Metrics\/AbcSize, Metrics\/PerceivedComplexity, Metrics\/CyclomaticComplexity, Metrics\/LineLength     [       application.id,       application.status,       ... # \u0415\u0449\u0435 \u043e\u043a\u043e\u043b\u043e 90 \u0441\u0442\u0440\u043e\u043a      ]   end end<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c. \u0418 \u043e\u043f\u044f\u0442\u044c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0433\u0438\u0433\u0430\u043d\u0442\u0441\u043a\u0438\u0435 80% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c59\/b33\/d9a\/c59b33d9ad09967dc0cee78ae269403b.png\" width=\"1230\" height=\"376\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u00ab\u0434\u043e\u043b\u0433\u0438\u0439\u00bb \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043b\u0438 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 &#8212; \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445. \u0414\u0435\u043b\u0438\u043c \u0438\u0445 \u043f\u043e\u043f\u043e\u043b\u0430\u043c \u043e\u043f\u044f\u0442\u044c \u0438 \u0442.\u0434\u2026 \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u044f \u043d\u0430\u0448\u0435\u043b \u0441\u0442\u0440\u043e\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0430 \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<pre><code class=\"ruby\">... application.photo_urls.present? ? 'Yes' : 'No', ...<\/code><\/pre>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u044c Application, \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0437\u0430 \u043c\u0435\u0442\u043e\u0434 \u0442\u0430\u043a\u043e\u0439?<\/p>\n<p><strong>models\/application.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  class Application   ...   def photo_urls     return if Rails.env.test?      s3 = Aws::S3::Resource.new     bucket = s3.bucket('bucket-name')     return [] if guid.nil?      bucket.objects(prefix: \"documents\/#{guid}\")           .reject { |x| x.key.include?('\/preview\/') }           .map { |o| o.presigned_url(:get) }   end end<\/code><\/pre>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043e\u0442\u0447\u0435\u0442\u0435 &#8216;yes&#8217; \u0438\u043b\u0438 &#8216;no&#8217; \u043c\u044b \u043b\u0435\u0437\u043b\u0438 \u0432 AWS, \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043e\u0447\u043a\u0435 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435 \u0433\u043b\u0430\u0441\u0438\u043b KYC. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b \u043e\u0436\u0438\u0434\u0430\u043b\u0438 \u0432\u0438\u0434\u0435\u0442\u044c, \u043f\u0440\u043e\u0448\u0435\u043b \u043b\u0438 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 KYC (know-your-customer, \u043a\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Fintech, \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0437\u043d\u0430\u0435\u0442) \u0438\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435\u0442. \u042f \u043d\u0430\u0447\u0430\u043b \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441, \u043c\u043e\u0436\u0435\u0442, \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433 \u0432 \u0431\u0434 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439. \u0412\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0438\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u043e\u0442 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<p>\u042f \u0432\u044b\u043f\u0438\u043b\u0438\u043b \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 <a href=\"#metric\" rel=\"noopener noreferrer nofollow\">\u043c\u0435\u0442\u0440\u0438\u043a\u0435<\/a>. PerformanceEvaluation \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u043e\u0439 \u0436\u0435 \u0441\u043e\u0442\u043d\u0438 \u0437\u0430\u044f\u0432\u043e\u043a. \u041d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0431\u044b\u043b\u0430 \u0435\u0449\u0435 \u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0439. \u041e\u0442\u0447\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430 4+ \u0447\u0430\u0441\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u0434\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430 \u043e\u0434\u043d\u0443 \u043c\u0438\u043d\u0443\u0442\u0443. \u0412\u0438\u043d\u043e\u0439 \u0432\u0441\u0435\u043c\u0443 \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435 \u0431\u044b\u043b\u0430 \u043d\u0443\u0436\u043d\u0430.<\/p>\n<h2>P.S.\/Bonus<\/h2>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0430\u0439\u0442\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0439. \u0411\u0435\u0437 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a. \u041e\u043f\u044b\u0442\u043d\u044b\u0435 \u0444\u0430\u043d\u0430\u0442\u044b Qcachegrind \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u044f \u043d\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u043b\u0441\u044f \u0432 \u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0441\u043f\u0435\u0446 \u043f\u043e \u043d\u0435\u043c\u0443. \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0441 \u0431\u041e\u043b\u044c\u0448\u0438\u043c \u041a\u041f\u0414. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443, \u0430 \u0432 \u043f\u0440\u0430\u0432\u043e\u0439 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u043a\u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u00abCall Graph\u00bb, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 &#8212; \u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043a\u0430\u043a\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1ee\/798\/481\/1ee79848154196a5b6f53789001c8978.png\" width=\"1700\" height=\"896\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0432\u0430\u0436\u0434\u044b \u043a\u043b\u0438\u043a\u0430\u0435\u043c \u043f\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e, \u0438 \u0434\u0435\u0440\u0435\u0432\u043e \u00ab\u0440\u0430\u0441\u0442\u0435\u0442\u00bb \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cb8\/f94\/c71\/cb8f94c71bfa39beedbb9b7e0b0b708b.png\" width=\"1730\" height=\"1338\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043c\u043e\u0434\u0443\u043b\u044c Net\/HTTPResponse \u043c\u043e\u0433 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u0433\u0430\u0434\u043a\u0443 \u043f\u043e\u0434\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0439, \u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u0440\u0430\u043d\u044c\u0448\u0435. \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0440\u043a\u0444\u043b\u043e\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u0435\u0442 Qcachegrind (\u0434\u0430 \u0438 ruby-prof) \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0445, \u043a\u0430\u043a \u0432\u044b \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0438 \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0438\u0447\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u0442\u044c? <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/561258\/\"> https:\/\/habr.com\/ru\/post\/561258\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437 \u0443 \u043d\u0430\u0441 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441. \u041d\u0438\u043a\u0442\u043e \u0434\u0430\u0432\u043d\u043e \u0435\u0433\u043e \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u043b, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043d\u0438\u043b, \u043a\u0442\u043e \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 &#8212; \u0438 \u043b\u0430\u0434\u043d\u043e. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b CSV \u043e\u0442\u0447\u0435\u0442\u044b \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0432 Sidekiq \u0432\u043e\u0440\u043a\u0435\u0440\u0435 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e). \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0442\u0430\u043b\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0439 \u0442\u043e \u043b\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u0432\u043e\u043f\u0441\u044b \u043f\u0435\u0440\u0435\u0435\u0445\u0430\u043b\u0438 \u043d\u0430 Kubernetes, \u0442\u043e \u043b\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0442\u0430\u043a\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0442\u0447\u0435\u0442\u043e\u0432. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u00ab\u043f\u0440\u043e\u0436\u0435\u0432\u0430\u0442\u044c\u00bb 38_000 \u0437\u0430\u044f\u0432\u043e\u043a, \u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0430\u043b \u0432 &#8216;in_progress&#8217;. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u043f\u0443\u0441\u0442\u044f \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0431\u0438\u0432\u0430\u043b\u0441\u044f \u043a\u0443\u0431\u0435\u0440\u043e\u043c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044e\u0437\u0435\u0440\u044b \u0441\u0430\u043c\u0438, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u043e\u0442\u043c\u0435\u043d\u044f\u043b\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u043f\u043e \u043d\u043e\u0432\u043e\u0439.<\/p>\n<p>\u0421\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0434\u043e \u0441\u043c\u0435\u0448\u043d\u043e\u0433\u043e \u043c\u0435\u043b\u043a\u043e\u0439. \u041d\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u044f \u043d\u0430\u0448\u0435\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435. <\/p>\n<p><a class=\"anchor\" name=\"metric\" id=\"metric\"><\/a><\/p>\n<h2>\u041c\u0435\u0442\u0440\u0438\u043a\u0430<\/h2>\n<p>\u041f\u043e\u043d\u044f\u0432, \u0447\u0442\u043e \u043d\u0430 \u043c\u0430\u043b\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0447\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u044f \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u043c\u0435\u0440\u0438\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 Ruby \u043c\u043e\u0434\u0443\u043b\u044c Benchmark.  \u041f\u043e\u043b\u043e\u0436\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b\u0438\u043a \u0432 \u043f\u0430\u043f\u043a\u0443 &#8216;profilers&#8217;:<\/p>\n<p><strong>performance_evaluation.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'benchmark'  class PerformanceEvaluation   def self.call(applications_ids, export_id)     puts \"Start\"      time = Benchmark.realtime do       ApplicationsManagement::Export.new(applications_ids, export_id).call     end      puts \"Finish in #{time.round(2)}\"   end end <\/code><\/pre>\n<p>\u0418 \u0437\u0430\u0442\u0435\u043c \u0434\u0435\u0440\u043d\u0435\u043c \u0435\u0433\u043e \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">require '.\/profilers\/performance_evaluation'  applications_ids = Application.where(id: (1..100)).pluck(:id) export_id = FactoryBot.create(:export).id PerformanceEvaluation.call(applications_ids, export_id) ... Finish in 40.13 =&gt; nil<\/code><\/pre>\n<p>\u0421\u043e\u0442\u043d\u044e \u0437\u0430\u044f\u0432\u043e\u043a \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0431\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b \u043e\u043a\u043e\u043b\u043e 40 \u0441\u0435\u043a\u0443\u043d\u0434. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0430 \u043d\u0430\u0448\u0438 38_000 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0435\u043c\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0431\u043e\u043b\u044c\u0448\u0435 4 \u0447\u0430\u0441\u043e\u0432! \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0446\u0438\u0444\u0440\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u043c\u0438. <\/p>\n<h2>\u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0443\u0434\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0433\u0435\u043c <a href=\"https:\/\/ruby-prof.github.io\/#installation\" rel=\"noopener noreferrer nofollow\">ruby-prof<\/a>. \u041e\u043d \u0443\u043c\u0435\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u00ab\u0443\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430\u00bb, \u043d\u043e \u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0444\u043e\u0440\u043c\u0430\u0442 &#8216;callgrind&#8217;, \u0438 \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <a href=\"https:\/\/brewinstall.org\/install-qcachegrind-on-mac-with-brew\" rel=\"noopener noreferrer nofollow\">qcachegrind<\/a>. \u041f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0432 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043f\u043a\u0443 &#8216;profilers&#8217;:<\/p>\n<p><strong>time_profiler.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'ruby-prof'  class TimeProfiler   def run(applications_ids, export_id)     RubyProf.measure_mode = RubyProf::WALL_TIME      result = RubyProf.profile do       ApplicationsManagement::Export.new(applications_ids, export_id).call     end      printer = RubyProf::CallTreePrinter.new(result)     printer.print(path: 'profilers\/ruby_prof_reports', profile: 'callgrind')   end end <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0432\u044b\u0448\u0435, \u043e\u0442\u0447\u0435\u0442\u044b \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 &#8216;profilers\/ruby_prof_reports\/&#8217;. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">require_relative 'profilers\/time_profiler' applications_ids = Application.pluck(:id).last(100) export_id = FactoryBot.create(:export).id TimeProfiler.new.run(applications_ids, export_id)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u043e\u0442\u0447\u0435\u0442\u0430\u043c\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b <strong>callgrind.callgrind.out.10176<\/strong>. \u0415\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u043c\u044f \u043f\u043e\u043a\u043e\u0440\u043e\u0447\u0435. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b qcachegrind:<\/p>\n<pre><code class=\"bash\">qcachegrind profilers\/ruby_prof_reports\/callgrind.callgrind.out.10176<\/code><\/pre>\n<p>\u0418 \u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0435 \u043e\u043a\u043d\u043e:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>(\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u0438\u0434 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c Settings -&gt; Sidebars -&gt; Flat Profile). \u0417\u0434\u0435\u0441\u044c \u042f \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0435 self &#8212; \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0441\u0432\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. (\u041a\u043e\u043b\u043e\u043d\u043a\u0430 Incl. \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 &#8212; \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u043d \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0435\u0431\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432). \u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u043a\u043d\u0435\u043c \u043f\u043e \u0438\u043a\u043e\u043d\u043a\u0435 % \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u043c\u0435\u043d\u044e, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e IO::wait_readable \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 90% \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043e\u043a\u0438 Ruby \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u044b \u043e \u043c\u043e\u0434\u0443\u043b\u0435 <a href=\"https:\/\/ruby-doc.org\/core-2.7.0\/IO\/WaitReadable.html\" rel=\"noopener noreferrer nofollow\">IO::WaitReadable<\/a>: <br \/>&#8216;exception to wait for reading. see IO.select.&#8217; <br \/>\u041d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c, \u0447\u0442\u043e \u0442\u0443\u0442 \u0435\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c &#8212; \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 input\/output. \u0412\u043e\u043f\u0440\u043e\u0441 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442?<\/p>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0433\u0438\u043f\u043e\u0442\u0435\u0437<\/h2>\n<p>\u041f\u0435\u0440\u0432\u043e\u0439 \u043c\u043e\u0435\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u043e\u0439 \u0431\u044b\u043b\u043e &#8212; \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 CSV \u0444\u0430\u0439\u043b. \u042f \u0440\u0435\u0448\u0438\u043b \u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0438 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0435 \u0432\u0435\u0441\u044c \u0441\u0435\u0440\u0432\u0438\u0441, \u0430 \u043b\u0438\u0448\u044c \u044d\u0442\u043e\u0442 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434. \u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p><strong>time_profiler.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'ruby-prof'  class TimeProfiler   attr_reader :applications_ids, :file_path, :errors    def initialize(applications_ids)     @applications_ids = applications_ids     @file_path = Tempfile.new(['', '.csv']).to_path     @errors = []   end    def run     RubyProf.measure_mode = RubyProf::WALL_TIME     result = RubyProf.profile do       to_csv_export     end      printer = RubyProf::CallTreePrinter.new(result)     printer.print(path: 'profilers\/ruby_prof_reports', profile: 'callgrind')   end    private    def to_csv_export     CSV.open(file_path, 'w') do |csv|       csv &lt;&lt; export_headers # \u043c\u0430\u0441\u0441\u0438\u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043e\u0442\u0447\u0435\u0442\u0430 \u043f\u043e\u0447\u0442\u0438 \u043d\u0430 90 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432        # ActiveRecord::Relation \u0441 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0437\u0430\u044f\u0432\u043a\u0430\u043c\u0438       export_collection.find_each do |instance|         begin           # \u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0437\u0434\u0435\u0441\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f           # export_row(instance.decorate) -           # \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043e\u0442\u0447\u0435\u0442\u0430.           # \u0417\u0430\u043c\u0435\u043d\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438,           # \u0447\u0442\u043e\u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c,           # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043d\u0430\u0448 IO::WaitReadable \u0441\u0430\u043c\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 CSV           # \u0438\u043b\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0442\u0435\u0445 \u0441\u0430\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043e\u0442\u0447\u0435\u0442\u0430            csv &lt;&lt; instance.attributes.values         rescue StandardError =&gt; e           errors &lt;&lt; \"#{instance.id}: #{e}\"         end       end     end   end    def export_headers # rubocop:disable Metrics\/MethodLength     [       'ID',       'Status',       ... # \u0415\u0449\u0435 \u043f\u043e\u0447\u0442\u0438 90 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432     ]   end    def export_collection     Application.where(id: applications_ids).includes(       ... # \u0443\u0432\u0435\u0441\u0438\u0441\u0442\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438     ).order(created_at: :desc)   end end<\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 callgrind \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u0438\u0442\u044c\u0441\u044f, \u0438 \u00ab\u043f\u0440\u043e\u0449\u0443\u043f\u0430\u0442\u044c\u00bb \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 export_row.<\/p>\n<p><strong>time_profiler.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  require 'ruby-prof'  class TimeProfiler   def run     RubyProf.measure_mode = RubyProf::WALL_TIME     app = Application.last     result = RubyProf.profile do       export_row(app.decorate)     end     printer = RubyProf::CallTreePrinter.new(result)     printer.print(path: 'profilers\/ruby_prof_reports', profile: 'callgrind')   end    private    # Data for writing for each application   def export_row(application) # rubocop:disable Metrics\/MethodLength, Metrics\/AbcSize, Metrics\/PerceivedComplexity, Metrics\/CyclomaticComplexity, Metrics\/LineLength     [       application.id,       application.status,       ... # \u0415\u0449\u0435 \u043e\u043a\u043e\u043b\u043e 90 \u0441\u0442\u0440\u043e\u043a      ]   end end<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u0438 \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c. \u0418 \u043e\u043f\u044f\u0442\u044c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0433\u0438\u0433\u0430\u043d\u0442\u0441\u043a\u0438\u0435 80% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u00ab\u0434\u043e\u043b\u0433\u0438\u0439\u00bb \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043b\u0438 \u043d\u0435\u0442. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 &#8212; \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445. \u0414\u0435\u043b\u0438\u043c \u0438\u0445 \u043f\u043e\u043f\u043e\u043b\u0430\u043c \u043e\u043f\u044f\u0442\u044c \u0438 \u0442.\u0434\u2026 \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u044f \u043d\u0430\u0448\u0435\u043b \u0441\u0442\u0440\u043e\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0430 \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<pre><code class=\"ruby\">... application.photo_urls.present? ? 'Yes' : 'No', ...<\/code><\/pre>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u044c Application, \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0437\u0430 \u043c\u0435\u0442\u043e\u0434 \u0442\u0430\u043a\u043e\u0439?<\/p>\n<p><strong>models\/application.rb<\/strong><\/p>\n<pre><code class=\"ruby\"># frozen_string_literal: true  class Application   ...   def photo_urls     return if Rails.env.test?      s3 = Aws::S3::Resource.new     bucket = s3.bucket('bucket-name')     return [] if guid.nil?      bucket.objects(prefix: \"documents\/#{guid}\")           .reject { |x| x.key.include?('\/preview\/') }           .map { |o| o.presigned_url(:get) }   end end<\/code><\/pre>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043e\u0442\u0447\u0435\u0442\u0435 &#8216;yes&#8217; \u0438\u043b\u0438 &#8216;no&#8217; \u043c\u044b \u043b\u0435\u0437\u043b\u0438 \u0432 AWS, \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043e\u0447\u043a\u0435 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435 \u0433\u043b\u0430\u0441\u0438\u043b KYC. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b \u043e\u0436\u0438\u0434\u0430\u043b\u0438 \u0432\u0438\u0434\u0435\u0442\u044c, \u043f\u0440\u043e\u0448\u0435\u043b \u043b\u0438 \u0437\u0430\u044f\u0432\u0438\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 KYC (know-your-customer, \u043a\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Fintech, \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0437\u043d\u0430\u0435\u0442) \u0438\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435\u0442. \u042f \u043d\u0430\u0447\u0430\u043b \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441, \u043c\u043e\u0436\u0435\u0442, \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433 \u0432 \u0431\u0434 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439. \u0412\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0438\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u043e\u0442 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0432 \u043e\u0442\u0447\u0435\u0442\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<p>\u042f \u0432\u044b\u043f\u0438\u043b\u0438\u043b \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 <a href=\"#metric\" rel=\"noopener noreferrer nofollow\">\u043c\u0435\u0442\u0440\u0438\u043a\u0435<\/a>. PerformanceEvaluation \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u043e\u0439 \u0436\u0435 \u0441\u043e\u0442\u043d\u0438 \u0437\u0430\u044f\u0432\u043e\u043a. \u041d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0431\u044b\u043b\u0430 \u0435\u0449\u0435 \u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0439. \u041e\u0442\u0447\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430 4+ \u0447\u0430\u0441\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u0434\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u0430 \u043e\u0434\u043d\u0443 \u043c\u0438\u043d\u0443\u0442\u0443. \u0412\u0438\u043d\u043e\u0439 \u0432\u0441\u0435\u043c\u0443 \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435 \u0431\u044b\u043b\u0430 \u043d\u0443\u0436\u043d\u0430.<\/p>\n<h2>P.S.\/Bonus<\/h2>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0430\u0439\u0442\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0439. \u0411\u0435\u0437 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0449\u0438\u043a. \u041e\u043f\u044b\u0442\u043d\u044b\u0435 \u0444\u0430\u043d\u0430\u0442\u044b Qcachegrind \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u044f \u043d\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u043b\u0441\u044f \u0432 \u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0441\u043f\u0435\u0446 \u043f\u043e \u043d\u0435\u043c\u0443. \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0441 \u0431\u041e\u043b\u044c\u0448\u0438\u043c \u041a\u041f\u0414. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443, \u0430 \u0432 \u043f\u0440\u0430\u0432\u043e\u0439 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u043a\u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u00abCall Graph\u00bb, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 &#8212; \u043a\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043a\u0430\u043a\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0431\u044b\u043b \u0432\u044b\u0437\u0432\u0430\u043d. <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0432\u0430\u0436\u0434\u044b \u043a\u043b\u0438\u043a\u0430\u0435\u043c \u043f\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e, \u0438 \u0434\u0435\u0440\u0435\u0432\u043e \u00ab\u0440\u0430\u0441\u0442\u0435\u0442\u00bb \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043c\u043e\u0434\u0443\u043b\u044c Net\/HTTPResponse \u043c\u043e\u0433 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u0433\u0430\u0434\u043a\u0443 \u043f\u043e\u0434\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0439, \u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u0431\u044b \u0440\u0430\u043d\u044c\u0448\u0435. \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0440\u043a\u0444\u043b\u043e\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u0435\u0442 Qcachegrind (\u0434\u0430 \u0438 ruby-prof) \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0445, \u043a\u0430\u043a \u0432\u044b \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0438 \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0438\u0447\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u0442\u044c? <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/561258\/\"> https:\/\/habr.com\/ru\/post\/561258\/<\/a><br \/><\/br><\/br><\/p>\n<\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-324476","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=324476"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324476\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}