 Fog ddim ystod yw 9.30 a ddim yw hwn ar gyfer allan y llwyddiad mwylo 5 p.m. Yna fydd yn gweithio ac rwy'n dechrau ar âmwneud yn ddweud y prifiddl dros, ac mae'r ddweud yn y meddwl i yw'r hiad ar hyn o'r hyn gyllidau. Felly, pa'n ddweud o gyllid ymddindwch yn y cwrss. So, ond yw'n credu y gallwn ni'n cael ei wneud drwpal yn cael ei ddweud o'r fforddol yn gweithio'r cychwyn. Mae'r cyfrifiad cychwyn yn gweithio'r cyfrifiad yn gweithio'r cychwyn yn gweithio'r cychwyn yn gweithio'r cychwyn yn gweithio'r cychwyn yn gweithio'r cychwyn. So, os os ydych, o'r ystod o'r teimlion o feithio'r cychwyn yn gweithio'r cyfrifiad. Dwi'n ddarparu amddangos i ddweud eich cyfrifiad, oedd eich cyfrifiad gwneud o gefn y reilio i'r llunio'u cyfrifiad. What you're using the versions of PHP, making sure those are all tuned. Then database, use MySQL. Use that use MarioDB, how do you tune those, to make best performance. And then finally things like content delivery networks for speeding up the delivery of images, and things like that. So we're not going to cover any of those. Ydw i, yna ychydig i'r rhodgu, parce y tîm canido i'r tîm, yn dduful ffrwng. Felly gan'r llun o'r llun o'r llun o'r llun o'r reddenau, ac y cusunio arall o'r blaen i'r cich, yn i gynnig mor shooter i chi. Ychydig i'r ddin yn credu effeithio yr hwn ar y cich? Ac mae'n dwi'n ddim yn gwybod i'r rhodw. Felly mae'n gynhyrchu kgwredu llun o'r llun i'r pwysig, yn ychydig i'r cich, y page. So any sort of pages that we look at they might be specific the same page for multiple users but that page can be cached in its own and then anything else we can think about caching. So really it's done to get into those underlying things like variables and paneled pains everything that you can cache. Now important thing to think about is how long can you cache something for. A lot of people think oh you want to cache things for long times. So you might be caching a page i'r un hwer o'r ddaf, ond yng Nghymru pob hwn yn cael ei chesyn arniwg ar wedi bod yn eich cynnig o'r un llwynt o'r 1 A yw si'n gwneud y cyfan y gweld i gyfeinio cyfroydol yn y gwneud ar gyfer bod wedi'i roi'r gwiriadau a'r ynghylchu o'r wyffynnid yw'r cyfroyd i ddaf, felly arwch rydyn ni'n golygu o'r myfyrdd sydd iddi gyrwch yn cael y cyfle, a bod os yna byw yn y wneud i chi i ddawg yng Nghymru o'r gyfer eraill ynghylch Ac ymddwch yn gwneud y gynnig, yw Scott's ffrogan yw'r rhwng inni, ac mae yn ystod y dyfodol ar y cyfu'r wneud. A'r gweithio yn cael ei gweithio. Yn y gweithio, Scott? Mae'n gweithio'n gweithio. Mae'n gweithio'n gweithio. Mae'n gweithio'n gweithio, ac mae'n gweithio'n gweithio. Ond yna'n gweithio'n gweithio'n gweithio, mae hi'n gweithio'n gweithio'n gweithio. Felly, mae'n cuddwch i'r gwybod i ddechrau'r 100 o'u gweld, felly, ddyn nhw'n cuddwch i ddweud, mae gennym 100 gweld cyd-grifennu. Felly, mae'n ddweud i ddweud i ddweud i ddweud, mae'n ddweud i ddweud o'n ddweud i ddweud. Cynnydd yma drwpol entydig, a ddweud i'r ddweud i gael yr enhyfydig ar ddweud i ddweud i ddweud i ddweud i ddweud. Lleiswyd ddau, y cachu, mae'r cach yn ei hunain i'r ent foodsau a chafio'r ent foodsau, mae'r cychelio'r ent foodsau a chafio'r ent foodsau a chafio'r ent foodsau a chafio'r ent foodsau. Rydyn ni'n sefydlu'r ent foodsau, mae'r cychelio'r ent foodsau, mae'n ei wneud addysg o'i cychelio ystod o'i wneud adeiladau. Ychydig yw'r ent foodsau o'i gain. felly fel ydych chi'n gyn來說d yn dda a'r booiion arall y cyfnod hyn yn gyfio'r newid. Byddwch chi gyd, ym môl oedd yn ysgol, sydd ychydig yn y cyfnod hyn yn ram等au. Felly mae'n llart o'r llogiorno, mae'n llogiorno gyfer y cyfieith ynghylch a'r llogiorno cyfieith ynghylch a'r llogiorno cyfieith i gydag hefyd. A phobiwn yma'r llogiorno cyfieith yn ei d mapping i'r modul sydd y modul â'r modul sy'n dod o'r modul yn ei ddweud o'r modiwyr, ac mae'r enthysgwyr wedi'i gwybod. Y ddweud y mwylo'r modiwyr yw'r modiwyr yn y ffyrddol'r modiwyr. Felly mae'n gweithio'r ddweud, ac mae'n arweinydd o'r ddweud o'r ddweud. Felly mae'n gweithio'r ddweud i'r enthysgwyr ac mae'n gweithio'r ddweud. Felly mae'n gweithio'r ddweud o'r enthysgwyr o'r ffordd o'r gweithio'r gweithio. Sau mairewyr o'r ddweud yma yn oed contractorso addysg. Llywyddwn i predicting perifeir, a'r ond phwrdd i'ch gael trwy loed. Felly mae g 물bwyllwch iddwoodd yr arwyr ydw i Dw� Dunedig, gan yw y tých fel bod cyfynion fwynnu Yma. Felly mae'n kanhwyr ei bwysig, mae'r gweithiol cyfrannol ac mae rhaid yn sicrhau ddim yn ei ddweud o'r gweithio mwylo. Felly y cyfrannol yma yn rhyme yn y ddweud o'r gweithio, is the actual results for the raw queries. So maybe you want to set that depending on how often your data is output and then the actual rendered output depending on again sort of how often you expect the queries update as well. So the query is going to invalidate the rendered output but if the query remains the same you don't need to re-render the rendered HTML again. So you might be tracking your query results more regularly than you rendered the time for your rendered HTML. So if the query results don't change don't re-render the HTML. So panels again has quite a lot of built in options for caching. So again you can set the lifetime for your panels. So this might be any part of a panel such as the panel page or the panel pane within the page. So if you're thinking about the levels of caching that we talked about you've got your view might be providing a panel pane inside the panel page or that could be inside a mini panel inside the panel page. So we're starting to build up this sort of layers of caching to find the different things. And again here we can look at the granularity so we're talking about that context. So do you want to cache this panel pane by the user or by the page that we're on or by the taxonomy term that's being referenced on the page. So if you know about panels you can select the arguments or the context that are relevant to that page and this allows you to set that granularity based on that information. So thinking about the roles and users that might be changing. So then we need to think about where we're going to store this cache data. So we've got two real choices Redis or Memcache as the two systems and both have a Drupal module for storing that data. So it's the Redis module and Redis module and a Memcache module. When you're using either of these you're going to need a library that communicates and Redis is my I've found that the best and easiest one to work with. So you've got two options a PHP Redis extension. So this you need to install in your PHP. So this is in your PHP any file or the Predis PHP library. And the Drupal module can use either of these to work with. I haven't done any testing or research to see which is actually more if there's any benefit from those you slightly quicker. But so if you can use the PHP Redis I'm not sure what the percentage difference is. So this I'll add the I think the link to these slides is already on the session on the Drupal Camlin page. So you can get to all of this information straight away. So in the settings dot PHP file for our site we want to start setting. So we're going to set some variables for our site. So we're going to look at using PHP Redis. Then we need to define the cache back end in Drupal system. So bringing in the Redis autoload. And then here's an important consideration again in what you're going to cache and how and where you're going to cache it. So we're going to set the default class for any caching to be Redis. So that's going to start to cache variables and any other data that can be caching using the Drupal cache function in Redis. But some things you don't want to cache in Redis. So one of those examples is the form. So if you're using the Drupal form. So this is any type of form. And something happens to your Redis cache. It resets or restarts while the user is using the session, particularly if they're in a multi-step form. Bangler data is gone. Whereas the database cache just has that longer lifetime to hold the data that you're dealing with in a form. So it can be pulled back up again when the page is refreshed. Finally, the Redis module and the Memcache module both provide replacement lock and path ink files. So both the lock and path can be stored in Redis as well. So that's a big performance especially for path lookup gains. So there's a real big performance boost there. So let me go look at AuthCache, which is probably the biggest module that we're looking at to think about how we can improve the performance against logged in users. So this is a nice diagram from the AuthCache module page. And it walks us through the traditional request results without any caching. So we make our request a Drupal. Drupal bootstraps connects to the database, performs all the queries, renders the HTML. And then you might have that being compressed with your server and saving that to a cache like varnish. So then output. And then if you've got a subsequent request with varnish, you're just coming into this cache here and that will be rendering the whole thing. But once you've got your logged in user, you can't use that varnish cache. So here we're going to make the request and make an early bootstrap request to Drupal, retrieve the HTML that's been cached within the Drupal system for the page, which is going to be rendered. And then we can use something like Ajax to target and replace areas of the page. So we again come back to Drupal, rootnet, perform the database queries, return that and modify the page for the output. So back again, AuthCache provides two more cache backends for your settings PHP. We're going to attempt to build a page without any database access. We want our page compression switched on, so we're going to try and compress the page. We need to make sure that we set a lifetime for the pages. So we do want pages to expire as well. So once we've got AuthCache enabled, we start to think about how we're going to cache things with AuthCache. So here is the settings that you'd see on a block. And an example that we're going to look at later, this is going to be our shopping cart block on the page. So we know that the shopping cart block can only be, we can't cache it, or in this case we're not going to cache it because the price may be updating, or the availability, we need to recheck stock levels, give them a warning that there's that item that they've got to stock. It's on a per user basis, and we're going to use Ajax to replace this item. And in this case, if Ajax isn't available, if they haven't got JavaScript enabled on their browser, we're not going to be able to cache, so we can't cache the page. Again, menus can be cached with AuthCache, and this is usually something like your user or user authenticated menu, so when you start to get your menu that says, hi David, welcome back to the site, click here for your account, that type of menu item, you can start to cache those with AuthCache, so that one bit is going to be replaced. So rather than just having that one bit and validating the cache for the whole page, you can just replace the menu item. So there's a setting for form cache, so it's using AuthCache settings, where we want to remove certain forms from being cached again, so this is back to our form issue. So we don't want to cache things like the search form, or the block form, search API, or particularly the commerce cart form, so we want to make sure that there's no confusion in sessions and caching between multiple users, and the user sees any other person's data being cached somewhere. So this is something that's going to pick out those and say, no, we can't cache these across different users and sessions. So if you really want to, AuthCache has two options that come with the module, you can either use Ajax to replace the items, or you can use varnish with edge size includes. So this is a system in varnish to, at the cache level in varnish, it takes its rendered content with a token in the page and fills in the item at the end. Now you've got mixed levels of where you get pros and benefits of doing things like that. So if you're using varnish as a service, and that is on a content delivery network, so if you've got a multinational site that's covering lots of countries, you need the caching and the ESI, edge size bits, to be as close to the user as possible. So you're getting the initial page render out to the user as quickly as possible, because what we're aiming for is to get the page rendered on the user's browser as quickly as possible. So if you only have one varnish server, you've got a multinational site, you're still getting a delay because varnish has to go back and do the callback to get the item, and then finally render the full page before delivering it out to the user. So there's pros and cons between using the edge size includes and the Ajax to replace items. Now one of the other things that we need to think about is how many items are you going to replace with this, because if you've got a page and then 10 items that you're going to replace, that actually might take longer because you've got 10 subsequent bootstraps to Drupal to fill in those small gaps. So there's a way of balancing how you can combine those areas, make sure that you're going to get the best out of the performance gain or loss that you're going to get through the different types of setup. So some other modules to think about that can benefit the Drupal site before your site's going out. Advanced CSS and JavaScript application. Does anyone use this module on their sites? Good for you. So this one's really, really quick on benefiting of compressing and combining files. I think here Google page speed, SEO tools are all picking these up as important things that you want to make sure that you're minimising the delivery time for these secondary assets. Fast 404, so here improving the 404 page amount found responses. So you're not hitting and using up server power to deliver those. Ultimate cron for back-end improvements. The first thing you know when Drupal cron runs, it clears all caches. So if you've got something that requires a cron run every five minutes, it's really bad to then just clear all your caches every five minutes. If you're talking about an e-commerce site, you're doing maybe stock syncing to some other server every five minutes via cron. So ultimate cron allows you to control all of the items in the cron queue and set them individual times. And by default, it removes all of those things that Drupal does out of the box that really it shouldn't be doing every time. This, since I did this presentation where I did it at the Lustruven camp, has now been merged into the mail system. But there's still a further improvement to come to the mail system. If anyone is using the mail system module in their Drupal site, it loads all the mail system classes at every load, and this is just putting that into a cache. So it's being pushed into, if we were using our system, it'd be one of those cache classes that now we're going into redis and so on. But it's now in the latest dev version of the module, but it wasn't for a long time. So I've built with a site that we were dealing with, and this was the slowest query on the page, every page. It added something like a 10 millisecond query to every page. So all of these things add up. So my live demo, so I quickly this morning rebuilt this because I deleted it from last time I've done this presentation. So I've built a nice shot which doesn't look very nice in this. So I've built a quick e-commerce store. So here is my e-commerce store. I've got a view with our products here. I've got an add to cart on all of these. And I've got one added to my cart here. So this is Drupal out of the box with no caching or anything configured on it. So here, just to note, I've got the page speed in the network in Chrome. And I've disabled caching here. So it's going to reload all the assets that are on the page. So we're going to include images here as well. So we've got a final load time of 4.31 seconds. The DOM was loaded in 2.3 seconds. What you can see here up at the top looking at our time to load the actual page. So here we were at 1.91 seconds. Here I've got the same site. This is a different branch. And this time I've enabled all of the AutoCache modules. I've enabled all those items in settings.php. And we should see, hopefully, what's the page load improvement. So now our page load for the actual page has gone down. Here we had 1.91 seconds. It's nearly 2 seconds here to 486 milliseconds. We're less than half a second now for the page load of the rendered HTML. So we've got the view. It's set to cache for an hour. So it's caching that in the Redis DB. It's then got the page rendered through AutoCache. And if I look into the total page of 1.9, so that was a total for the whole item, you'll see here this item here is our AutoCache query. So we're going to the AutoCache modules AutoCache here for our commerce cart. So we can see at the end we're adding 610 milliseconds here to bring in and pull in the commerce cart at the end by agent. So you can see that's actually a huge difference in actual page load speed. So we're getting half the time on the page load. And most of that page load speed here, you can see that this is taking up with those images. So if we're actually just thinking about the page speed, we're going down from nearly 2 seconds to half a second. So that's a three-quarter reduction in what the time was before. What I also will do here as well. Now I don't know if anyone ever used the Blackfyre from Intensio Labs. One at the back there. So this is a tool by Blackfyre for doing your back end, seeing how that's performing as well. So there's a Blackfyre program running on the server as well. So I can profile this page. We can actually see what's happening in the background. So the queries, the PHP process flow that's going through. This batch bit that I'm trying to do should be on the free version. I don't need to upgrade. I click on here, shared profiles, untitled. I think I need to remove my other one. It says to the confirmation email as it is. Not yet. It's xhclot. I didn't actually get to testing this bit. I think, let me just try this again, because what I did was do that. Well, handily, because it could go wrong, I have screenshots of the bits that can go wrong. So this was the previous example, so I did get screenshots. So we're seeing something similar here. So there's a bit of network information here. So we can see, on my previous example, we went down from 477 milliseconds to 69, so it was even quicker. But I think the university network here seems to be a bit slower than Edinburgh University's network. And here was the black fire analysis of the two sites without and with the cache. So we can see that the time spent for the server processing the site was 571 milliseconds without the cache as opposed to 2.05 milliseconds with the caching. So the biggest thing here, you can see the processing time is going down from 538 milliseconds to 1.47 milliseconds here. The actual work of the server is going down in a huge amount as well. I think this is for the amount of DB query time as well. Oh, this is data server, which one is? That's the network. Oh, here, yes. So we had no DB queries yet, so we've gone down from 52 milliseconds to nothing because the page is all being rendered from Redis. So Drupal 8 is two great presentations from Drupal camp, Drupal con. These were both at, I remember these one, whether they were both at Barcelona, I think. So these were both at Barcelona. So this is the two sessions on, one is about how Drupal 8 is caching. So a lot of this auth cache type idea is built into Drupal 8 now using a big pipe idea and process. So this is how we can build in this tokenisation and the effects of what auth cache is doing straight into Drupal 8. And then another one looking at caching at the edge. So this is using a CDN. Or so this is, there's a lot of providers providing what we call varnishing the cloud or CDNs. This could be Amazon Cloud Front or Fastly or any of these types of service where they provide that in their caching system as well. So they have the edge-side includes or service-side includes type process in there, which works there as well. So any questions? Yeah. Memcache or Redis? Yeah. I mean, generally Redis is new, slightly newer options. So Redis, but if, I mean, there's sort of levels of benefit. You're, you know. Yeah, yeah. But another thing that's easy to happen with Memcache is some of the variables that Drupal stores are very big and the, if you are trying to put a variable that's too big for a Memcache item into Memcache, the performance then just drops suddenly down. It just doesn't fail. That's something that I've seen on site before where the item, it's normally the fields cache. So this is the list of all the fields. So if you've got a lot of fields, that one item that's getting stored in the cache, if it's too big for Memcache to store, Memcache just dies and then you lose all of your performance gains. So this, you know, pros and cons and experiences I've had with each of them, so yeah. So I guess whichever is some ways quickest to set up just to get the benefits there and then you can look at refining because swapping between Redis and Memcache in terms of the Drupal modules is not, it's just swapping the module. It doesn't affect anything else. It should be a sort of agnostic for Drupal, whichever caching back-end you're going to use. Yeah. So you mentioned early on the render cache module for Drupal 7. Yes. What does that add on beyond using hash cache within render array in D7, which is supported by Core? I guess it's trying to value something for that. I'm not quite sure what it brings to the table. I'm not sure, exactly either. Are you able to answer that? So it does that automatically. So while you would have to manually add the hash cache to the render array, it's doing it out of the box. What's it used for the parts, for the pieces, for the caches? I don't actually know. I just know it's doing that automatically for all the entities you have to find. So it's kind of looking into the core bit? Yeah. Mi. I had an interesting discussion yesterday with the final day of the first. Did you notice that, for example, on one of the news pages, the system when you log into Drupal and your authenticated user, you post a new story and it's automatically there. Is it that one second hash? On some other systems, it's been published in the article. And it's like, I see, every 10 minutes, all the parts of the core are being published because of the, let's say, the project that I believe is going to be published. Yeah. So you've got... You've also got an action of cache invalidation as well. So this is where your... which I haven't got included in that, is the invalidate module. So this is specifically to work with things like varnish and things like that. So if you're adding a new article, it will then propagate an instruction out to other services to say we've added something new. Whatever your time was on these pages or these URLs, we need to clear those because there's been a change and we want to invalidate the cache and make sure that that change happens straight away. Can we trigger, like... Yeah, it's a... David's example of one of my sites at Irvine. There's a goal in the football game. I get posted at the XML update which I emphasised into the database. And there's a couple of rules, modules, that then go invalidate the caches for those views where that score appears. So rather than clear your whole cache, I'm just clear on the cache for the live scores page. And I don't know if you were at the keynote yesterday from Piffin. We run a cycle time tyre education and when I needed to post a news article or someone comments on a news article, we don't want to clear, again, the whole of Drupal's cache. We clear. So we have some funny cache triggers so we know that that article appears in the home page news feed or a particular category news feed and we clear that. Or if someone's commenting on a news article, we don't want to again clear all of Drupal's caches. We just clear the caches for that one page. I think cache actions is the module and then there's all cache actions or all cache actions. 10 minutes. There's a cache action, there's a cache actions and then modules that go on from that. So it's fine. What is a cache action information invalidate? Yes. It's either called invalidate or that's one of the actions in the cache action module. So on time tyre education, so I work on we do an X purge to varnish which is our advantage to the service. So if Drupal still has a cache, then it's just going to get the cache. So we do an X purge to varnish and we also clear the cache key for our Drupal page. We use panels a lot and each panel has a cache key. Right. Because that's that, Drupal can clear the things but if you've got another layer of caching, your varnish, or these other services like Cloudfront or something, you need to go and tell that that it's whatever it had as well and now it's invalid because it's not going to check. So one of those items that I covered was the maximum lifetime. So if you're using a caching, a CDN service, it knows after whatever that maximum lifetime is is going to recheck back with a server to get a new version to check that the server's version hasn't changed. But what we're just doing with the cache actions is pushing that action out to say this page has changed as a stuffy reaction of that. Yeah. Is ESI without cache table used to be done? I don't know what the current state is about because I've not found that. My supply is a sample varnish config for version 3 of varnish and version 4 of varnish. Unfortunately, fastly, we can see the only use that kind of hacked version or version 2 of varnish. So it's quite complicated and took quite a long time to get that to work. But it is stable. SSI, so the NGINX version of ESI is not. But I don't think it would be too much work to do maybe. It's more about your varnish configuration than the Drupal configuration and matching the 2 up of how everyone's configured it. Anything else? You can sign up for a free version in profile. I can't remember how much the the pro version... Yes, the free one lets you do a simple profile. The paid one allows you to do more detail testings like scenarios and put in changes and run more detail tests. Oh, and it has background monitoring as well. You're getting into the new relic type realm as well. So it's doing the background monitoring. So before I recommend that you use NGINX in terms of speed. Thank you. And the second MySQL MariaDB or something else is using MySQL to speed up the queries. That's what the system that I use uses. I'm not an ops engineer so I'm not specialist on that. What I've heard, MariaDB is that I'm not sure you could misconfigure MariaDB to as badly performing as MySQL. OK, thanks very much.