PyCon 2014

Tests de rendimiento y profiling de aplicaciones Python

Dan Crosta  · 

Presentación

Vídeo

Transcripción

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

hello my privilege to introduce Dan cross strong with the lead platform engineer at magnetic from Manhattan hey hey everyone thanks for coming out I know it's the end of the day but I hope that this is going to be exciting and interesting for all of you

so my name is Dan crosta i work at magnetic i'm here today to talk about performance testing and profiling but first i'd like to just give a little bit of background about why this matters to us and sort of what my experience is with performance testing

and profiling so at magnetic we work in the online advertising space we see on any given day somewhere from about you know if you five to ten percent of us internet traffic so we get a lot of requests to our servers at peak times this ends up being over a

hundred sometimes 150 or a little bit more thousand requests per second so as you can imagine performance matters sort of quite a lot to us and to our applications stability and uptime and responsiveness so that's why I'm here you guys are here either

because you've heard that I'm a very good speaker or because you care about and want to learn more about performance testing and the good news is I'm going to be able to deliver on one of those promises so here's a little bit about what we're

going to be talking about for the next 20 minutes or so I suspect that most people are working in the sort of web application space so I'm going to focus on web applications but these techniques are pretty generally applicable to any sort of performance

testing that you might want to do for any other sort of application will look a little bit at what some of the standard library offerings are as far as sort of getting profiling which is sort of in depth information about how long things are taking inside

of your application and then finally we'll sort of close the loop with instrumentation which is a real-time way of performance monitoring and then I'll describe what i call the virtuous circle of performance improvement so what is performance testing

at the end of the day it basically boils down to this you generate a bunch of requests against your application what we call load and then you measure how long your application takes to respond to those things and perhaps you care about error rates we do in

our performance tests and that's basically it so it's really just you throw a bunch of stuff at your app and you see what actually happens one thing that's really easy and that we use it magnetic that's sort of a best practice we've developed

is just will take logs from our production servers run them through a set of scripts to adapt them for our load testing environment and then just replay those logs against that load testing environment it actually jumped ahead a little bit so let me take a

step back so there's several different types of performance testing that you can do against a web application today I'm going to talk about the top two which are sort of the the ones where you get the most value and I'm not going to talk about

spike testing and soak testing although those are very interesting topics as well and if you're interested in that sort of stuff I recommend doing some research online so a stress test this is I suspect what most people think of when they think of the

phrase load testing or performance testing and the idea with the stress test is to take your application and really push as hard as you can and find the spot where it breaks or where it falls over where response times become too high typically this means throwing

a lot of requests your application may be a high degree of concurrency maybe you pick out those requests that are sort of slowest or hardest for your application to process the sort of goal here is to find out you know how much can my application do it before

it totally falls over this is interesting and this can be exciting especially if you're sort of stress testing someone else's application that can be a lot of fun I actually think that it's not the most valuable sort of performance testing that

you can do because almost by definition when your application is breaking you're not getting a very good picture of what's actually going on inside that application so the thing that I do recommend is to to use a load test and the difference between

a load test and stress test is that in a load test you're generating some specific amount of load typically we will run load tests with a sort of level of concurrency and a number of requests per second that's typical of our servers in production in

some cases will use a slightly exaggerated amount of load and that sort of represents what if we got ten percent more traffic or if a couple of our servers failed and the others had to take over that traffic load tests are your sort of bread and butter performance

tests they're really good for capacity planning and for sort of learning how your system performs and as we'll see it sort of fits in with this performance improvement cycle that we can get into so a few other best practices that we've developed

a magnetic over the past couple of years of doing this I hope these are obvious but I'll just state them for the record anyway so you want to isolate your performance testing from any external influences that you know about and that you can reasonably

[ ... ]

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