{"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":"zpusoby-jak-zvysit-vykonnost-kolejnic","status":"publish","type":"post","link":"https:\/\/thecodest.co\/cs\/blog\/ways-to-increase-your-rails-performance\/","title":{"rendered":"Jak zv\u00fd\u0161it v\u00fdkon syst\u00e9mu Rails"},"content":{"rendered":"<h2 class=\"wp-block-heading\"><strong>Ruby First<\/strong><\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/thecodest.co\/cs\/case-studies\/providing-a-team-of-ruby-developers-for-a-fintech-company\/\">Ruby<\/a><\/strong> je v\u00fdrazn\u011b objektov\u011b orientovan\u00fd jazyk. Ve skute\u010dnosti je v n\u011bm (t\u00e9m\u011b\u0159) v\u0161echno <strong>Ruby<\/strong> je objekt. Vytv\u00e1\u0159en\u00ed nepot\u0159ebn\u00fdch objekt\u016f m\u016f\u017ee v\u00e1\u0161 program st\u00e1t spoustu dodate\u010dn\u00e9 spot\u0159eby pam\u011bti, proto je t\u0159eba se mu vyhnout.<\/p>\n\n\n\n<p>K m\u011b\u0159en\u00ed rozd\u00edlu pou\u017eijeme <em><a href=\"https:\/\/github.com\/SamSaffron\/memory_profiler\">memory_profiler<\/a><\/em> gem a integrovan\u00fd modul Benchmark pro m\u011b\u0159en\u00ed \u010dasov\u00e9ho v\u00fdkonu.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Pou\u017eit\u00ed metod bang! na \u0159et\u011bzce<\/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\/cs\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">data<\/a> = \"X\" * 1024 * 1024 * 100\ndata = data.downcase\nkonec\n\nreport.pretty_print<\/code><\/pre>\n\n\n\n<p>V n\u00ed\u017ee uveden\u00e9m v\u00fdpisu jsme vytvo\u0159ili 100MB \u0159et\u011bzec a zmen\u0161ili ka\u017ed\u00fd znak v n\u011bm obsa\u017een\u00fd. N\u00e1\u0161 benchmark d\u00e1v\u00e1 n\u00e1sleduj\u00edc\u00ed v\u00fdsledky <a href=\"https:\/\/thecodest.co\/cs\/blog\/why-us-companies-are-opting-for-polish-developers\/\">n\u00e1s<\/a> n\u00e1sleduj\u00edc\u00ed zpr\u00e1vu:<\/p>\n\n\n\n<p><em>Celkem p\u0159id\u011bleno: 210765044 bajt\u016f (6 objekt\u016f)<\/em><\/p>\n\n\n\n<p>Nahrad\u00edme-li v\u0161ak \u0159\u00e1dek 6 t\u00edmto:<\/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>\u010cten\u00ed soubor\u016f \u0159\u00e1dek po \u0159\u00e1dku<\/strong><\/h2>\n\n\n\n<p>\u00dadajn\u011b pot\u0159ebujeme na\u010d\u00edst obrovskou kolekci dat o 2 milionech z\u00e1znam\u016f ze souboru csv. Typicky by to vypadalo takto:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">vy\u017eadovat 'benchmark'\n\nBenchmark.bm do |x|\nx.report do\nFile.readlines(\"2mrecords.csv\").map! {|line| line.split(\",\")}\nkonec\nkonec<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">u\u017eivatel syst\u00e9m celkem re\u00e1ln\u00fd\n\n12.797000 2.437000 15.234000 (106.319865)<\/code><\/pre>\n\n\n\n<p>\u00dapln\u00e9 sta\u017een\u00ed souboru trvalo v\u00edce ne\u017e 106 sekund. To je docela dost! Tento proces v\u0161ak m\u016f\u017eeme urychlit nahrazen\u00edm souboru <em>mapa!<\/em> s jednoduchou metodou <em>zat\u00edmco<\/em> smy\u010dka:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">vy\u017eadovat '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\u017eivatel syst\u00e9m celkem re\u00e1ln\u00fd\n\n6.078000 0.250000 6.328000 ( 6.649422)<\/code><\/pre>\n\n\n\n<p>Doba b\u011bhu se nyn\u00ed v\u00fdrazn\u011b sn\u00ed\u017eila, proto\u017ee <em>mapa!<\/em> metoda pat\u0159\u00ed do ur\u010dit\u00e9 t\u0159\u00eddy, jako nap\u0159. <em>Hash#map<\/em> nebo <em>Array#map<\/em>, kde <strong>Ruby<\/strong> ulo\u017e\u00ed ka\u017ed\u00fd \u0159\u00e1dek analyzovan\u00e9ho souboru do pam\u011bti, dokud je prov\u00e1d\u011bn. <strong>Sb\u011bra\u010d odpadk\u016f v jazyce Ruby <\/strong>neuvoln\u00ed pam\u011b\u0165 d\u0159\u00edve, ne\u017e budou tyto iter\u00e1tory zcela provedeny. \u010cten\u00ed \u0159\u00e1dek po \u0159\u00e1dku v\u0161ak zp\u016fsob\u00ed, \u017ee GC p\u0159em\u00edst\u00ed pam\u011b\u0165 z p\u0159edchoz\u00edch \u0159\u00e1dk\u016f, pokud to nen\u00ed nutn\u00e9.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Vyhnout se iter\u00e1tor\u016fm metod ve v\u011bt\u0161\u00edch kolekc\u00edch<\/strong><\/h2>\n\n\n\n<p>Tento bod je roz\u0161\u00ed\u0159en\u00edm p\u0159edchoz\u00edho bodu o b\u011b\u017en\u011bj\u0161\u00ed p\u0159\u00edklad. Jak jsem se ji\u017e zm\u00ednil, <a href=\"https:\/\/thecodest.co\/blog\/high-demand-for-ruby-developers\/\">Ruby<\/a> iter\u00e1tory jsou objektov\u00e9 metody a neuvol\u0148uj\u00ed pam\u011b\u0165, dokud jsou prov\u00e1d\u011bny. V mal\u00e9m m\u011b\u0159\u00edtku je tento rozd\u00edl bezv\u00fdznamn\u00fd (a metody jako nap\u0159. <em>mapa<\/em> se zd\u00e1 b\u00fdt \u010diteln\u011bj\u0161\u00ed). Pokud v\u0161ak jde o v\u011bt\u0161\u00ed soubory dat, je v\u017edy dobr\u00e9 zv\u00e1\u017eit, zda je nenahradit z\u00e1kladn\u011bj\u0161\u00edmi smy\u010dkami. Jako na p\u0159\u00edkladu n\u00ed\u017ee:<\/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\nkonec<\/code><\/pre>\n\n\n\n<p>a po refaktorizaci:<\/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>Pou\u017eijte metodu String::&lt;&lt;<\/strong><\/h2>\n\n\n\n<p>Jedn\u00e1 se o rychl\u00fd, ale mimo\u0159\u00e1dn\u011b u\u017eite\u010dn\u00fd tip. Pokud p\u0159ipoj\u00edte jeden \u0159et\u011bzec k druh\u00e9mu pomoc\u00ed oper\u00e1toru += v pozad\u00ed. <strong>Ruby <\/strong> vytvo\u0159\u00ed dal\u0161\u00ed objekt. Tak\u017ee toto:\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>Ve skute\u010dnosti to znamen\u00e1 toto:<\/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>Oper\u00e1tor by se tomu vyhnul a u\u0161et\u0159il by v\u00e1m pam\u011b\u0165:<\/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>Promluvme si o syst\u00e9mech Rails<\/strong><\/h2>\n\n\n\n<p>Na str\u00e1nk\u00e1ch <strong>R\u00e1mec Rails <\/strong> m\u00e1 spoustu \"<em>gotchas<\/em>\", kter\u00e9 by v\u00e1m umo\u017enily optimalizovat va\u0161e <a href=\"https:\/\/thecodest.co\/cs\/dictionary\/what-is-code-refactoring\/\">k\u00f3d<\/a> rychle a bez v\u011bt\u0161\u00ed n\u00e1mahy.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Dychtiv\u00e9 na\u010d\u00edt\u00e1n\u00ed AKA probl\u00e9m n+1 dotaz\u016f<\/strong><\/h2>\n\n\n\n<p>P\u0159edpokl\u00e1dejme, \u017ee m\u00e1me dva p\u0159idru\u017een\u00e9 modely, Post a Author:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">t\u0159\u00edda Author &lt; ApplicationRecord\nhas_many :posts\nend\n\nt\u0159\u00edda Post &lt; ApplicationRecord\nbelongs_to :author\nend<\/code><\/pre>\n\n\n\n<p>Chceme na\u010d\u00edst v\u0161echny p\u0159\u00edsp\u011bvky v na\u0161em kontrol\u00e9ru a zobrazit je v zobrazen\u00ed s jejich autory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">\u0159\u00eddic\u00ed jednotka\n\ndef index\n@posts = Post.all.limit(20)\nend\n\nzobrazit<\/code><\/pre>\n\n\n\n<p>V ovlada\u010di, <a href=\"https:\/\/thecodest.co\/blog\/a-simple-ruby-application-from-scratch-with-active-record\/\">ActiveRecord<\/a> vytvo\u0159\u00ed pouze jeden dotaz pro vyhled\u00e1n\u00ed na\u0161ich p\u0159\u00edsp\u011bvk\u016f. Pozd\u011bji v\u0161ak tak\u00e9 vyvol\u00e1 dal\u0161\u00edch 20 dotaz\u016f, aby podle nich na\u0161el ka\u017ed\u00e9ho autora - co\u017e zabere dal\u0161\u00ed \u010das! Na\u0161t\u011bst\u00ed Rails p\u0159ich\u00e1z\u00ed s rychl\u00fdm \u0159e\u0161en\u00edm, jak tyto dotazy spojit do jedin\u00e9ho. Pomoc\u00ed p\u0159\u00edkazu <em>obsahuje<\/em> m\u016f\u017eeme n\u00e1\u0161 kontrol\u00e9r p\u0159epsat t\u00edmto zp\u016fsobem:<\/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>Prozat\u00edm se do jednoho dotazu na\u010dtou pouze pot\u0159ebn\u00e1 data.\u00a0<\/p>\n\n\n\n<p>M\u016f\u017eete tak\u00e9 pou\u017e\u00edt jin\u00e9 drahokamy, nap\u0159. <a href=\"https:\/\/github.com\/flyerhzm\/bullet\">kulka<\/a> p\u0159izp\u016fsobit cel\u00fd proces.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Volejte jen to, co pot\u0159ebujete<\/strong><\/h2>\n\n\n\n<p>Dal\u0161\u00ed u\u017eite\u010dnou technikou pro zv\u00fd\u0161en\u00ed rychlosti ActiveRecord je vol\u00e1n\u00ed pouze t\u011bch atribut\u016f, kter\u00e9 jsou nezbytn\u00e9 pro aktu\u00e1ln\u00ed \u00fa\u010dely. To je u\u017eite\u010dn\u00e9 zejm\u00e9na tehdy, kdy\u017e se va\u0161e aplikace za\u010dne rozr\u016fstat a zv\u00fd\u0161\u00ed se i po\u010det sloupc\u016f v tabulce.<\/p>\n\n\n\n<p>Vezm\u011bme si jako p\u0159\u00edklad n\u00e1\u0161 p\u0159edchoz\u00ed k\u00f3d a p\u0159edpokl\u00e1dejme, \u017ee pot\u0159ebujeme vybrat pouze jm\u00e9na autor\u016f. M\u016f\u017eeme tedy p\u0159epsat n\u00e1\u0161 kontrol\u00e9r:<\/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>Nyn\u00ed d\u00e1me kontrol\u00e9ru pokyn, aby vynechal v\u0161echny atributy krom\u011b toho, kter\u00fd pot\u0159ebujeme.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Spr\u00e1vn\u00e9 vykreslov\u00e1n\u00ed d\u00edl\u010d\u00edch \u010d\u00e1st\u00ed<\/strong><\/h2>\n\n\n\n<p>\u0158ekn\u011bme, \u017ee chceme vytvo\u0159it samostatnou d\u00edl\u010d\u00ed \u010d\u00e1st pro na\u0161e p\u0159\u00edsp\u011bvky z p\u0159edchoz\u00edch p\u0159\u00edklad\u016f:<\/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 prvn\u00ed pohled vypad\u00e1 tento k\u00f3d spr\u00e1vn\u011b. P\u0159i v\u011bt\u0161\u00edm po\u010dtu p\u0159\u00edsp\u011bvk\u016f k vykreslen\u00ed v\u0161ak bude cel\u00fd proces v\u00fdrazn\u011b pomalej\u0161\u00ed. Je to zp\u016fsobeno t\u00edm, \u017ee <strong>Rails <\/strong> znovu vyvol\u00e1 n\u00e1\u0161 d\u00edl\u010d\u00ed p\u0159\u00edkaz s novou iterac\u00ed. M\u016f\u017eeme to napravit pomoc\u00ed p\u0159\u00edkazu <em>sb\u00edrky<\/em> funkce:<\/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>Nyn\u00ed, <strong>Rails<\/strong> automaticky zjist\u00ed, kter\u00e1 \u0161ablona m\u00e1 b\u00fdt pou\u017eita, a inicializuje ji pouze jednou.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Pou\u017eit\u00ed zpracov\u00e1n\u00ed na pozad\u00ed<\/strong><\/h2>\n\n\n\n<p>Ka\u017ed\u00fd proces, kter\u00fd je \u010dasov\u011b n\u00e1ro\u010dn\u011bj\u0161\u00ed a nen\u00ed kl\u00ed\u010dov\u00fd pro v\u00e1\u0161 aktu\u00e1ln\u00ed tok, m\u016f\u017ee b\u00fdt pova\u017eov\u00e1n za vhodn\u00e9ho kandid\u00e1ta pro zpracov\u00e1n\u00ed na pozad\u00ed, nap\u0159. odes\u00edl\u00e1n\u00ed e-mail\u016f, shroma\u017e\u010fov\u00e1n\u00ed statistik nebo poskytov\u00e1n\u00ed pravideln\u00fdch zpr\u00e1v.&nbsp;<\/p>\n\n\n\n<p><strong>Sidekiq<\/strong> je nej\u010dast\u011bji pou\u017e\u00edvan\u00fdm drahokamem pro zpracov\u00e1n\u00ed na pozad\u00ed. Pou\u017e\u00edv\u00e1 <strong>Redis<\/strong> k ukl\u00e1d\u00e1n\u00ed \u00fakol\u016f. Umo\u017e\u0148uje tak\u00e9 \u0159\u00eddit tok proces\u016f na pozad\u00ed, rozd\u011blit je do samostatn\u00fdch front a \u0159\u00eddit vyu\u017eit\u00ed pam\u011bti pro ka\u017ed\u00fd z nich.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Pi\u0161te m\u00e9n\u011b k\u00f3du, pou\u017e\u00edvejte v\u00edce drahokam\u016f<\/strong><\/h2>\n\n\n\n<p><strong>Rails <\/strong> p\u0159i\u0161el s obrovsk\u00fdm mno\u017estv\u00edm skvost\u016f, kter\u00e9 v\u00e1m nejen usnadn\u00ed \u017eivot a urychl\u00ed pr\u00e1ci. <a href=\"https:\/\/thecodest.co\/cs\/blog\/how-the-codests-team-extension-model-can-transform-your-in-house-development-team\/\">proces v\u00fdvoje<\/a>, ale tak\u00e9 zv\u00fd\u0161it rychlost v\u00fdkonu va\u0161\u00ed aplikace. Klenoty jako Devise nebo Pundit jsou obvykle dob\u0159e otestovan\u00e9, pokud jde o jejich rychlost, a pracuj\u00ed rychleji a bezpe\u010dn\u011bji ne\u017e k\u00f3d napsan\u00fd na zak\u00e1zku pro stejn\u00fd \u00fa\u010del.<\/p>\n\n\n\n<p>V p\u0159\u00edpad\u011b jak\u00fdchkoli dotaz\u016f na zlep\u0161en\u00ed <em>V\u00fdkonnost syst\u00e9mu Rails<\/em>, dos\u00e1hnout <strong><a href=\"https:\/\/thecodest.co\">In\u017een\u00fd\u0159i The Codest<\/a><\/strong> ven, abyste se poradili o sv\u00fdch pochybnostech.<\/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=\"Nab\u00eddka pro v\u00fdvoj\u00e1\u0159e Ruby\"\/><\/a><\/figure>\n\n\n\n<p><strong>P\u0159e\u010dt\u011bte si v\u00edce:<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/pros-and-cons-of-ruby-software-development\/\">V\u00fdhody a nev\u00fdhody v\u00fdvoje softwaru v jazyce Ruby<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-and-other-means-of-transport\">Kolejnice a dal\u0161\u00ed dopravn\u00ed prost\u0159edky<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-development-with-tmux-vim-fzf-ripgrep\">V\u00fdvoj Rails pomoc\u00ed TMUX, Vim, Fzf + Ripgrep<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>I p\u0159es sv\u00e9 \u010detn\u00e9 v\u00fdhody je Ruby on Rails st\u00e1le pova\u017eov\u00e1n za relativn\u011b pomal\u00fd webov\u00fd framework. V\u0161ichni v\u00edme, \u017ee Twitter opustil Rails ve prosp\u011bch Scaly. S n\u011bkolika chytr\u00fdmi vylep\u0161en\u00edmi v\u0161ak m\u016f\u017eete svou aplikaci spustit v\u00fdrazn\u011b rychleji!<\/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\/cs\/blog\/zpusoby-jak-zvysit-vykonnost-kolejnic\/\" \/>\n<meta property=\"og:locale\" content=\"cs_CZ\" \/>\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\/cs\/blog\/zpusoby-jak-zvysit-vykonnost-kolejnic\/\" \/>\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 minutes\" \/>\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\":\"cs-CZ\",\"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\":\"cs-CZ\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ways-to-increase-your-rails-performance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"cs-CZ\",\"@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\":\"cs-CZ\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"cs-CZ\",\"@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\":\"cs-CZ\",\"@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\\\/cs\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Jak zv\u00fd\u0161it v\u00fdkon kolejnic - 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\/cs\/blog\/zpusoby-jak-zvysit-vykonnost-kolejnic\/","og_locale":"cs_CZ","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\/cs\/blog\/zpusoby-jak-zvysit-vykonnost-kolejnic\/","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 minutes"},"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":"cs-CZ","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 zv\u00fd\u0161it v\u00fdkon kolejnic - 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":"cs-CZ","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/ways-to-increase-your-rails-performance\/"]}]},{"@type":"ImageObject","inLanguage":"cs-CZ","@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":"cs-CZ"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"cs-CZ","@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":"cs-CZ","@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\/cs\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/comments?post=3804"}],"version-history":[{"count":8,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3804\/revisions"}],"predecessor-version":[{"id":8428,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/posts\/3804\/revisions\/8428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/media\/3805"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/media?parent=3804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/categories?post=3804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/cs\/wp-json\/wp\/v2\/tags?post=3804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}