 I'm not going to do a long introduction but last session of the day is going to be by Andrew and he's going to tell us something more about Walker Marsh so I'm very interested to hear what he has to say. So Andrew, take it away. Okay, hello. I just want to check at the back, can you hear me? Perfect. Okay, I'm going to start with a little story because it's the end of the day, bit of a graveyard shift, so get some interest going. A long time ago in a city not far away, well Amsterdam, about 2006, I was the founder of a company that's become quite famous in the Netherlands. That was PriceWise as we named it at the time, which has become PriceWise and they make the worst adverts on TV. I'm sure you've seen them if you're Dutch. Well, like most things when you do a startup, you know, you tend to spend far too much money. Things are taking a really long time and you don't really have any success. In fact, we started getting a tiny, tiny bit of visitors at the very, very end when we'd run out of money. We were getting really scared. I mean, really scared. We had over half a million invested. Like, what are we going to do? We were advertising people coming to the site they weren't buying. So, what persuaded the CEO to do was to make a report. Oh, yeah, there you go. Mountain of Cash taken too long. Every project. And the report was really simple. Just compare the energy cost of last time versus this time. And so we could say what the percentage increase was. Nothing spectacular, not by today's standards with reporting, but it was enough. And we gave it to the Dutch Bureau of Statistics and they took it to the Toyota camera the next day. And they discussed it in the Toyota camera and the next day, the telegraph put us on the front page because we had made this report and they were astounded at the price changes. It's not like today where we see price changes all the time. And we went from this much traffic to that much traffic overnight. And it continued because the next day the NRC, they did it and then the Voltskrant did it and so on. And so it kind of ended up being a consistent run rate. And when we built the servers, when we built the system, we had no idea how much it would take to be able to support that many people. In fact, we never thought we would get 50,000 visitors in a day. It was just beyond our scope of imagination. But luckily it all hung together and worked really well. We in that first week basically covered most of our investment. So what I'm trying to illustrate here is you go viral, it can happen and it better work. Luckily it worked this time. So my name is Andrew Killen. I'm also the lead admin for WordPress hosting group on Facebook. So if you want to go and ask questions about hosting, go and search on Facebook. You'll find a group of about 20,000 people and they'll help you. And I also work for Aserbo. We say that we're the fastest host in company in the world, but we've also got the stats to prove it. Yeah, everybody says they're the fastest. Of course they do. That's marketing for you. But if you want to talk statistics and all the rest of it, then we can prove it. What I do for them is look after all the products that are for our customers. So we've got an optimizer tool that helps to improve the speed and stuff of WordPress. We've got also lots of things that work on Cloudflare to do better CDN, better this, better that. So that's my kind of background. Oh, and I've been doing this stuff for the web since 1994. So I've got a little bit of experience. Don't worry. It's all up here. So if you just go to GitHub, you can find it's one of my pen repositories. It's got a link to this presentation. It's got links to all the things I talk about today. It's got another instructions. It's got a spreadsheet. So if you want to play along with what I'm doing, you can do it. You don't have to take photos of every slide. It's already there for you. So the facts. To me, this is not boring, but I think there's only two or three major highlights. And I can't use this because, oh, here we go. Let's see. No, man. 57% of shoppers will go international. So we're Dutch. We can take people from other countries. They'll do it. Okay, I suspect that's more talking about AliExpress. But hey, shipping is the biggest problem and taxes. That's main taxes. I'll be America. A complicated checkout. Yeah, they're problems. Mobile abandonment for cards is 84%. But none of these really talk about performance. If you want to go and see all of these kind of stats, there's a link that goes to Forbes. They've got a whole article about it. So for me, there's two big stats, though, and that's where commerce is 29% of the web, and mobile devices aren't really working that well with e-commerce right now. So doing things to make that better would be good for everybody. This is what we want. This is our goal. This is where we want to be. So if you're clever, you've already done a bunch of things. These are all that kind of front-end work or standard stuff that you're going to do. So Lighthouse with Chrome, you're going to go and check what's the problem, and you're going to get a report, and you're going to work from each part and fix them. And then you're going to look at the server logs and see what PHP is complaining about, and you fix them. Slow logs from MySQL, same-same. And then you check the browser console and make sure you've got no JavaScript errors. You've chosen all that web theme. You've got the latest plugins. You've got all the latest versions. You've done everything that you think you can do. And this is kind of your standard starting place. Okay. Before we go on to what will help, let's talk about what's not necessarily true. People tend to think that PHP memory size will make your website faster. So if you've got more memory to give to PHP, like 500 to half a gigabyte, it'll make it faster. This is not true. It just means it'll be slower when it fails. What's happening is it's going to use up all that memory to try and do the processing before it fails. So in fact, if you can reduce that memory size as much as possible, it will fail quicker. So in fact, smaller PHP memory is better. It's not always simple to get there because not everybody's code is great. Some people's code is very hungry. And you just need that to make even a good bit of code work. Post-revision to make it slower? Well, not really. If you've got a well-optimized database, it'll be okay. But you should think about it in a sustainability sense. Why say 50 revisions when I only need the last three? So let's just keep it a bit uncluttered. It's not changing performance though. HX cart fragments are slower. We don't hear this often anymore, but I still hear sometimes. If you're working with CDN doing raw edge caching, you definitely need HX cart fragments just to make it fast. It's very common that people will say the front end and they'll try and fix it there. We've already covered that. And if it's still slow, it's got to be the server. Realist fixes everything, or Redis, if you prefer. It definitely will make the back end slow faster. It definitely will help in certain places, but not all the time. It's not a pass here. It's not the ultimate goal. It's not the ultimate fix. And so we begin. We've got a bit of a level set. We want it to go fast. We're going to ignore the meffs and the way we go. So first things first, you want to make sure your database is using the right kind of tables. It probably is, but just make sure. And then also set the right indexes. You're going to need something to deal with the autoload of the options table. So that everything that's autoload equals yes is found quicker and loaded quicker. Simple as that. It just reduces the time. It's for every single time that WordPress loads. And then meta value. At the moment, there's an index on meta keys, if I remember rightly, but there isn't one on meta value. So if you have to find all of the prices that are under a certain amount, it's going to take longer if there's not an index on that meta value. So if you want to speed things up, always do that. And yeah, Unix Cron is way more reliable than the standard WP Cron. The one from WordPress, the standard, it needs somebody to come to the website to trigger it. And if no one comes, nothing happens. And sometimes there can be a lot of activity it needs to do when that first visitor comes, maybe after a day. And it's got to do all sorts of work. This will really slow it down for the customer. So if you set up the Unix Cron, it's very simple. Then it will then every minute or every five minutes, go and check if there's anything new to run with or without a visitor to the site. And if you want to help with these bits, the Optimizer plugin, Certbo Optimizer, will just do it for you to push the run. I know it because I made it. Well, actually I'll maintain it. Somebody else made that bit. So if things are going really slow and you can't work out what plugin it is or whatever, you can use Query Monitor. I'm going to show you Query Monitor very quickly. Let's see. Okay. This is where I need my glasses. So, as you can see, here's Query Monitor and what it will do is it will look for everything and you can see from the timing over here how long it's taking. And it will show all of the bits and you can focus in on whatever plugin you want or whatever part. I can see which bits are taking longer and I can do that for any plugin that I've got loaded and see exactly which Query is taking longer. There is often surprising duplicates or surprising queries. Often when there's an update, there might be a problem where they haven't tested it fully and something slows down and you might want to revert to an older version to keep your speed. So this is a really handy tool to make this happen. We've got duplicates all over the place from payments and automatic and all sorts of other people. So, Matt, your code's not good enough, mate. So, yeah. Taxonomies. It's really easy in WooCommerce to forget to use taxonomies to set values or attributes to the singular product rather than thinking of a group of products. It's just like, oh, I have a pair of shoes I'm selling and their size 42 and a pair of shoes. But really, what I should have is a whole taxonomy for shoes. So, for example, with shoes, maybe I want the brand, maybe the material that's made with, the sole, the target group, like male, female, unisex, children, whatever. And so it would be much easier to work out, give me all of the Nike shoes for men that have leather would be free taxonomies to see if something is existing and all three of those, rather than looking at all of the data and going, oh, is there something with this and with that and the other thing? And not forgetting that the product attributes, when they're put in by hand against the product, they're actually then serialized so they're harder to read again. So, having a taxonomy is ultimately faster. It really speeds things up For example, I have a product I want the first 24 of it published and it's relationship is answered so it must be in both of these so it's in Nike and men and it will show me the results of that. So that's a really quick way in comparison, then searching for all of the post-meta looking for something that might or might not exist. Okay, next step it's a good idea to let other things do the work and offload some of the effort so that your system is focused on making sales because that's what you want, you want money. So, get yourself a CDN there's a handful that are recommended there. I recommend personally a Cloudflare I've used Fastly and QCDN before the good products I've not used Bunny, but yeah Cloudflare for me works. Security, this is why I like Cloudflare because it's not just a CDN it's also security it's also this, it's also that which kind of helps you could use security, various others image crushing just to make your page loads quicker again, Cloudflare so I've got three things covered by that already there's an element there called polish that will make the images smaller as it dynamically loads the page and will convert it to WebP as needed so you don't have to think about those kind of things there are four problems resizing oh my god, Cloudflare again you can resize online as you're sending the page to the client and make all of the thumbnails make all of the other bits by actually having to create those images on your server so that can really speed things up yeah, image stores you can store stuff outside of your server where this is really incredibly handy is if you're planning to move from one host to another and you've got like 100 gigabytes of images if they're already somewhere else you can just focus on the code base and the database for the migration and not have to worry about this mountain of images that you're going to have to deal with and they just stay in the same place and you get no disruption of service at all product feeds I really like a product here in the Netherlands called product flow ironically it's made by a friend a former colleague of mine but what is nice about it is it connects via the JSON API checks what you need what it needs and then it will put it straight into Blocker will put it straight into Bulpentcom all of those other names that you know in the Netherlands plus everyone's like the feeds into Google feeds into Facebook or those kind of multinational ones and yeah it's a very simple product and it costs literally no power on your machine because it's not doing it there it's doing it elsewhere yeah well you're not going to video host on your own machine I hope and search Elasticsearch is possibly the best one for e-commerce but Algolia will also do e-commerce quite nicely and they will host it for you and you can make incredibly fast home pages which have kind of user generated user metrics generated content so somebody comes from your site you can look maybe which country they're from and then deliver something else based on the search that you make to Elastic and create a different home page that can be very fast and very useful and all of these things do stuff about it happening on the server so your server is focused on product sales and nothing else okay so one of the biggest problems I see from talking to people I'll use something like all in one import pro and they'll add all of their products using it great and then they'll try and use it to update the products pricing stock values all sorts of other stuff and this can take several hours I did it once with a friend they had a Vita XL Vita XL feed there were 70,000 products and it took six and a half hours to go through all the products which was a bit slow so I worked it out with them how it worked basically downloaded well it's XML from them but I could use JSON or CSV downloaded that using CRON on an hourly basis so that is faster than doing a PHP because Unix doesn't have that extra overhead and then I'd start to process the updates a little bit later so give it enough time to download the thing so this could take I don't know two seconds but give it a little bit of time and then select from the database the information I want to check in this case I'm going to use the price as my example so select all of the products I have and get every skew because that should be unique every post ID so it's in the post table and the price so there we go that's my result that I want to have so post ID 5 and then I get the contents from the feed and set it up with an array where the skew becomes the key and that means I can really quickly see if that skew exists in the feed I don't have to go and look through the whole feed each time or run an expensive query each time the data's been processed to make it really accessible so I can go okay if this skew exists and the data the price has changed then I'm going to apply the change using update post meta so that went from six hours to about 12 minutes I think today with the current processing this would take more like 30 seconds if not a little bit less for 70,000 records and the database that they had they had a little over 10,000 products that they were using so there's 10,000 skews in a nice little array and then I loop through them all I have from that get repo there's a link to just example of how to do this so you can go and grab the code do it yourself so yeah this can take away a measurable amount of time and also processing if your server is really busy doing something else there's no product for you okay anybody who's on a computer studies degree would know this there's two really hard things in computer science cache invalidation and naming things if you've ever tried naming a website that would be one okay so there's a bunch of events that happen on your website that cause cache invalidation or purging and we've decided we're going to have a CDN that's going to change so it's not crud because we're not reading it's just create, update and delete every time that's happening we need to tell the CDN hey this is gone this has changed and that can be from metadata comments taxonomies reviews or schedule events or whatever else you've coded okay so yeah there's a bunch of different strategies you can take and they mostly have problems first one is you're just going to clear the page URL because that's the only thing that's changed well that's okay but on the homepage maybe the prices hasn't updated or that review that you've just got in isn't showing or something else so just getting rid of the page URL isn't good enough most caching plugins will get rid of the entire domain we're just going like everything but that's got problem because you get rid of all the CSS or the images or the JavaScript and everything else you might have on that website plus it gets rid of every single page so everything gets to be processed fresh and new meaning that your service is going to be constantly busy just creating the same thing time and time again and that's not ideal so maybe you want to do the page URL and all the related URLs okay let's imagine that I have a shoe shop I love shoes obviously and I have the main chapter many of shoes in product categories so the first level of shoes the next level is I don't know boots and then the level below that could be short as opposed to long ankle boots everything that's in that lowest category will also be in all of the other categories because they will exist in the pagination of that product group so obviously the shoes product group will have everything that's boots it will also have sneakers it will also have everything else and that could be with well let's say there's 900 products and you're doing 9 items per page that's 100 pages of pagination simple as that so if you've got that times by lots more products and lots more subcategories you could end up really quickly with 10,000, 20,000 pages that need to be purged to make sure everything's up to date I've got a little spreadsheet that I made for this okay so one second so let's imagine I've got 1000 products and I've got 9 products per page and I just used two tax synomies that are public so that's category page and the tag page and let's imagine that I'm just putting 6 tags on each product I'm going to end up with approximately yeah 34 seconds of purging for only the HTML now that's if I'm purging 30 items per time which is what Clowflare allows if I was only purging 1 URL per time that would take 17 minutes just to purge that many products and that's not what you want you want your products to be instantly updated so the answer to this in fact is a thing called cash tags which is slightly different in the way that it works so yeah page URL plus cash tags so I'll try and explain what cash tags do and how they work actually here we go that's the idea that if something's in this lower term it's also in this upper term and it belongs to the whole taxonomy so we have these buckets and they get named so shop will be the shop page RSS feeds could be all of your RSS feeds could just be the singular homepage product category close it could be product category shoes could be product category cars it doesn't matter and I have a product tag called sales product now let's imagine I have a URL for a jacket that I'm selling I'd want to put that into the category close I'd probably want to have it in the category jackets winter yas and whatever it's going to be in there many different categories so each category ends up with his own bucket I also want it to be on sale at the moment and I also want to be part of product so when I empty that bucket all of the URLs that are contained are purged in one go so this bucket could hold millions of URLs and if I want to update all of the sale items I've just changed my pricing so it's no longer 25% off it's 50% off it would just be one request to change all sale items in one go and that will obviously improve speed dramatically so your service is not as busy talking to the purging agent and also your caching is just updated instantly so from the cash tags is there more complex to implement it's in server optimizer but you end up having to have the enterprise versions of whatever CDN you need so whether it's Fastly that's got it, Bunny CDN's got it Cloudflare's got it they all have this capability but it costs more money so if you're a big site this is going to be really handy so a website visitor is coming in from this end and in an ideal world they're going to hit the CDN and come back again so it's like 20 milliseconds to make the page but then they could have to go here maybe there's a reverse proxy depending on your hosting and then it comes back so that depending on where that is that might be 100 might be 200 might be a second then we maybe have WordPress transients that control the whole page it gets sent back but eventually it could come all the way back to here where it has to actually create the page afresh and then gets sent all the way back again when you're judging the performance of server you don't really want to judge the performance of all these caches they're all very nice but they don't show what it costs really to make the website work they show what it costs the second time because the first time you need to build everything and then you can show the cache if somebody comes along that's totally fresh totally new looking at a different page none of that works it has to come all the way back to here and start again and create a new page so the thing that's most important is to make sure that your site is fast without caching and then add the caching to make it better so how much can your server handle one way work out the time taking a display of a non cached page I'll do this with you in a minute there's also in the spreadsheet it shows you how to do it so we work out the number of CPU cores divide that by the average time to request a page in seconds and then we can get the maximum page request per second so let's have an example on my server you can probably just see it I've got 64 cores it's just a test server it's an old thing but I've got 64 cores so it's slightly more capable than most vps's that people buy and if I plug this data into the spreadsheet I've got it in seconds or milliseconds for your advantage and so I have oh there it is 64 cores now I'll test the site that it is so and notice that I put something it doesn't matter what it is what that's doing is just saying make a new page because no one's ever been to this exact URL before so I can look at the page and away we go network I'll just change that a little bit so we can look at the okay so on the URL page if I look at timing I can see it's gone wow that's really really slow today it could be that it's going to be faster the next time so I'll try again because you want your aggregated score so this time it's only 271 so I do this like 10 times and let's just say that my tests over 10 times say aggregate or average to 350 so let's do 350 and now the last thing to check is the number of milliseconds between clicks so 750 would be three quarters of a second we could say it's every one and a half seconds if we want and if that's the case then my server could handle 16,458 concurrent users or requests per second that should say second but if I only had two cores I could only handle about max users per second or max requests per second so looking at this you can kind of gauge how many times people come to my website and what I really need to buy and for those that are thinking about VPSs don't forget it's also a shared server there will be other people on that same processor that might every now and then take a little bit more processing than you have so it's it can be problematic if you're looking to have really performance systems obviously if we were a slightly slower website I've got some examples here so for example Fluffy I looked up Netherlands based weird commerce sites last night and somehow this is in the Netherlands so again I'll check it and I'll do it two times just to get a bit of an average so 720 798 so I'll say 750 so if we had a mad rush I'd only two processors a bit more if you had a mad rush you're opening a new concert tomorrow and people were desperately trying to buy the stuff it would fail if 2,000 people in a second tried to do something it's just as simple as that it's a very simple mathematical equation that we've been using for years and you can use it also it's just the way it is and like I say the spreadsheets here you can get it from the Reaper so number of cores, average time so max page requests divide by 60, click frequency of users number of simultaneous users so I've actually put both of these into just the one spreadsheet rather than splitting them up you can go and look at the maths but it's all there to do both of these stages in one go so yeah, if you're going to do a concert get a load of cores as I said don't cheat to cash busting and don't do it in anything but incognito stuff on your PC might skew the results oh no cookies the killer of performance let's see if we can get a little bit forward so one of the problems that this website from Fluffy has is that every single page loads, I won't show it every single page loads a new cookie, html cookie sorry, htp cookie that checks the GDPR status ridiculous because you cannot edge cash anything that's got a cookie being set in it so it has to wait for a future time when there's no cookies being set before it can cash that page so keep an eye on cookies and anything that's being set up all the time a classic example that breaks caching is when I go from one category to another it updates a list of categories I've visited as a cookie that can really kill your caching okay scale up or scale out vertical versus horizontal scaling scale up is pretty painless scale out or vertical more systems put together is a whole lot of problems this is what I used to run so I had a load balancer a number of web servers we had something to do session management, an NFS drive an object store which was memcache and then a database cluster and just the effort of getting other developers to understand this was massive and simple little things like you want to update a plugin, if you update the plugin and you happen to be on this server it's not updated on that server so you have to then start doing definitely get deployment, CICD you have to push things simultaneously you have to do all sorts of extra stuff that is just possibly hard for a lot of people so my honest advice don't scale out it's just painful you can, but just expect problems ones that you have never seen before because until you start working at scale yeah so what hosting should I choose I try to make a simple flow chart do I want to be responsible no, I do not I don't want to have any responsibility for my hosting, I want somebody else to be responsible when it breaks I want them to rush around fixing it, when there's a problem I want them to be doing everything I don't want to have to think about it I want to be able to sleep at night and not be waiting for my mobile phone to go off but other people they want to be responsible because they feel that owning something very common with agencies they think yeah, we can have our own server but do you want to be responsible for the support and maintenance if you do then consider buying your own stuff it's on your own back I wouldn't do it but you might want to if you're an agency and you've got enough people do it what I would choose if I wanted to make some money is an affiliate program or a partner program, especially as an agency because then I can give all of the effort to somebody else and make extra money my advice is how hard do you want things to be for yourself I take the easy route because I want to make my money doing other stuff rather than worrying about computers how much shall I spend yeah I've talked to a number of hosting companies and CEOs over the years and we also got this kind of like 2%, I mean that's not much let's think about it this way if you were earning a thousand a month on your website 2% no that's nothing that's a good place to start if you're earning a million a month 20,000 on your hosting isn't actually a bad idea you have something that's more complex more capable, more supportable and honestly no one ever said I really regret buying that expensive hosting with that really caring company so golden rules focus on throughput this is especially true for WooCommerce how fast the database is how fast PHP is and how fast the networking is getting in there, getting out again host it as close as you can to where your people are so if you're in the Netherlands people in the Netherlands don't host it in America buy it from someone that's easy to contact this is something I've learned, it doesn't matter how much you pay they can still ignore you so get with somebody that you have a good working relationship with and do your due diligence especially go through the contract if you're not going to finance get a friend to come and help you it's better to go and look for it four times before you sign up and know what's coming in the next thing because some of the hosting companies do a massive increase on the renewals like free x free cost on renewals so check what you're getting into okay there is a new thing for WooCommerce it's about a year high performance order storage and it's this it used to be stored in post meta there was a new order it would add a new post for the order and then add the details in post meta well that's really stupid and so they've taken it to literally high school level database management what you get taught split things up have addresses in one thing it's obviously faster what you got taught this was not what you got taught in school but it's the way that it got set up if you're going to do it and it's very simple make sure you do it back up first because it's going to try and re-sync everything from the old orders into this new system and you know do it at night when there's not many customers do some testing that kind of stuff okay my opinions these are just opinions on the future of WooCommerce it's going to be Gutenberg already soon there will be more database expansion just like you've seen there taking things and setting them apart so they're better set up they'll be very easily adaptable rest output if you look at the rest output of products right now it's incredibly verbose and very large so the benefits of going headless might be outweighed by the cost of the data and yeah Headless WooCommerce is going to happen it's not there yet but it will happen okay next generation performance testing I'm going to quickly get this in before the end see this was the testing that came out last week WP hosting benchmarks and it tested PHP and yes that's us there being fastest thank you and yes that's us there being fastest again but I'm going to be the first one to be honest the tests aren't good we might have won it but we didn't win because we were better than everybody else but the point is the tests they don't even check the database they just do like for example it writes a line to the database and then deletes it straight away afterwards it might not even get to the disk it might still be in the cache it's not a good test it doesn't test for WooCommerce an actual purchase so we don't know what it would be like 50 people for example we're trying to buy a product at the same time so these tests although they have relevance aren't great so what I'm doing and I'm announcing this right now is I'm making a new wordpress WooCommerce hosting testing I've already spoken to a lot of the CEOs of hosting companies because I know them from the WordPress hosting group and they're going to come along and be part of this and I'm looking for WooCommerce experts who wants to come and join I have one where's he gone where's Martin have one in the back there who's already agreed and members for the supervisory board so these guys for supervisory board if you wish to be one it's not their hosting person or an expert at WooCommerce it's that you're going to be there saying oh yeah I understand this is a good test of why aren't we testing this why aren't we testing that if you would like to be part of it come and let me know it's going to be much more stringent and much harder okay that's the end of my talk any questions