Symfony Live Portland 2013

Elevando la caché de Symfony a otro nivel

Alexander Mols  · 

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

hello you hear me yeah so welcome to my talk cashing taking caching to the next level it's a bit of an experience-based talk about caching at my previous employer some people might know me as a sm 89 from github or RC or as i am a zune 80 89 on twitter

I'm Alex animals i'm from the netherlands so it's actually midnight over there right now so i'm a bit tired in my free time I try to be a good husband and father I'm finishing my master's thesis and I work on quite a lot of open source

projects like core maintainer of of doctrine working friends of symphony and some other things in the netherlands i work for dead startup called Kennedy calm we're trying to change the recruitment market if you have anything to do with recruitment or know

someone who has something to do with recruitment check it out but I'm to talk about to talk about cashing so I'm non-native English speaker so when I went on searching for definitions of cash it was actually new free and I found out that the squirrels

actually the king in animal world of etching and it can be a pretty big catches in the winter and of course also do kashi thing today Stardust startups companies king but finally found the Wikipedia definition cash being basically means value see that computed

earlier or duplicate to know value art store elsewhere my friends really flaky should repeat that yes I should talk to this thing yeah okay so they'll use have been computed do it POW maybe yeah so again values that have been computed earlier or duplicates

of original values that are stored elsewhere and that's usually what you do with caching and why would you do it two primaries it's for us we're less server load because you're trying not to hit your your back-end and more speed in terms of

less latency for your user etc and maybe you've heard about the Amazon case but actually measured the impact of site loading speed etc on what their users did on the website and they found that the foster websites equals more happy users this is really

smart guy Steve others he found out that eighty to ninety percent of the end user response time is spent on the front end there's something I'm not going to talk about today I'm some of the assuming you're already doing stuff like minifying

your assets combining them G zipping them sending appropriate cache headers using cookieless domains for your images and CSS etc but as you note may not there still ten to twenty percent left in this statement and we wanted for ourselves what if we can take

the 100 millisecond server response and bring it back to 10 millisecond responses then and then there's also web applications that serve rest api stand there is no front end so no front end user experience but it's only back end my talk will cover

roughly three three subjects web application I'll tarts furnish and in the browser so web this part I want to show you what kind of caching is already happening in there are you aware of it and we're working to improve tiny bits and things we saw over

at heart rather than phone so basic web application usually looks like this if user since we press the web application and then there will be a response we will request coming in then there will probably be some authenticating and authorizing you will hit

the controller this will do some business logic gather some data plus is to view and in the end there will be a response to your user well if your sim of your using symphony for example the full sec framework one of the things the request flow will hit is

the route nature I'm not sure who in ears using symphonies framework okay have you ever look who never looked in the app cache directory well not too many but if you will look in there in the production environment you will actually find that there are

a lot of PHP class in there so what's it actually does is route matching it's usually quite a slow process if you are trying to do this all from a memory array of routes etc but it will actually have a compound class that's a few thousand lines

big depending on how many rats you have that will sequentially walk through all the routes you have and match the appropriate one then there's also the container I think most of us used it we saw also compound to one big beach peafowl of a few thousand

lines of code and if you're using twig and you open this directory you will also see things like about tweak templates that in the end are just PHP classes so these are caches in your application I think you should really check out some Sunday just to

see what puts going on there and be aware of them because when you're caching and the strange behavior can be because of the Keshe know so if you are using an RM there the metadata cash the result cache a query cache a sort of kissing going on if you for

example use doctrine use dql in your production environment the DQ l perry will only be rewritten to SQL once and then cashed instead of doing this parsing etc every time because this is quite heavy this means that you should be aware of this and for example

use parameters instead of inserting IDs or whatever in your queries because then the string of your query will change every time you do a testicular carry and doctrine will have to parse this every time and every time save this in your memory one example of

the earlier things we tweaked at hardware that info was this I think very simple SQL query we just select all from news we're publish is smaller than date with a parameter and this will be in your mask you'll carry cash if you're doing things right

and what we did was not bad because setting dates to the current time it's only showing that news articles that are currently published what's quite sane but what we saw is that we didn't hit the MySQL query cache as often as we'd want to because

the query cache will change every second for this specific query so one small optimization we did was introduced around that time so which would always round to the time to two minutes because we didn't care about the news article coming online on the

[ ... ]

Nota: se han omitido las otras 3.093 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.