Merken

3x Rails: Tuning the Framework Internals

Zitierlink des Filmsegments
Embed Code

Automatisierte Medienanalyse

Beta
Erkannte Entitäten
Sprachtranskript
in that in that the good and the of this study sidled 3 it's me rails book was title mean this talk is about speeding up rails framers but the and so sorry I kind of feel to bring something like hi guys abrupt a medical patch that makes really young males 3 times faster so let's just Mory's this and release rail 50 now I I got plan do this on stage that I'm sorry failed so instead I like to discuss some weight possibilities war points of view right so again what the title 3 x mean actually this title is
inspired by Matt's keynote at Ruby hygiene the last year and recall the think in that you know he met stated that he
promised that Ruby 3 . 0 is going to be 3 3 times faster than ready to something what's happening if you could look that so instead of it's actually it's so easy to make Ruby on Rails 3 time passes so easy because I
everything we need to do is just don't make no more performance regression In the rail side and waits for a role as a site a really 3 then Ronnie rails applications on really 3 that obviously should be 3 time pastorales yeah win so anyway my name is a
Kirov I'm on internet as a not so that are like this
I'll work on some open source projects like Ruby language and rails framerate also
I offered and maintaining some jam libraries like common are you the position library armed active decorator motor he state a full in a known answered it writes it from
and I run a local reviews a group called a subset of R E in Tokyo the subset of RB was
established in I think 2008 remitting up on every Ruby Tuesday and we had the so for 300 in 50 feet 6 we don't so far so yes so many reports committers in over members like more than 30 people can we had attendees Fareham like lot training different countries from all over the world so it's quite a global local group right we welcome every visitor is firm our any other countries like I mean countries not that not listed here so if you're interested in visiting our user group and efforts have having chance that in Tokyo please contact me and consul made up also on
organizing every conference in Japan named Ruby kites very quiet he aims to be
a the most technical Ruby conference focusing on the loopy wrecked Ruby language itself West is Rick ID was like this and this
year for having another Cai G. the in September In please note that the the conference is not in Tokyo overseas get so it is and the ancient capital of
Japan there remains so many historical like temples and shrines gardens and so on like showed in this picture is I just google efforts Kyoto this is the result so I think total is the most beautiful city in Japan so if you haven't been to rebuke ID before and you're willing to I think the CIA's 1 is a really good chance to enjoy both the conference and you trips so so please consider joining the Conference this year's venue
looks like this this is a picture of the main hall the in the
2nd Hall and then he has nice looking Gordon Japanese
Horton so that already selling the
tickets and see if b is already open so please take this official website and so many years talk award by a ticket 7 thus began the actual talk
as alpha as of found you this talk is
about speeding up the real for not your Rails application 2 states the speed of
software firstly we need to know it's speed and you know that's a
major the speed we usually use like benchmarking software like for
example benchmark IPS or reviews built in benchmark library I prefer this benchmark PBS for example
effects we wanted to measure the portal performance of your Rails application the we
our for example it into something like this it and I made a Monte batch of petting Rails application don't call and we around benchmark IPS it's actually kind of runs the request like 100 times I know it's horrible horrible idea but it kind words at and it benchmarks purely of the real support right I mean it skips the browser sides so this all put some for and the
bead pack on so can improve to discourse that's the topic of today's talk my 1st
trial is the force Ruby GC because everyone knows that
reviews so slow OK I believe it just like stopping will improve a performance like 30 per cent so let's for do this 1st on 2 observed the
GC we have to stabbed in the core library and we have G C tracer which is made by co which he so for example and
Jesus that calls to the previous modules it shows something like
this like it iterates 45 times in 5 seconds and it all put some like steps the result shows that it's surely showing is happening there like 50 times right so let's stop
this like GC disable then run the benchmark Don the then I got this
results 50 50 iterations 5 seconds so the the GC adds
about 10 % over here in this inverse benchmark I think
because repeat is improved reproduces improving recently like this we had so many improvements on GC modules so you is actually no more than 30 per cent over here it's like just about 10 % over here it's which is I think the on not a big deal it's acceptable in my opinion the so I like to
thank co Kiefer during this amazing work she pondering this amazing work and also thank you Heroku 1st supporting his it the thank you very much collision who could by the way let me know not
now talk a little bit more about Ruby 2 3 new feature somewhat concerning to the garbage collection Bob strings the strings
and rails used to be a big concern of the community and directly was a trans like standing a pull request with . freeze don't freeze Dumfries up freezing rails and shows some microbes benchmark which aims to make real fast but honestly I did like that kind of pull request because it kind of believes that codebase right it's just looks looks ugly to me so I propose what that meta-comments a repeat to freeze also string in the final just in order to stop that don't free school requests so like this frozen string
literals true it's already introduced in review to 3 it's all already available so if interested you may try actually I haven't not tried it myself yet but maybe this school have some performance like several presented 3 of my presentat against the maybe In way
along anyway let's stop but that stop caring about the strains now it's already solved problems I think the and
on other we mean is review slow
because it's a scripting language we have to porous and compile every time so it's slower than compiled language is it true I think it is true but Robert Sifry has near
future then you can precompiled Ruby code into a binary and you
can although the binary another talk about this in detail this is kind it's going to be
described by Kouichi the implemented his himself so you don't miss Kouichi stock tomorrow about this
cell which part of the on a simple rules implications takes time this profile to to measure the whole performance I used as a benchmark in South America to profile which part is actually so we use profiling software like stacked prof
wars like art line prof
but again I'm not going to describe them in details in this presentation because you may have already known heard of this and you may know this these tools these are
2 part so powerful and I and so popular maybe you may have heard of this before
and also we have tracepoints which is a built-in library
in Ruby again co which is worth you can simply can't the number of method calls and you can like hook into method really method called and like on both the hook into every method calls so you can call the method calls like this the like this is a
sample the example all right middleware where that columns every method call happening in inside that rack middle respect so with this middleware I give this Oppelt
firm mind scaffolded Rails application the most happening method call is safe buffer original safe and personal safe escape reached male on the tributes something things like this however these are just
theories and I'm sorry minutes or something different today through my experience and I know some like weird parts of rails on weak parts of rail still parts of rails and that although some of these in the rest of my time
cell rails consists of M C which 1 do you think it is the most here part how well mention
back the seaport action back sits on top of so many racked meal as that would make the method call security maybe that would be a bottleneck the and actually Ralph
5 introduces on a new feature called rails API In order to reduce this direct middleware depth I think so it's measure this is a very
again very lot roughly written on Mac middleware like benchmarking tool this talk books on how old how long does it take after each over and I've got result like this
less than 0 . 0 . 0 0 0 . 0 1 0 something 1st every meter well
right so it turns out there's no slow
mineral default stack the I don't actually see any any other particularly slow part impact actually the come the size Rulz resolution and your hawkers which I'm not going to talk about think so let's leave action pack and let's
see this list again there are a sunlight
safe buffer things and escape racial things which is obviously action view the action has some
performance problems I know that so
session view consists of point roughly these these processes it looks up the templating compulsive employed and when there's a template then returns the HL strings to the browser the so let's start with that
simply look up current implementation
of simply looking up is like this it calls this directory glove ferred every of single simply look up so that the resolver queries to the file
system per each risk request actually breach on Wednesday friends the layout when the proper Marshall each vendor can we stayed speed this so I
tried to make more optimized resolver over the default optimize result the concept is like this
on just read the whole file system once and cash that catch all the filenames contemplate Paul names in memory so this is the the trial
implementation which is already on get hold this DL on the scans through review path directory only when the application of the 1st axis and caches all the filenames that it performs the geo following comparison in memory as a function an here is a
benchmark proving the speed and the result is like this the
my version of simply resulted is all 18 times
faster then the default in the very like carefully crafted micro-benchmarks benchmark if it set of and now there is another issue
I think is Armed render partial and the partial is basically slow because arm like it creates another buffer breach when the partial but in some cases that we don't need a new life new on the context for each partial like simply rendering puts a header as a drop so we considered we Republic or can do something like PHB include and simply concatenate that partial into the parents on template and the implementation is so I'm sorry still
work in progress this wasn't very easy as I expected if so another idea is
we can pass the full full path filename in render partial call so
that on the template resolver it doesn't have to look up all the view paths get the all
like this runs the path with a full path filename board men's a relative like require relative in Ruby the implementation is again not
yet on the another idea about rendering
is when 0 parallel so we can paralyze when the collection so if you have 100 collection maybe we can make the render collection 1 100 times faster with using threats right actually tried
this but I saw so many to many connections errors from active reckon it's obvious me so this turns out to be a failure I think
another rans er method is spends the remote which performs surrendering the vi Ajax particularly for it are very heavy and partial here's an implementation which
I did like my 2 3 years ago on I found a repository I looked at the repository like I like yesterday but I forgot what is the name means but in a good the API is like
this for simple and remote true 2 year-ends a call then this would to form the friends there when the partial called through the Ajax the it kind of were already bricks I'm
sorry but I'm not using it
so another topic it is including support In template rendering the current implementation
of rendering good templated into our Ruby method is like this it 1st dupes the give and templates force the whole templates string and force encoding this was binary on the sources text to binary and tubes the give and someplace source again 1st like on detecting the meta-comment including meta-comments then force encoding again for some reason and finally
encode in your B so many like encoding convergence the
but who needs this feature who has the right a non you'd see if you file in your application if any 1 of you those please read you raise a hand while you do have in that OK so nobody in this room as the does use this feature that they have actually is sorry for In the last I no no OK I again have that might be possible I think that after the actual use case is probably for Japanese people because I see test cases like she GIS ships giants which I think is written by your hood but I'm sure nobody justice in Japan now it's just ridiculous so so the current status
I know what he means this feature so we just can remove this who could be so here's my suggestion around
the let's do this
and I would do it
so here's a benchmark for this new version of your be handlers on and this is the result it kind of shows
some improvement but only 1
time of flight of 1 applied find 1 . 5 time passes in this In this
case it includes the whole compiling action process in the yard side not just the encoding convergence and moreover this would reduce the memory consumption I suppose so let's profile that
with memory profiler the the the
code looks like this benchmarking the memory consumption in again there benchmark ideas for the inside the block that repeats the whole like template and the
result is like this that kind of shows some like memory reduce in strings string objects and not in a memory
memory usage is very important it's about speed actually because if you could reduce this than we did but more containers arming web on workers in the Web VIP application tainted so this really is about
speed right so I'd like to propose
removing the encoding support maybe in rail 6 so by the way this
is about the behind handler so here is a hello we
have some alternative names implementations like this
so please try using these instead of the official have all on this topic is
active support safe buffer as we signed the method calls graph we call this so many times
which is currently a very ad-hoc implementation in pairs the flight inside the string object and flips the flag on and off so I tried to like
use rubies built-in tainted blank but I failed but maybe we could make a faster version of state buffet somehow they being extension against on the
because I 18 and so I have only 5 more minutes so all speed of my talk on the the again it's not yet done
but have some Burke progress in my this machine which probably all all published within a few days the next topic is
active and I have 4 at 4 minutes for activity in that so our my
main concern it Bonn Ricote is Ariel objects when when building queries is just build so many Arab objects Errol node objects
so what if we directly building this dual strings for a and B like finds will we're parameters further very simple queries like just we're named equal some something were find by ID all in it's still not
published but it's almost routine and that the product is called every nite but what happens at the at at the so this is the of
implementation the example like if the fines call exempts some like on complex dramatist standard will pass the query to super Bowl further simple ones like find by refined by by the string it directly compiles the sequel query this is actually the very cheap cheap it's cheaper than compiling the on the cash I mean that
around the lake Ariel load was that was the name of the I could recognize but at on skip this part so my
next the topic is smaller presented
my advice about 1 % is never do never hit model presented because it's it causes massive method calls inside think she call for example current user presented how many method called will appear so this is the answer to I
see 85 method calls
just a years adopt presented which is ridiculous so I suggested it patch fixing this
situation but this but turns out because the rail sports same expects you not to do this back but so please please don't call the presented method on your ActiveRecord model or put something like this in an
application with that and that today the all
and I think I have no time
running through all be is
clients good this is about speeding
up the Ralph size
initializes there is this is about
don't require prides AUC tried it by but price anything in years the Jim file on this is appalled this
question all bonds of impulse into
1 directory which is currently not yet working and the
on recall using require relative instead require said it required
which didn't show any significant speed improvements like detecting order
load reach causes some have
on speed regression in Praat production environment actually I
find a phone to occurrences of
also in production in real life which happens inside track to
so please fix this error in that it that at our about speeding up
test on previously our
application took 1 minute on circles here just thank preparing the schema insert same 600 tables into schema on migration so I change this
to this 1 single query
which makes In our case like upon 600 times fast passes on this is all already
committed into real spike the so it's available in response on to become the best at
this the get some slope parts an active
support like multibyte time zones so I
multibyte it consists of multiply charged in more when you code and lows the whole you database prison 8 which sits inside each active support library but especially need this I'm not sure and I suppose at least we Japanese them use this that so we can just remove this In our case and make the framework smaller and make the boot time passes the and the next 1 is
time with and so he is a benchmark for a time versus time with so in
the result is time with his
own as 25 times lower than the built-in time so the
fisher you don't need tough time itself users can replace your Thomas his time I mean if you want 100 per cent sure what is doing on we can also
boost some slow parts of rails with C extensions here are some examples like
she's EI CGI escapist e-mail as planned filling in different axes some of these are already introducing some recent version of Ruby so please just use neighbors in the
review which folding due the speed sovereign this summary the conclusion
on so there is really knows 1 single performances on like bottleneck for everyone for every rails education some
maps might have 1 for the models from amps might have 3 thousand thousand lines the role Ta b and the ball links will change so In another union
rails democracy which is nice but in some cases we want to customize certain points of trellis framework maybe what we
need is this more flexibility like murder use have so there remains
so many like slow parts in rails and they can be more like on alternatives to be used parts of rails so I would suggest to but main trails more flexible to be like murder a little bit and I hope everyone will ever and here too reveal your hat and bring more point modularity diversity into the rails community the interval
thanks thank the this was my minimum was my in my book
Beobachtungsstudie
Patch <Software>
Sichtenkonzept
Gewicht <Mathematik>
Punkt
Rechter Winkel
Automatische Handlungsplanung
Computeranimation
Ruby on Rails
Computeranimation
Web Site
Lineare Regression
Kartesische Koordinaten
Computeranimation
Internetworking
Teilmenge
Ortsoperator
Open Source
Formale Sprache
Gruppenkeim
Programmbibliothek
Projektive Ebene
Computeranimation
Subtraktion
Wellenpaket
Rechter Winkel
Gruppenkeim
Verkehrsinformation
Computeranimation
Resultante
Total <Mathematik>
Formale Sprache
E-Learning
Vorlesung/Konferenz
Computeranimation
Web Site
Vorlesung/Konferenz
Software
Kartesische Koordinaten
Messprozess
Computeranimation
Soundverarbeitung
Rechter Winkel
Reelle Zahl
Browser
Programmbibliothek
Systemaufruf
Kartesische Koordinaten
Stapelverarbeitung
Netzadresse
Computeranimation
Benchmark
Forcing
Computeranimation
Resultante
Zwei
Statistische Analyse
Programmbibliothek
Speicherabzug
Modul
Computeranimation
Teilmenge
Resultante
Zwei
Iteration
Computeranimation
Benchmark
Bit
Stoß
Speicherbereinigung
Computeranimation
Zeichenkette
Freeware
Rechter Winkel
Gefrieren
Ordnung <Mathematik>
Systemaufruf
Computeranimation
Benchmark
Zeichenkette
Formale Sprache
Skript <Programm>
Computeranimation
Software
Mereologie
Profil <Aerodynamik>
Zellularer Automat
Schlussregel
Code
Computeranimation
Benchmark
Mereologie
Programmbibliothek
Kombinatorische Gruppentheorie
Gerade
Computeranimation
Middleware
Hook <Programmierung>
Stichprobenumfang
Systemaufruf
Zahlenbereich
Punkt
Systemaufruf
Computeranimation
Subtraktion
Systemaufruf
Indexberechnung
Kartesische Koordinaten
Systemaufruf
Physikalische Theorie
Menge
Computeranimation
Puffer <Netzplantechnik>
Spezialrechner
Softwareschwachstelle
Maskierung <Informatik>
Mereologie
Informationsmodellierung
Computersicherheit
Gruppenoperation
Mereologie
Systemaufruf
Zellularer Automat
Extrempunkt
Computeranimation
Keller <Informatik>
Gruppenoperation
Resultante
Middleware
Ordnung <Mathematik>
Systemaufruf
Einflussgröße
Computeranimation
Richtung
Mereologie
Gruppenoperation
Meter
Default
Computeranimation
Bildauflösung
Puffer <Netzplantechnik>
Punkt
Sichtenkonzept
Browser
Maskierung <Informatik>
Gruppenoperation
Mailing-Liste
Computeranimation
Zeichenkette
Retrievalsprache
Abfrage
Resolvente
Implementierung
Physikalisches System
Elektronische Publikation
Dateiformat
Rendering
Verzeichnisdienst
Template
Computeranimation
Implementierung
Lineares Funktional
Caching
Festspeicher
Minimierung
Implementierung
Dateiverwaltung
Resolvente
Kartesische Koordinaten
Paarvergleich
Verzeichnisdienst
Räumliche Anordnung
Default
Portscanner
Computeranimation
Resultante
Versionsverwaltung
Benchmark
Default
Computeranimation
Benchmark
Puffer <Netzplantechnik>
Arithmetische Folge
Template
Vererbungshierarchie
Partielle Differentiation
Implementierung
Partielle Differentiation
Tropfen
Kontextbezogenes System
E-Mail
Computeranimation
Implementierung
Portscanner
Sichtenkonzept
Volumenvisualisierung
Volumenvisualisierung
Bildauflösung
Implementierung
Resolvente
Systemaufruf
Partielle Differentiation
Template
Whiteboard
Computeranimation
Thread
Parallelrechner
Volumenvisualisierung
Partielle Differentiation
Volumenvisualisierung
Parallele Schnittstelle
Computeranimation
Einfach zusammenhängender Raum
Implementierung
Zählen
Computeranimation
Fehlermeldung
Dokumentenserver
Systemaufruf
Computeranimation
Röhrenfläche
Forcing
Template
Implementierung
Decodierung
Quellcode
Computeranimation
Zeichenkette
Softwaretest
Rechter Winkel
Kartesische Koordinaten
Decodierung
Computeranimation
App <Programm>
Default
Umsetzung <Informatik>
Computeranimation
Resultante
Prozess <Physik>
Prozess <Informatik>
Festspeicher
Gruppenoperation
Versionsverwaltung
Profil <Aerodynamik>
Benchmark
Ordnungsreduktion
ROM <Informatik>
Computeranimation
Benchmark
Resultante
Objekt <Kategorie>
Template
Festspeicher
Profil <Aerodynamik>
Benchmark
p-Block
ROM <Informatik>
Ordnungsreduktion
Code
Computeranimation
Zeichenkette
Benutzerbeteiligung
Festspeicher
Kartesische Koordinaten
Computeranimation
Faserbündel
Puffer <Netzplantechnik>
Graph
Betafunktion
Äußere Algebra eines Moduls
Implementierung
Sichtenkonzept
Systemaufruf
Computeranimation
Gruppenoperation
Zeichenkette
Pufferspeicher
Fahne <Mathematik>
Aeroelastizität
Versionsverwaltung
Implementierung
Computeranimation
Implementierung
Aggregatzustand
Zeichenkette
Virtuelle Maschine
Hash-Algorithmus
Arithmetische Folge
Computeranimation
Objekt <Kategorie>
Caching
Objekt <Kategorie>
Parametersystem
Abfrage
Vererbungshierarchie
Default
Abfrage
Gebäude <Mathematik>
Befehl <Informatik>
Computeranimation
Zeichenkette
Objekt <Kategorie>
Vererbungshierarchie
Implementierung
Abfrage
Fortsetzung <Mathematik>
Biprodukt
Biprodukt
Computeranimation
Implementierung
Eins
Zeichenkette
Standardabweichung
Informationsmodellierung
Last
Mereologie
Datenmodell
Strömungsrichtung
Computeranimation
Patch <Software>
Informationsmodellierung
Systemaufruf
Patch <Software>
Computeranimation
Client
Kartesische Koordinaten
Patch <Software>
Elektronische Publikation
Computeranimation
Faserbündel
Antwortfunktion
Ordnung <Mathematik>
Verzeichnisdienst
Computeranimation
Implementierung
Softwaretest
Videospiel
Weg <Topologie>
Reelle Zahl
Last
Lineare Regression
Biprodukt
Programmierumgebung
Computeranimation
Fehlermeldung
Einfügungsdämpfung
Kreisfläche
Migration <Informatik>
Abfrage
Kartesische Koordinaten
Computeranimation
Tabelle <Informatik>
Gefangenendilemma
Mereologie
Booten
Datenhaltung
Mereologie
Endogene Variable
Programmbibliothek
Zeitzone
Framework <Informatik>
Computeranimation
Resultante
F-Test
Computeranimation
Benchmark
Spezialrechner
Mereologie
Versionsverwaltung
Einfache Genauigkeit
Maßerweiterung
Maßerweiterung
E-Mail
Computeranimation
Mapping <Computergraphik>
Informationsmodellierung
Punkt
App <Programm>
Binder <Informatik>
Gerade
Framework <Informatik>
Gerade
Computeranimation
Informationsmodellierung
Methodenbank
Bit
Punkt
Mereologie
Äußere Algebra eines Moduls
Computeranimation
Extrempunkt
Computeranimation

Metadaten

Formale Metadaten

Titel 3x Rails: Tuning the Framework Internals
Serientitel RailsConf 2016
Teil 83
Anzahl der Teile 89
Autor Matsuda, Akira
Lizenz CC-Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben.
DOI 10.5446/31493
Herausgeber Confreaks, LLC
Erscheinungsjahr 2016
Sprache Englisch

Inhaltliche Metadaten

Fachgebiet Informatik
Abstract Matz declared that the next major version of Ruby is going to be 3x faster than Ruby But how can we make a software 3x faster? Can we do that for Rails? In this session, we will discuss the ways to survey performance hotspots in each layer of the framework, tuning techniques on the performance issues, and some actual works that you can apply to your apps. Topics to be covered: Speeding up DB queries and model initialization View rendering and template lookup Routes and URLs Object allocations and GC pressure Faster Rails boot and testing Asset Pipeline tweaks.

Ähnliche Filme

Loading...