 How's everybody doing good good good good all right like as Jeff said we're gonna talk about caching today I have to do the the obligatory ask How many of us in the room have used caching plug-in before? Okay, so about half How many in the room are pretty new to caching so you're here to learn you want to know more about about half Fantastic cool. All right. Well, we'll tailor today towards kind of both groups So just a little bit about myself Introduce myself. My name is Frankie Jarrett and I am a WordPress guy, so I've been working with WordPress for a little over a decade I'm the engineering manager at GoDaddy, and I oversee our managed WordPress hosting products, and I work Remotely so I work in St. Joseph, Missouri, which is just north of here. It's my hometown and I've been working remotely for seven years going on eight and It's it's great get to stay home with my family and watch the kids grow up and do tech So it's a different world we live in but it's very rewarding. So that's a little bit about me and Let's just ask the question. Why should we care about how fast our websites are? These are some ones that I came up with. Does anybody else have any have any ideas? High user engagement. That's probably important, right? Yeah Anybody else have any that you can think of? Do what? Mobile world. That's a really good one analytics Conversion rates. Yep. So yep time is money Yep, bandwidth costs. That's probably not a really big one anymore, but I mean it does cost money User frustration. Yep And then I just kind of said because Google cares because it's like well if Google cares, maybe I should care Okay, cool. So we kind of all are in this room because we already know that our website should be fast But I think it's just important that we kind of maybe think about the reasons why before we get into this. So Let's just talk about what caching is because I think sometimes we can Make it a little bit more of a mystery that it needs to be it doesn't have to be that hard But we kind of think well, I'll just install this plug-in or I'll go to this site And I'll type in my URL and I'll hit this button and it's gonna tell me if I'm faster or not or what I need to do But it really doesn't get down to the root of what caching is what the different layers are You keep you know, there are certain layers of caching if you turn them both on they actually work against each other So it's important to know What the different types of caching are and so let's just get down to the real root of the definition What is caching? It's a temporary copy of data that can be served faster than the original. So it's always a copy It's never making your actual site faster. That's if that makes sense It also has to make it faster if caching makes it slower than it's not caching. It's just bad So so these these are the things that must be true in order for something to be caching We're making a temporary copy of something Probably because we can now serve it faster through a different medium We can serve it faster if it exists in a different form than if we have to go crunch the numbers You know from the source so that's really what caching is at the heart of it and today We're going to go through some very popular layers of caching that you would experience in the WordPress world So these are common ones you'll hear about you would it go to a caching plug-in website or something And you would go tell me about what this thing does and they would enumerate these things But it might just all sound like Weird techno talk So today we're going to kind of get drilled down into what those eight layers are so everyone can walk away from today That's that's the goal. Let's walk away from this room having learned more about what caching layers are And then we're gonna have a lot of time at the end for for questions. So if you have questions Write them down save them. We're gonna we're gonna talk about it. So caching layers. Yeah, it is kind of complicated It can get a little bit tricky especially as I said before with layers working against other layers and so that's why it's really important that We test we don't just turn stuff on and walk away we turn stuff on and we we want to measure and understand the impact In which in which our caching optimizations are really having Okay, so first layer. I want to talk about is a thing called transient cache So don't be too afraid about the right hand side of the screen if you don't if you're not a code person I just put that up there as an example for those of us in the room that are code people Okay, so transient cache is the basic concept is it's a key value store So a key being the reference point the value being this is the value for that key And it's storage of that data and then it is going to check for changes on a regular basis And it's going to store things that may be expensive to fetch So kind of an example here is if we want to check things on a regular interval Let's say, you know, we want to check a theme or sorry plug-in updates That's my example here on the right. So we will WordPress will go ask WordPress servers Hey are updates available for these plugins, but it doesn't want to do that every time you load WordPress It just wants to do that every now and then so there's an expiration on that value It goes in fetches whether or not there's updates stores that in the database as a transient cache And then knows I don't ask for that again until X number of minutes or X number of hours Then you've got no expiration These would be things that are very very expensive to fetch like I'm going to fetch a Thousand posts from the database and I'm going to crunch a bunch of numbers or do a bunch of filtering And then I want to save that result into the database forever Until it gets asked for again in a different way and then I'm going to make a different key for that slight Alteration so there's kind of a difference there, but this is baked into WordPress transient cache is part part of her press there's a WordPress API for this and you can see we've got some Some functions here get transient set transient is the transient So if you were to look at a common plug-in or if you were to look at WordPress core, you would see These functions being used in WordPress. These are not this is not an a plug-in or something you add to WordPress. So The interesting thing about how WordPress uses this as it uses it for theme and plug-in updates like I said before it uses them even to Store file system directories Don't know if you know this but Sometimes it's expensive to go scanning directories on your disk every single request So WordPress will actually go do that once say well, here's the theme directory. Here's the plug-in directory Here's what's in those directories and it saves those what they call theme root directory To a transient cache that way it's not asking your disk every single page load. Where's the theme directory? Where's the theme directory? So that's an interesting tidbit news feeds So anytime you've got news maybe in your WordPress dashboard You're pulling in feeds, you know about WordPress news Storing those in a transient cache because we don't need to fetch those all the time and then complex mice QL queries So This would be man. It's an example. I've got an online store I've got 15 different attributes for my product and I have this super cool search feature on my website and people can search all different sorts of filters That probably translates into some crazy joins or a lot of meta Queering inside the database that that basically just means expensive if you don't know what that means It just means expensive. It's not just saying give me this value It's saying give me this value with all these conditions and my school has to take a while to give that result You can store that in a transient so you can say well get me the transient value if it's not there Okay, then go fetch it and then set a transient. That's essentially what the logic looks like But again baked into WordPress something that just kind of comes out of the box if you're a plugin developer This would be something you would use but this is more just informational so people understand that it's actually there But now we're going to get into some of the good stuff This is where we start actually talking about things that we can do as either engineers or as site owners or as Pros who have clients that we can actually do to make our sites faster One of them is object cash show hands. Who's heard of the term object cash before? Say so a few of us This one, you know can be very confusing I Remember, you know, I first came across some caching tech trying to understand, you know, the different layers of caching this one always confused me for some reason and So we're gonna talk a little bit about that today and we're gonna talk about how this is Partially in core WordPress already But how the the implementation in core is kind of just a it's kind of a halfway point It's not it's not taking it all the way there and I'll explain what I mean So object cash again, it's a key value store So we have this index of keys and we say okay Give me this key and then there's gonna be a value associated with that and again It can be done to store expensive queries to your database. Let's say on your homepage Your database gets called 15 times it has to go ask for posts Which user I'm gonna show with some widgets on the sidebar These are all calls that WordPress is making to the database to pull that content out and object cash can be used to prevent Duplication, so if you're calling the same thing twice Actually WordPress by nature. We'll just call it once Hold on to it for the life of the rest of the request if it has to get called again It goes well, I've already got that so I'm gonna display it. I'm not going to make another call That's essentially what the root of object cash is is it is Storing content that you're querying from the database temporarily now If you've ever heard of some of these Technologies that are listed below here. We've got a PC you we've got reddus and mencached. These are examples of key value storage Technologies you may go to some web hosts or you may have some enterprise Clients who are familiar with some of these things because these would be technologies Especially in the case of reddus and mencached would be Servers that you would put beside your website that would be sort of an intermediary between your website and its database And so these are extra curricular pieces of software so to speak you don't need these to run WordPress This is strictly for creating object cash that is Persistent so I said before The object cash is built into WordPress so Just a slight PHP lesson when we start a request on a web page That means that PHP is going to load from its earliest point all the way to the end and PHP is just Sequential in nature. It's just it's it just starts at the top ends at the bottom If we've heard of hooks in WordPress These are different points in the in the lifecycle of the request that certain things happen And you can hook into those events and you can say hey when this happens do this But really it starts at the beginning and it and it has an end And what WordPress will do is it will activate its Internal object cash engine at the beginning and when it's making queries it can know. Oh, this is a cashable request So if I get asked for that again, I can serve that in the life of the request But as soon as someone else comes to the site and starts another request it starts all over again So in other words that cash value does not persist Across requests it's just for the life of that request. So for the life of request you may save Three or four calls of the database But if you were able to persist that you could save that three or four calls all the time every time without having to have this Short lifecycle cash So that's where these three technologies that we were talking about here make things persistent So that means if I go to the homepage as the very first user I'm like user number one and I go to the homepage and I load up the page and it makes several calls to the database and then stores it In cash now I leave Someone else comes to the site. They get the cash copy. No call is ever made because it's being stored in one of these systems So I'm gonna talk briefly about APCU because that's just my personal favorite because it's so easy It was introduced. I think in PHP five point Five or six and Basically what it what it does is it puts everything in in a special Memory of PHP So this is something that can just be installed Everybody in this room can go talk to your host and say hey do you have APCU cash? And APCU cash is something that they can turn on and when this is running it means that the WordPress WordPress cash can be extended using an object cash plug-in To automatically just take advantage of that system. So the kind of the two steps of action are Get your host to turn on APCU if it's not already or get you on the product that has it and then be go find a APCU object cash plug-in which there are several out there on the WordPress Repository for free and activate it and then suddenly wallah your WordPress functions here for get cash set cash delete cash will automatically in Core be using the persistent cash. There's no Configuration that you would have to do of course you can if you are into configuring stuff You can go read about it and get into it, but it really is that easy So That is object cash Huge performance benefit huge performance benefit. This is just a slight example here Where we've got a WP cash get and we're basically getting an update array cool Page cash who's heard of varnish? Okay, few of us This is interesting because it goes by a lot of names and I always thought they were all different But it turns out they're all the same thing. They just I'll get called something different So page cash. It's also sometimes called a proxy cash Sometimes called an HTTP cash sometimes called a static cash for whatever reason people can't decide what to call it And it really is as simple as it serves Dynamic content as just flat HTML So if anybody any of us are theme designers or we are folks who create child themes or do any sort of Coding you're already familiar with the fact that you create hooks you create functions that call back into hooks You Understand that you can make changes to the code on the site and it dynamically changes what is displayed on the website Of course, that's the beauty of WordPress. That's why we all love it and use it It means that we can go You know into a child theme and we can change things around we can move our header We can move the post we can move things around and we know that When we go into the WordPress admin and we write a new post It's going to dynamically change the home page. I don't go in and edit HTML and put a new post in that's The nature of the content management system, but that means that our pages are created dynamically It means that PHP is really what is being parsed and outputting spitting out HTML So when I go to my browser and I open up the view source on a web page is all HTML There's no PHP in there. It's because PHP is outputting all the HTML But that comes at a cost the cost is PHP having to go through all the hooks and PHP having to spit out all that HTML that that costs in terms of performance So what does page cache do? Well, it just says that the first time you view it We're going to get that flat HTML now. I'm just going to store that HTML Somewhere in memory on disk and the next time that same page gets asked I'll just serve the HTML straight back out. I'm not going to do a PHP process and go call all the hooks I'm just going to assume that you wanted the same thing as you wanted before and I'm going to serve it back to you This has substantial Substantial performance impact. This is the kind of cache you want by the way if you have very very very high traffic High concurrent user traffic to a website. So we're talking hundreds of people coming at the same time They're logged out users, you know, they're not users who need a cookie or a shopping cart They're users who are going there to read or they're going there to view information or fill out a form Page cache is a huge huge benefit because you can serve many many many many many more people With static than you can with with With dynamic so some examples of that as I said varnish is the most popular one probably But Apache traffic server that I mean those are my two favorites varnish and Apache traffic server Squid proxy is kind of an old one some people who are really into engine X which is a type of server There's a thing called a fast CGI module that allows you to kind of flip a switch and turn on a proxy cache But this this is also very very dangerous It also means that if changes are being made To your database to your post you I you put up a new post guess what that post isn't going to display on your website until You flush your page cache or tell it hey purge just the homepage like hey, I want you just forget about the homepage You can keep the other pages, but I've just made a change. So therefore I need you to flush your cache This is pretty critical You can get into a situation very quickly where you turn this sucker on and then you walk away and don't really know What's going on you got stale content? I was talking to a guy once who he turned on a page cache and months went by before he realized that All the posts he had been writing no one could see because it was on a page cache It's why it's super super important that we understand what some of these things are so when we Install our plug-in flip a switch and it says page caching static cache. Okay. I know what that means I want to make sure when I write my post that it's actually on the front of my website While I'm logged out by the way because page caches will detect. Oh that you're logged in to WordPress. I'll show you Everything I'll bypass the page cache. This is just for people who visit your site aren't logged in don't have any cookies They're just there to view things and a lot of times. We don't check that. We don't open up Chrome and incognito mode or Firefox whatever mode is and I use Chrome and Try to view our website like a logged out user It's very very important that we do That's what you say he wow someone still uses IE good for you Oh sit to know to know what it's like. Yeah. Yeah, man, that's awesome Do what now these right? Yeah, see the use is testing for other people who are using Oh, man Yeah, so that's a little bit about page cache but I should kind of continue down this rabbit trail of why it's dangerous is that I I Was talking to Pippin before this this this talk and he said yeah Caching if you only have one problem add caching now you have to You're trying to solve it with cash. Oh, yeah, I'm getting lots of traffic But then inevitably what what what are you doing? What is our definition? We're creating temporary copies of stuff, which means I essentially have impersonators of the real thing floating around serving content to users And so when you make changes do things you could have any time someone comes to me at work and says Frankie we've got the weirdest thing going on. I'm like it's probably cash It just I mean it probably is oh man if we do this thing and we click this thing and then like oh my god But we haven't touched that in months yet because it's probably in some cash somewhere. That's always the answer No, no nine times out of ten is the answer So that just things to keep in mind when we start installing these plugins when we start Turning on caching, especially these advanced forms of cash. We have to double-check and make sure that we're not Missing something obvious when it comes to problems All right a little bit of a technical one, but a lot of people already have this on by default So actually one of the exercises we could do after this probably is go check some of your websites that you're running and You'll you could even find that this is already turned on But if you find that it's not go turn it on because it'll make things really fast It's called PHP op-cache, which is short for opcode, which is short for operational code I don't know why they called it that But yeah, basically, you know PHP is this language that gets interpreted a lot of people say PHP gets compiled If you're an engineer we can debate it after this But in my opinion PHP does not get compiled it gets interpreted It's interpreted by an engine and that engine turns it into bytecode This is getting super techy hanging hanging with me and that bytecode Is ultimately what runs your code runs your hooks run your plugins run your everything? Okay, and every time PHP has to go read those files from disk, right? It has to go Interpret that language and turn it into bytecode which turns into some sort of actual activity some rendering Right, but what PHP opcode does is it gets all that in advance again on the first call it will take oh look This is what WordPress core bytecode looks like and it'll stored in memory. I Don't know about you, but my core files and WordPress aren't changing that often I update WordPress whenever an update comes out every few months But for the most part my WP admin and WP includes in my WP settings, you know files Even my WP config I don't change these files. They're very often their core files I might change my plugins and my themes In my uploads directory, but my core files. No So all that PHP all that bytecode can be stored in memory so that every single request that comes in is getting an ultra fast pre-interpreted View of the PHP runtime and what needs to run So this is super super fast it literally is one line in your PHP and I file if you don't know what that is call your web host ask for support say listen Tell me if my PHP I and I file that runs my website has the opcode dot opcache dot and dot enable Set to one or set to on on you can do either one And if it is and your version of PHP is five point five or later Then you're already set set and you're good to go and you're gonna be fast But if that is off or not there that line and you've got PHP five point five or later Then you're gonna notice a difference. You're gonna notice a big difference. That's a This is the speed of every page load every single time well unless it gets hit by a page cache Which you just talked about so if PHP has to get talked to a PHP has to run this will make it exponentially faster Yes Do what? Yes, it's the best good. Thank you for asking this persists between requests Why because it's in memory so it's stored in memory Which unless your server restarts or you've got to purge it for some reason It will be stored in memory every request that comes in it'll persist This is server side. Yep. Yep, and it's similar to how I like to think of it similar to how APCU works It's APCU is also in memory. It's in the PHP's memory. So off cash is also PHP memory Little history lesson, so I said it's it's preceded by APC They explained the difference between APC and APCU APC was called Accelerated PHP cache. I think it's what it stands for Basically, it did all sorts of things. It did this bytecode cache stuff It would do the object cache thing we talked about earlier It did all sorts of different types of caching all kind of rolled into one. Well around PHP 5 5 Zen group had created this, you know standalone opcache that was not a module of PHP It was actually built into PHP and they decided you know what let's get rid of let's stop making APC a thing Let's just build the best part about APC Which is this this bytecode cache into PHP itself that way everyone just gets it because it's like everyone should have it Anyways because it's amazing PHP is slow without it. So let's just give it to everybody But in the process they kind of made APC obsolete. Well, then there was a group of people that said wait a second But opcode cache doesn't do object cache, which is the thing we talked about earlier So let's create a fork or a new version of that called APCU which stands for user cache So that's kind of where the split happened and that's the difference is that if you see APC that represents kind of all in one 5.4 PHP and earlier and the latest is there's opcache Which is built into PHP now and all I got to do is flip this switch And then you got APCU which is strictly for in-memory object cache For database calls. Yes Yeah, most of our products I mean my products certainly just because we do the managed WordPress thing So it's all about it's kind of tailored to forward press, but yeah, we have this enabled We have APCU object cache comes art pre-installed all that stuff Sure. Yeah, I think I have to I think they told me I had to not that I want it, but I'm sorry. I'm sorry. I'm going I'm going fast. There's a lot to cover. So Yeah, do interrupt me with questions if you have them as we go Cool any other questions on opcode cache opcache operational code. Yes about just the if you're going to get to this the strategy for requirements on what kind of caches Right Right, so with page cache like we said, this is for high traffic This is for everybody So if you are running WordPress and this is not on you should go turn it on right Yep, yeah What do you use to make sure So this is where you're going to want to make sure that whatever caching plug-in you're using if that's the route you've chosen to go Maybe that's W3 total cache WP rocket. I hear people use a lot WP super cache you're going to want to understand how it flushes its cache So you're going to want to talk to their support read their information Understand when I make changes to my website How does the cache flush is it periodically? Do I manually have to do it? Correct because you know the way to defeat cash is to flush it out the window and and but if you don't understand When your various layers of cash get flushed And sometimes you also find that things get flushed when they don't have to be flushed I mean, let's just think about this if you update a post on your website You go to WordPress posts add new and you're typing something you hit publish. This does not need to be flushed This these are php files on your disk that it's caching, right? So content in the database it has nothing to do with this So you might find well, maybe might this cash plugin is flushing opcode cache every time you update a post Well, that's actually making your site less efficient Because you didn't need to touch the files You're writing a post which saves it into the database which has nothing to do with changing files But if you update a plug-in If this doesn't flush you're gonna be like why is the plug-in doing what it did before and it acts like it's not updated Because that because something didn't flush the opcode cache So it's yeah really important. Yep. There's darn widgets. Yeah Yeah, I mean that's probably going to be page cache more than anything Page cache some sort of static cache The thing that I've actually regret not putting on the slide at all is browser cache because I think everybody in this room It's probably been in that situation where you're like hold down shift and control and hit R And then it'll be fine like you're telling a client that or whatever Or open incognito. It's because the browser holds on to so much so many assets and tries to cache even pages And so yeah, I mean page cache is probably the number one with that There might be some object cache implications because widgets are stored in the database So they're stored in the options table and WordPress if you have an object cache that's that's that's you know caching that information You and you're just going to the widget screen and dragging some stuff Well, you should probably make sure to flush your cache Because it's possible that they're they're in there Yes right, so So that's why when you are logged in all page cache should be Disabled any plug-in that says they enable page cache any system that if you were to go Have it built for you or build it yourself that uses page caching again static It's taking static HTML and just serving that it should totally be off if you're logged in You should never if you're using a shopping cart which creates a cookie when you add something to your cart Any cookie that creates a session for the customer? should bypass page cache so Object cache to object cash to for logged in users The only type of cash that I think is acceptable is this one and transient Object cash and page cash are probably your too much dangerous ones. Those are the ones that Are gonna give you those elusive weird problems and and you made a great point Which is especially if you have user generated content and like a members area or something like that I mean, absolutely not. Are you gonna want page caching? I remember. Okay. This is like terrible story I gotta tell it. So I this is like 2009 or something. I'm at this website. I Have to I have got to leave the country. I'm going to like England or something I'm like totally freaking out because I don't have my passport and I'm like, okay I'm gonna go to one of these passport expediting Websites and at the time it was kind of like new like you can get your passport in two weeks. So I go to the site I fill out all my information the site was built on Drupal and I could tell I looked at the source and And I'm like filling in my information and then suddenly I go to this login screen and a logins filled out for me and And the login was called admin I was like, this is weird Cook login. I became the freaking admin of the site Because their caching was persistent and was not ignoring cookie users. So that's an example of like omg fire drill I emailed the President of the company and told him and of course He was very thankful that I let him know that your site is extremely compromised I could see everyone's information of every customer who has ever given that you all their personal info for passports I saw it all. I was like, I can't unsee this. I have to like get out of here I told him exactly what I did to reproduce. I showed him screenshots. I said listen This is very very bad, but you can trust me. I'm no good guy Or I wouldn't be telling you right But but yeah, so yeah super dangerous, right? So we have to understand what we're doing Don't just turn on a caching plugin and walk away very very important. Any other questions about before we move on? Yes Okay We're gonna go off script Like I had one Okay, I Think this is here. Hey, yeah. Alright, so this is a so you can actually go Google this It's like Google like a PCU script or a PCU a dashboard Google that you'll find some github repo and they'll have some one single file and it's this apc.php apc.php and basically this giant file you just drop it in your site and then it'll expose a Page where you can go see your object cache every single entry you can password protect it I did not on this because it's just a test site that I use But yeah, it shows you where the fragments are it gets real technical about How the cache is being used? So this tells me how much I have free and how much I've used I can go to user cache entries I can see each individual. So here that I've got options post I've got tags post meta, which you just mentioned So this would be really helpful for you I feel like to go actually see your object cache visualize it and to go into something like this This is the just to kind of give back. This is the key, right? We talked about key value store This is the key and I click it and there's the value So that's the value that's being stored normally WordPress would have to do a post meta query to the database which would pull out a Serialized array probably which gets translated into that but instead APCU stores that key value pair in memory so that we're not making that request every time so every time we need to call WP post meta for post ID one We're automatically going to be able to pull that from memory. So this is probably a helpful tool to to check out Let me also show you another one Call opcache This is a opcache dashboard. So go Google that and this is the same kind of idea Except for opcache. So tell you, you know, which of your Which of your files are the bytecode has been pre Interpreted and it's been saved in memory If I go to also by the way, you can reset the cache from here. I'll let you flush it on your own Same thing with the APCU. You can flush it manually. So that's kind of cool It gives you some control so you don't have to do everything on code or in the command line So, yeah 492 files have been cached. Looks like they're all WordPress core files. WP includes WP settings, which is great because I don't touch those files. They never get changed I only update WordPress whenever it comes out once a quarter, whatever So great, that means that 492 of my files don't have to be read from disk by PHP on every page load You can start to imagine how fast this makes your site, right? Yes How far does WordPress go This is nothing to do with WordPress. This is strictly a PHP file That I dropped into my site. Oh right So the opcache is going to cache all files unless I give it a blacklist and say hey Don't cache these certain files It's going to just cache every PHP file that ever gets called in PHP runtime So if I go back to overview and I go down there it is there's a file called Something dot blacklist and that's my blacklist file name So if I go to this blacklist and on every new line I put a You know a path to a file opcache will always ignore it So if you want to always ignore your WP config because maybe you change it a lot You could go in and say always ignore this or I want to always ignore this certain plug-in You could go put that in your blacklist You know we're starting to get a little advanced, but that would be how you do it cool Yes That is the most truthful analogy it's so true. I mean yeah in memory You've heard of SSD drives. They're the only exception SSD is essentially using memory storage as your disk But there's a reason why SSD is so much faster than spinning disk and that's the same difference So in memory is extremely extremely fast It's made to be random access memory It's meant to be read frequently and overwritten frequently and and disk is so slow so slow And it's it's dangerous if you're reading from disk a lot. You have a high traffic site We're not just talking about your sites loading slower. We're talking about your server crashing So, you know if you get really popular or a client gets really popular one day and your sites just I'm gonna read from disk on Every single request hundreds of files Eventually there's gonna be a choke point and may not even be that you don't load that fast It's just that your server is like I can't handle that much IO so I will now crash Yes Yes, by default it does which is why I'm man. I'm so glad you asked that which is why you don't have to necessarily Go flushing this every time you update a plug-in or do any of that because opcode cache by default We'll look at time stamps on the files So it has a separate registry where it lists out all the time stamps And it knows the last modified time of every single file So when the files get called it checks its its internal Ledger, oh that that's the same version that I already have so I'm not gonna do anything about it And you can even set a time limit. I think by default it only checks every two seconds So in other words if you get pummeled with traffic, it's not hitting your file system It's on just every two seconds It might go check to see make sure that you can turn that off And if you turn that off then you're not checking the file system at all like you're not even making any file system Call so if you're gonna if you know I'm about to get I'm about to get a hundred thousand people who know my website You're probably gonna want to turn that off because you're gonna want not want discred at all But you're gonna want to remember to turn it back on or remember to flush your own opcache every time you update a plug-in Which is you're probably gonna forget But very good question that the config for that is Somewhere it's there though. Yes To have it turned on except when you know you don't need it just because Workpress does do some updates without us now. Yes, so it does. Yeah, which is why yeah, I mean like The default settings of opcache where it there it is Revalidate read that revalidate frequency every two seconds. It will check for revalidation and Yeah, it by default it kind of self-manages that way So we don't have to worry about it. We again just have to make sure we go turn on that one line Opcache enable equals one and it will make everything fast Just great. Any other questions for me move on Okay We're going to get into a little bit more familiar territory now CDNs who's heard of a CDN before Okay, lots more people cool CDN stands for content delivery network It's super cool because the whole premise of the idea is that we get closer to the actual user who's requesting The page that's the whole premise of CDN. It's not that the CDN servers are faster than your server Which they probably are but it's not about that It's about that they're distributed all across the world and that they are closer to the user So just you know goes without saying that if I want to talk to someone It's easier for me to talk to someone who's right next to me than someone who's further away That's the same thing with CDN Basically, they call it edge network or edge caching and it means that they're getting closer to the edge of the customer So if someone in Brazil is calling your site that's hosted in Dallas, but you have a CDN enabled That means that some of your assets like JavaScript and CSS and images may end up on a server that's in Mexico Mexico City which is going to be closer or it's going to be in Portugal We're just going to be closer. So those are the kinds of things that they're basically a CDN will allow you to do The other thing that's cool about CDN is that it replicates itself. So it's like zero management You just turn it on and Then it just works It just replicates itself and if someone from Asia calls it for the first time it goes Well, I don't have that copy yet, but I'll go call the copy from elsewhere Then I'll transfer that over the ocean and store it locally in Asia So now anybody else who calls in Asia will have the local Asia copy This is really important for things like images because images are huge That's why jetpack photon jetpack when they came out with the free CDN that just you if you install jetpack and activate it You get CDN Some people don't even know it exists But if you ever noticed your image URLs in your web page source change to be like WP dot whatever That's because they they're using their CDN for your images and makes things load really really really fast But some other popular ones are cloud flare which is free You can turn that on and it will not only CDN your images But also your java script in your CSS assets and then AWS has one So curry has one Akamai has one. They're all very popular so I'd encourage everyone to go check out cloud flare or jetpack if you want just images and Turn those on because those will really help your your speed a lot The other thing that's interesting though about images is that they don't change that often I don't know can anyone remember the last time they uploaded an image in WordPress and then like edited it or Deleted it but needed another image up with the exact same name. It doesn't happen that often. It happens It's not that frequent Javascript and CSS on the other hand they do change a lot with every plugin update So it's important that you understand when your CDN is being flushed when you say, hey You know flush these assets because I just made some changes to the website You're gonna want to make sure that you understand how your flushing works on a CDN Cloudflare, I know you can go in and manually just say flush my cache They even have this cool thing called developer mode development mode You could say I'm in development mode and then for three hours It will just turn off all of their caching and all of their CDN So it'll allow you to work on the site and then automatically after three hours You don't have to remember it just turns back on which is pretty cool Cloudflare and it is free Minification who's heard of minification Okay Simply put it removes white space characters from your scripts from your javascript CSS or HTML However, some minification tools can modify the code. It'll actually rewrite the code doesn't just remove white space Here's an example before I have a function Called sum and I've got two arguments number one and number two and then I'm gonna return the sum of Num one plus num two But then I run through a minification program and it turns it into function sum AB return AB because I don't need to have the letters NUM because I don't care if it's human readable I just want to make it the most efficient few characters as possible And so that is what some minification tools will do They will actually rewrite the code to make it less redundant and they will use shorthand that makes it The human readable out the windows who cares it's just just a long string of code The only the machine can learn that can read That's huge because it makes the payload of your assets your javascript your css It's being called in the browser makes a much smaller sometimes you can cut down your assets by 50% Which makes of course them load twice as fast Which is really really cool Concatenation there's not I didn't put a lot on the slide obviously Chain the contents of javascript and css together so basically what this means is I'm if I'm calling a javascript file JQuery and then I'm calling a jQuery plugin and then I'm calling some other thing instead of that being three javascript files and Three HTTP requests by the browser I just take all the contents and string them together into one file and make one request to one job Javascript file and then I just reduced my PHP HTTP request by 30% That's the general idea. Yes, I don't know if that's true but what you're talking about is waterfall you want to know waterfall views because Lots of tools give you this chrome inspector gives it to you GT metrics is a great tool That will show you a waterfall view of your site. So it'll basically say here's all the assets Here's the 27 HTTP request that are being made. There's a total size. There's a total time It took it tells you each what each one of these is what kind of asset it is that tells you this is the load time So what you're referring to HTTP to means that we can have more things happening Asynchronously and the time is much faster I don't know if that statement is necessarily true that it's faster to not concatenate. I haven't heard that It wouldn't surprise me that in some scenarios that could be true, but I don't think that would be true in every scenario. That's my gut Yes So this is nothing to do with opcash this these are assets Would not cash these these are not PHP files. These are JavaScript CSS images fonts Mm-hmm. Yep You would see all of these so if you look at your source of your web page So go open a web page open up source anything that's like an image source with a URL or Calling CSS or calling JavaScript each one of those is a request that the browser has to make to the server and each one of those has To be an individual request Potentially the one that's going to make the most difference though is page cash So the object cash is not going to make a difference the opcode cash Not going to make a difference with this waterfall view what would make a difference is page cash Because it means that we're going to be able to store Like this top one here says Frankie Jarrett.co. That's my HTML content So that's normally a dynamic page load if I had an a static cache. It would be instant HTML so but all these would be benefit benefited by a CDN and Minification and concatenation the last three that we talked about all right So we're done. We're out of video time So thank you very much for listening and I appreciate it and we'll stick around for more questions afterwards, but thanks