{"id":3804,"date":"2022-02-17T10:11:03","date_gmt":"2022-02-17T10:11:03","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/ways-to-increase-your-rails-performance\/"},"modified":"2024-07-04T21:01:27","modified_gmt":"2024-07-04T21:01:27","slug":"sposoby-na-zwiekszenie-wydajnosci-szyn","status":"publish","type":"post","link":"https:\/\/thecodest.co\/pl\/blog\/ways-to-increase-your-rails-performance\/","title":{"rendered":"Jak zwi\u0119kszy\u0107 wydajno\u015b\u0107 Rails\u00f3w"},"content":{"rendered":"<h2 class=\"wp-block-heading\"><strong>Ruby First<\/strong><\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/thecodest.co\/pl\/case-studies\/providing-a-team-of-ruby-developers-for-a-fintech-company\/\">Ruby<\/a><\/strong> jest j\u0119zykiem silnie zorientowanym obiektowo. W rzeczywisto\u015bci (prawie) wszystko w <strong>Ruby<\/strong> jest obiektem. Tworzenie niepotrzebnych obiekt\u00f3w mo\u017ce kosztowa\u0107 program wiele dodatkowej pami\u0119ci, wi\u0119c nale\u017cy tego unika\u0107.<\/p>\n\n\n\n<p>Aby zmierzy\u0107 r\u00f3\u017cnic\u0119, u\u017cyjemy <em><a href=\"https:\/\/github.com\/SamSaffron\/memory_profiler\">memory_profiler<\/a><\/em> oraz wbudowany modu\u0142 Benchmark do pomiaru wydajno\u015bci czasowej.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>U\u017cywanie metod bang! na \u0142a\u0144cuchach<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">require \"memory_profiler\"\n\nreport = MemoryProfiler.report do\n<a href=\"https:\/\/thecodest.co\/pl\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">dane<\/a> = \"X\" * 1024 * 1024 * 100\ndata = data.downcase\nkoniec\n\nreport.pretty_print<\/code><\/pre>\n\n\n\n<p>W poni\u017cszym zestawieniu utworzyli\u015bmy ci\u0105g znak\u00f3w o rozmiarze 100 MB i zmniejszyli\u015bmy ka\u017cdy zawarty w nim znak. Nasz test por\u00f3wnawczy daje <a href=\"https:\/\/thecodest.co\/pl\/blog\/why-us-companies-are-opting-for-polish-developers\/\">my<\/a> nast\u0119puj\u0105cy raport:<\/p>\n\n\n\n<p><em>Ca\u0142kowita alokacja: 210765044 bajt\u00f3w (6 obiekt\u00f3w)<\/em><\/p>\n\n\n\n<p>Je\u015bli jednak zast\u0105pimy lini\u0119 6 przez:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code>data.downcase!<\/code><\/code><\/pre>\n\n\n\n<p><code> <\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Odczytywanie plik\u00f3w wiersz po wierszu<\/strong><\/h2>\n\n\n\n<p>Przypuszczalnie musimy pobra\u0107 ogromn\u0105 kolekcj\u0119 danych zawieraj\u0105c\u0105 2 miliony rekord\u00f3w z pliku csv. Zazwyczaj wygl\u0105da to nast\u0119puj\u0105co:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">require 'benchmark'\n\nBenchmark.bm do |x|\nx.report do\nFile.readlines(\"2mrecords.csv\").map! {|line|line.split(\",\")}\nend\nend<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">u\u017cytkownik system ca\u0142kowity rzeczywisty\n\n12.797000 2.437000 15.234000 (106.319865)<\/code><\/pre>\n\n\n\n<p>Pe\u0142ne pobranie pliku zaj\u0119\u0142o nam ponad 106 sekund. Ca\u0142kiem sporo! Mo\u017cemy jednak przyspieszy\u0107 ten proces, zast\u0119puj\u0105c plik <em>mapa!<\/em> z prost\u0105 metod\u0105 <em>podczas gdy<\/em> p\u0119tla:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">require 'benchmark'\n\nBenchmark.bm do |x|\nx.report do\nfile = file.open(\"2mrecords.csv\", \"r\")\nwhile line = file.gets\nline.split(\",\")\nend\nend\nend<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">u\u017cytkownik system ca\u0142kowity rzeczywisty\n\n6.078000 0.250000 6.328000 ( 6.649422)<\/code><\/pre>\n\n\n\n<p>Czas dzia\u0142ania drastycznie si\u0119 skr\u00f3ci\u0142 od czasu premiery <em>mapa!<\/em> metoda nale\u017cy do okre\u015blonej klasy, np. <em>Hash#map<\/em> lub <em>Array#map<\/em>gdzie <strong>Ruby<\/strong> b\u0119dzie przechowywa\u0107 ka\u017cd\u0105 lini\u0119 przeanalizowanego pliku w pami\u0119ci tak d\u0142ugo, jak b\u0119dzie wykonywana. <strong>Od\u015bmiecacz Rubiego <\/strong>nie zwolni pami\u0119ci przed pe\u0142nym wykonaniem tych iterator\u00f3w. Jednak odczytanie go wiersz po wierszu spowoduje, \u017ce GC przeniesie pami\u0119\u0107 z poprzednich wierszy, gdy nie b\u0119dzie to konieczne.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Unikanie iterator\u00f3w metod na wi\u0119kszych kolekcjach<\/strong><\/h2>\n\n\n\n<p>Jest to rozszerzenie poprzedniego punktu o bardziej powszechny przyk\u0142ad. Jak ju\u017c wspomnia\u0142em, <a href=\"https:\/\/thecodest.co\/blog\/high-demand-for-ruby-developers\/\">Ruby<\/a> iteratory s\u0105 metodami obiektowymi i nie zwalniaj\u0105 pami\u0119ci, dop\u00f3ki s\u0105 wykonywane. W ma\u0142ej skali r\u00f3\u017cnica jest bez znaczenia (a metody takie jak <em>mapa<\/em> wydaje si\u0119 bardziej czytelna). Jednak w przypadku wi\u0119kszych zestaw\u00f3w danych zawsze warto rozwa\u017cy\u0107 zast\u0105pienie go bardziej podstawowymi p\u0119tlami. Tak jak w poni\u017cszym przyk\u0142adzie:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">numberofelements = 10000000\nrandoms = Array.new(numberofelements) { rand(10) }\n\nrandoms.each do |line|\n#do something\nend<\/code><\/pre>\n\n\n\n<p>i po refaktoryzacji:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">numberofelements = 10000000\nrandoms = Array.new(numberofelements) { rand(10) }\n\nwhile randoms.count &gt; 0\nline = randoms.shift\n#do something\nend\n\"`<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>U\u017cyj metody String::&lt;&lt;<\/strong><\/h2>\n\n\n\n<p>Jest to szybka, ale szczeg\u00f3lnie przydatna wskaz\u00f3wka. Je\u015bli dodasz jeden ci\u0105g do drugiego za pomoc\u0105 operatora += za kulisami. <strong>Ruby <\/strong> utworzy dodatkowy obiekt. Wi\u0119c to:\u00a0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code> a = \"X\"\n b = \"Y\"\n a += b<\/code><\/code><\/pre>\n\n\n\n<p>W rzeczywisto\u015bci oznacza to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code> a = \"X\"\n b = \"Y\"\n c = a + b\n a = c<\/code><\/code><\/pre>\n\n\n\n<p>Operator m\u00f3g\u0142by tego unikn\u0105\u0107, oszcz\u0119dzaj\u0105c troch\u0119 pami\u0119ci:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code><code> a = \"X\"\n b = \"Y\"\n a &lt;&lt; b<\/code><\/code><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Porozmawiajmy o Railsach<\/strong><\/h2>\n\n\n\n<p>The <strong>Framework Rails <\/strong> posiada mn\u00f3stwo \"<em>gotchas<\/em>\", kt\u00f3re pozwoli\u0142yby zoptymalizowa\u0107 <a href=\"https:\/\/thecodest.co\/pl\/dictionary\/what-is-code-refactoring\/\">kod<\/a> szybko i bez dodatkowego wysi\u0142ku.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Eager Loading AKA problem n+1 zapyta\u0144<\/strong><\/h2>\n\n\n\n<p>Za\u0142\u00f3\u017cmy, \u017ce mamy dwa powi\u0105zane modele, Post i Author:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">class Autor &lt; ApplicationRecord\nhas_many :posts\nend\n\nclass Post &lt; ApplicationRecord\nbelongs_to :author\nend<\/code><\/pre>\n\n\n\n<p>Chcemy pobra\u0107 wszystkie posty w naszym kontrolerze i wyrenderowa\u0107 je w widoku wraz z ich autorami:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">kontroler\n\ndef index\n@posts = Post.all.limit(20)\nend\n\nwidok<\/code><\/pre>\n\n\n\n<p>W kontrolerze, <a href=\"https:\/\/thecodest.co\/blog\/a-simple-ruby-application-from-scratch-with-active-record\/\">ActiveRecord<\/a> utworzy tylko jedno zapytanie, aby znale\u017a\u0107 nasze posty. Ale p\u00f3\u017aniej uruchomi r\u00f3wnie\u017c kolejne 20 zapyta\u0144, aby odpowiednio znale\u017a\u0107 ka\u017cdego autora - zajmuj\u0105c dodatkowy czas! Na szcz\u0119\u015bcie Railsy oferuj\u0105 szybkie rozwi\u0105zanie pozwalaj\u0105ce po\u0142\u0105czy\u0107 te zapytania w jedno. U\u017cywaj\u0105c funkcji <em>zawiera<\/em> mo\u017cemy przepisa\u0107 nasz kontroler w ten spos\u00f3b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code> def index\n     @posts = Post.all.includes(:author).limit(20)\n end<\/code><\/code><\/pre>\n\n\n\n<p>Na razie tylko niezb\u0119dne dane b\u0119d\u0105 pobierane w jednym zapytaniu.\u00a0<\/p>\n\n\n\n<p>Mo\u017cna r\u00f3wnie\u017c u\u017cy\u0107 innych klejnot\u00f3w, takich jak <a href=\"https:\/\/github.com\/flyerhzm\/bullet\">kula<\/a> aby dostosowa\u0107 ca\u0142y proces.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Dzwo\u0144 tylko do tego, czego potrzebujesz<\/strong><\/h2>\n\n\n\n<p>Inn\u0105 przydatn\u0105 technik\u0105 zwi\u0119kszania szybko\u015bci ActiveRecord jest wywo\u0142ywanie tylko tych atrybut\u00f3w, kt\u00f3re s\u0105 niezb\u0119dne do bie\u017c\u0105cych cel\u00f3w. Jest to szczeg\u00f3lnie przydatne, gdy aplikacja zaczyna si\u0119 rozrasta\u0107, a liczba kolumn w tabeli r\u00f3wnie\u017c wzrasta.<\/p>\n\n\n\n<p>We\u017amy nasz poprzedni kod jako przyk\u0142ad i za\u0142\u00f3\u017cmy, \u017ce musimy tylko wybra\u0107 nazwiska z autor\u00f3w. Mo\u017cemy wi\u0119c przepisa\u0107 nasz kontroler:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code><code> def index\n     @posts = Post.all.includes(:author).select(\"name\").limit(20)\n end<\/code><\/code><\/code><\/pre>\n\n\n\n<p>Teraz instruujemy nasz kontroler, aby pomija\u0142 wszystkie atrybuty z wyj\u0105tkiem tego, kt\u00f3rego potrzebujemy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Prawid\u0142owe renderowanie cz\u0119\u015bciowych<\/strong><\/h2>\n\n\n\n<p>Za\u0142\u00f3\u017cmy, \u017ce chcemy utworzy\u0107 osobn\u0105 cz\u0119\u015b\u0107 dla naszych post\u00f3w z poprzednich przyk\u0142ad\u00f3w:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code><code><code>\n<\/code><\/code><\/code><\/code><\/pre>\n\n\n\n<p>Na pierwszy rzut oka kod ten wygl\u0105da poprawnie. Jednak przy wi\u0119kszej liczbie post\u00f3w do wyrenderowania, ca\u0142y proces b\u0119dzie znacznie wolniejszy. Dzieje si\u0119 tak, poniewa\u017c <strong>Szyny <\/strong> ponownie wywo\u0142uje nasz partial z now\u0105 iteracj\u0105. Mo\u017cemy to naprawi\u0107, u\u017cywaj\u0105c funkcji <em>kolekcje<\/em> funkcja:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"><code><code><code> .<\/code><\/code><\/code><\/code><\/pre>\n\n\n\n<p>Teraz, <strong>Szyny<\/strong> automatycznie ustali, kt\u00f3ry szablon powinien zosta\u0107 u\u017cyty i zainicjuje go tylko raz.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Przetwarzanie w tle<\/strong><\/h2>\n\n\n\n<p>Ka\u017cdy proces, kt\u00f3ry jest bardziej czasoch\u0142onny i nie jest kluczowy dla bie\u017c\u0105cego przep\u0142ywu, mo\u017ce by\u0107 uwa\u017cany za dobrego kandydata do przetwarzania w tle, np. wysy\u0142anie wiadomo\u015bci e-mail, gromadzenie statystyk lub dostarczanie okresowych raport\u00f3w.&nbsp;<\/p>\n\n\n\n<p><strong>Sidekiq<\/strong> jest najcz\u0119\u015bciej u\u017cywanym klejnotem do przetwarzania w tle. U\u017cywa <strong>Redis<\/strong> do przechowywania zada\u0144. Pozwala r\u00f3wnie\u017c kontrolowa\u0107 przep\u0142yw proces\u00f3w w tle, dzieli\u0107 je na osobne kolejki i zarz\u0105dza\u0107 wykorzystaniem pami\u0119ci dla ka\u017cdego z nich.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Pisz mniej kodu, u\u017cywaj wi\u0119cej klejnot\u00f3w<\/strong><\/h2>\n\n\n\n<p><strong>Szyny <\/strong> wymy\u015bli\u0142 ogromn\u0105 liczb\u0119 klejnot\u00f3w, kt\u00f3re nie tylko u\u0142atwiaj\u0105 \u017cycie i przyspieszaj\u0105 <a href=\"https:\/\/thecodest.co\/pl\/blog\/how-the-codests-team-extension-model-can-transform-your-in-house-development-team\/\">proces rozwoju<\/a>ale tak\u017ce zwi\u0119kszy\u0107 szybko\u015b\u0107 dzia\u0142ania aplikacji. Klejnoty takie jak Devise czy Pundit s\u0105 zazwyczaj dobrze przetestowane pod wzgl\u0119dem szybko\u015bci i dzia\u0142aj\u0105 szybciej i bezpieczniej ni\u017c kod napisany na zam\u00f3wienie w tym samym celu.<\/p>\n\n\n\n<p>W przypadku jakichkolwiek pyta\u0144 dotycz\u0105cych poprawy <em>Wydajno\u015b\u0107 Rails\u00f3w<\/em>zasi\u0119g <strong><a href=\"https:\/\/thecodest.co\">In\u017cynierowie The Codest<\/a><\/strong> aby skonsultowa\u0107 swoje w\u0105tpliwo\u015bci.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/careers#offers]\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/ruby-1-.png\" alt=\"Oferta dla programist\u00f3w Ruby\"\/><\/a><\/figure>\n\n\n\n<p><strong>Czytaj wi\u0119cej:<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/pros-and-cons-of-ruby-software-development\/\">Plusy i minusy tworzenia oprogramowania w Ruby<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-and-other-means-of-transport\">Szyny i inne \u015brodki transportu<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-development-with-tmux-vim-fzf-ripgrep\">Rails Development z TMUX, Vim, Fzf + Ripgrep<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Pomimo licznych zalet, Ruby on Rails jest nadal uwa\u017cany za stosunkowo powolny framework webowy. Wszyscy wiemy, \u017ce Twitter porzuci\u0142 Railsy na rzecz Scali. Jednak dzi\u0119ki kilku sprytnym ulepszeniom mo\u017cesz uruchomi\u0107 swoj\u0105 aplikacj\u0119 znacznie szybciej!<\/p>","protected":false},"author":2,"featured_media":3805,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3804","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Increase Rails Performance - The Codest<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/pl\/blog\/sposoby-na-zwiekszenie-wydajnosci-szyn\/\" \/>\n<meta property=\"og:locale\" content=\"pl_PL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Increase Rails Performance\" \/>\n<meta property=\"og:description\" content=\"Despite its numerous advantages, Ruby on Rails is still considered to be a relatively slow web framework. We all know that Twitter has left Rails in favor of Scala. However, with a few cleaver improvements you can run your app significantly faster!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/pl\/blog\/sposoby-na-zwiekszenie-wydajnosci-szyn\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-17T10:11:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-04T21:01:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minuty\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"How to Increase Rails Performance\",\"datePublished\":\"2022-02-17T10:11:03+00:00\",\"dateModified\":\"2024-07-04T21:01:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\"},\"wordCount\":856,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"pl-PL\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\",\"name\":\"How to Increase Rails Performance - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"datePublished\":\"2022-02-17T10:11:03+00:00\",\"dateModified\":\"2024-07-04T21:01:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#breadcrumb\"},\"inLanguage\":\"pl-PL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ways_to_increase_your_rails_performance.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Increase Rails Performance\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pl-PL\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pl-PL\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/pl\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Jak zwi\u0119kszy\u0107 wydajno\u015b\u0107 Rails\u00f3w - The Codest","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thecodest.co\/pl\/blog\/sposoby-na-zwiekszenie-wydajnosci-szyn\/","og_locale":"pl_PL","og_type":"article","og_title":"How to Increase Rails Performance","og_description":"Despite its numerous advantages, Ruby on Rails is still considered to be a relatively slow web framework. We all know that Twitter has left Rails in favor of Scala. However, with a few cleaver improvements you can run your app significantly faster!","og_url":"https:\/\/thecodest.co\/pl\/blog\/sposoby-na-zwiekszenie-wydajnosci-szyn\/","og_site_name":"The Codest","article_published_time":"2022-02-17T10:11:03+00:00","article_modified_time":"2024-07-04T21:01:27+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"4 minuty"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"How to Increase Rails Performance","datePublished":"2022-02-17T10:11:03+00:00","dateModified":"2024-07-04T21:01:27+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/"},"wordCount":856,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","articleSection":["Software Development"],"inLanguage":"pl-PL","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/","url":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/","name":"Jak zwi\u0119kszy\u0107 wydajno\u015b\u0107 Rails\u00f3w - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","datePublished":"2022-02-17T10:11:03+00:00","dateModified":"2024-07-04T21:01:27+00:00","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#breadcrumb"},"inLanguage":"pl-PL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/"]}]},{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ways_to_increase_your_rails_performance.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"How to Increase Rails Performance"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pl-PL"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"pl-PL","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/pl\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts\/3804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/comments?post=3804"}],"version-history":[{"count":8,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts\/3804\/revisions"}],"predecessor-version":[{"id":8428,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/posts\/3804\/revisions\/8428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/media\/3805"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/media?parent=3804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/categories?post=3804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/pl\/wp-json\/wp\/v2\/tags?post=3804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}