 Here we go low test your Drupal website before it's too late So this is a quick preview of my presentation on Drupal con global Performance summit come along 3m in the morning in Australia. It will be fun So quickly the agenda when is it too late? What is performance testing? What is low testing? How to run a load test and architecting for how loads Very quickly and some links So when is it too late? Oh right first of July and you go to it news and you get ATO system tax crashes Of course happens every year because ATO never knows when the end of financial year or a new financial year starts Also we have Queensland homeschool and started They said apparently it was Like one 300 concurrent users well, that's about right the Queensland Schools are about 500,000 users. So they had 300,000 users new serve and service new self-wells System failover in the refund rush. Yes That also affected the physical servers and physical Offices So that was a bit a Bugger for everyone who was in the office. They couldn't do anything anymore So what is load performance testing? Performance testing has several different types of testing under the hood. So first is load testing load testing Verification of the performance after under the expected peak so let's say pick load so let's say 10,000 users response time should be Maximum four seconds. Otherwise, we need to scale up or we need to rethink the architecture The stress spike testing is a bit like Everyone go to this website like the Your own personal Tax end of the year And the financial year on your website. So how many users does it take to take down your system? it's sort of application-level DDOS attack testing So next Endurance testing so how long can your system perform well under the Specific load so say we have maximum load and how long will it last so expected of course outcome is to Go for a whole day for our for two hours and so on so forth Volume testing volume testing is about the amount of data that Your web application is processing upload in huge numbers of files processing big files Loading information from huge databases returning huge datasets and so on so recovery testing is about How does your system recover from a takedown? Does it need a full? Rebuild and or can it take just One restart of the whole thing and five minutes later you're up and running again and scolability testing is if you have auto scaling or Not so automatic scaling Can you actually scale up and? Support the amount of loading so there is a lot of different types of Performance testing under here. We'll just have a look at load testing and a bit of spike testing So we'll set a bench Benchmark on On your testing pass or fail Status so say we want our system to go for at this 10,000 concurrent users for three and the response time should be three seconds And all right so before you start your load testing check you with your hosting provider a lot of them do not allow do load testing in the production environment or at all because then that's the infrastructure they might have specific if the if suddenly you'll receive a lot of your Deb application will receive a lot of traffic then their DDOS attack prevention measures will kick in and that will stop because mostly That traffic is coming from Similar environment or there will be some sort of a marker saying this is a testing Traffic and also if you overload their load balancers, it might take down some other applications for a hosting in your Shared environment so be very mindful and read Instructions of your hosting provider first if you're not in your own cloud infrastructure or your own server infrastructure Yeah, but you can have a look and create the VM on digital ocean or AWS or whatever Which? Resembles close enough your infrastructure like two virtual CPUs and four gigs or M and and see how far that will take you Right, so what do we need to run a load test step one first of all we need to Know when it fails So set up monitoring so what fails what what does it mean? CPU is out of like out of resources. You're out of CPU memory storage database bandwidth or a passion or Engine X configuration parameters or PHP or how many threads you run and so set up your monitoring either real-time right there on the server or Neuralic data dog anything else any other tools that you have Step to pick a tool So there are several tools for load testing Protocol level to and browser level tools and there's plenty of software as a service Tools available there multi-cloud the multi-region you can spin All those nodes in your own infrastructure or the infrastructure it can integrate Your monitoring tools or your CI tools and so on and so forth so they're flexible But can be really really expensive like in terms of for 5,000 users. You would pay about four thousand dollars so be mindful of picking a tool and Yes, it can get very expensive. All right, so Load testing tools the protocol level tool Basically, it's a curl request so You're just loaded one resource so it doesn't load your Ajax requests It doesn't load any related resources like CSS JavaScript or images So in access log on a passion for example You can see Those tools are using their own user agent Just Python request or Java request and those tools are there's plenty of open source and Software as a service require tools. So open source a jmeter locos gatlin and so on so forth Browser level tools a bit different. They load the whole The whole web application page if you That that you provide to it that you ask so that's good for a single Page applications and Ajax request and you can test The whole more realistically If you use a lot of client-side technologies how your website and your server will perform but because of that the cut the currency is barely minute and also it's quite Much smaller choices in terms of tooling you can get you can get the selenium of course and serve as a service you can get element for flood a or it's quite nice as well So step three Creating test script so depending on which tool you select for your load testing they They have their own Languages that you can write the test tools in JavaScript TypeScript or Python or Scala and so on they usually very simple Just go visit homepage visit search page Some view page they can get really complicated if you need them to log in as a user submit the form and Usually just hit run Select number of users you want to emulate the test and hit run and then monitor the test Execution so for example here we have number of users it starts at 50 ramping up ramping up by 10 50 users up to 1,000 users in a couple of minutes You can trace the response time as well in the real life So for example, we can see here response time goes beyond five seconds when we have about How many users is that that's about 700 users over here Yep, and Then you can see the errors are showing up in there as your Tests run on extended period of time so here we are out of connections and then there are some connection times out and Monitoring your servers your infrastructure. Oh CPU hits 100% not good and Apache is Taken over the memory of the whole box This is a very simple box. It's not optimized for anything, but it's just a test Apache workers also hit the maximum of 150 and that's why that's the throttle. So this is where Little both bottlenecks on this particular server are and check the logs. So we have a database crush here You can see the About 6,000 requests have to Didn't find the database and then we had error 500 for those requests, but then we have Successes so we need to know what exactly failed to identify that as a Point of failure and improve them So here are some tools that I used Locust is open source Python tool quite easy. It just Tell it how many Requests how many users you want to emulate and what's their amp out time and how many users Will ramp up so per second you'll say I want 100 users per second. So it will try its best to Create those users if you want to you you can Create your little VMs put Locust in it and start hitting your server even more to Actually have a lot of hits Blazemeter is software as a Service It's really nice it has a lot of reports, but it's very expensive for 5,000 users Virtual users you will have to pay about four thousand dollars so But sort of five thousand users doesn't sound that much if you're preparing for an Where you'll have millions of users. So I Wonder how much 500,000 users cost So you get the same Details How many users how many hits how many seconds response time and bandwidth and so on and Flood Ior so flood Ior I used also 50 users and I used there to The element that actually renders the whole page so it renders everything Does like a browser request So all the resources All the JavaScript all the images and CSS The interesting thing about flood Ior you can provide them your own infrastructure keys and they will Run that that's on your infrastructure. So You can pretty much have a limited number of users Yep So and after that there are a couple of things that you can do to Speed up and Increased performance of your web application besides all the standard TDNs and caching and so on So a float CPU intensive tasks to the queue system So that it's not on the same request thread as As the users requesting Check your third-party integration API request limit as with New South Wales Service they had a request limit on Salesforce Connections and that's what took them down and that also affected their physical Service in the offices where there wasn't so many people You can also enable CDNs always online or under attack so that will throttle users or give them Always online will basically cash Everything on your website. So if you are read on the website like a news website that can be really helpful Under attack that will Give users first thing is a capture so that they'll actually have to solve capture before they go on to your website If you're expecting a big event and you can pre upscale your Whole infrastructure. So you can say well, I know something's gonna happen tomorrow. Lots of users are coming in. Let's Scale to 100 to 1000 containers They it it will be cheaper to do that than to get into news And also monitor monitor and create alerts if suddenly you see a spike so that you can Manage Then come in traffic Another one It's implementing queuing system Like you have a ticket echo ticket master saying, oh, yeah, you're in the virtual queue so that they don't crash with all those people want to go to all those concerts and And if you're prepared and if you've tested your website, you'll get the good news like recent headlines Gav CMS, which is a Drupal distribution of government websites Had no downtime in recent covid events where everyone was looking for the answers what to do So there you go Thank you any questions So when you have a thousand Users that you were testing against How do you do that? How do you set that up for your site? Are you just doing like a mess create? Yeah, yeah, so for If you want to have thousand authenticated users, you'll have to have thousand authenticated users of all the testing tools allow you to Load those of course you'll have to have a white list of either a list of URLs one time sign-on URLs for this particular user And it says Okay, so you can use drush to create users You know you can write a script to create random users if you wanted is that the kind of approach Create them manually Okay, cool Alright Anyway, have fun testing your website download the Locust tool and see How far can your website go? Cheers