Formation Mantis
Transcription
Formation Mantis
Jérôme Lepage - CFCamp 2013 Mondadori France French press magazine group (#3) Subsidiary of Mondadori Italia ~ 30 magazines 10,6% market in 2011 381,6 million € in 2012 Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 In Web Development since 1999 Php for 14 years Java for 9 years Technical Project Manager for Mondadori France Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Reason #1 : Tune platform ◦ Determine capacity of architecture ◦ Test and find best performance configs ◦ Find the “limits” to your platform Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Reason #2 : Test application code ◦ Test application in real action ◦ Unit tests are jailed and not multi-users ◦ Detect pro-actively failure or memory leak Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Reason #3 : Find and resolve failures ◦ On an environment same as production ◦ Time to (try to) reproduce failure(s) (vm clone) ◦ Analyze problem, fix it, verify the solution ◦ You won’t and don’t touch the production ! Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Reason #4 : Improve delivery process ◦ Test your application before deployment ◦ If it passes unit and scalability tests, go on prod ◦ It costs, but on high risk app., it’s cheaper than a bug ◦ If you need to do #3, you are ready for it. Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 HUMAN TESTS ◦ You need people (of course Bozo!) ◦ Heavy work to prepare tests ◦ Heavy work to train users ◦ Heavy work to get feedback from users Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 HUMAN TESTS ◦ Random degree depends only on users ◦ Closeness to reality (or even the plan) ? Who knows ?! ◦ Hard to do the first test ! It has to be short ! ◦ Don’t count on a second test ! Users get bored ! Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 HUMAN TESTS : Conclusions ◦ High costs on time, energy and money ◦ Results are not really what we expect ◦ High risk of ending up in jail for mass murder ! ◦ Only good reason to do it, is for political reasons! Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 COMPUTED TESTS ◦ You need only you and maybe some admin sys. ◦ Heavy work to prepare scenario ◦ No user to train ◦ You have assertions to get/verify results Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 COMPUTED TESTS ◦ Random degree depends only your scenarios ◦ Closeness to reality depends on you ◦ Hard to do the first test ! ◦ You can play and replay them as you want ! Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 COMPUTED TESTS : Conclusions ◦ Cost (only) YOUR time, YOUR energy ◦ Results reflect the time you spent on it ◦ You can stay friends with your colleagues ! ◦ Only reason not to do it : time or laziness Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Comparison : Humans Computed Persons needed Many Close to 1 Random degree Medium to high Low to medium Depends on testers Depends on you Medium Medium Difficulty to re-play Higher Low Time period of tests Short As you want Medium to Life Low Closeness to reality Difficulty to play once Costs (not only on money) Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Oh Yeah Baby! Come closer! jMeter Test Server Remote jMeter Client & Server on same app. http://jmeter.apache.org/ Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 It’s a Client-Server Application ◦ You need to avoid traffic from network ◦ You need to reduce impact on your network ◦ You need to reduce distance between server and jMeter ◦ Use VM on same node or Physical server on same switch Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 jMeter Client WorkBench Test Plan Make scenario / tests Test Controller Play Tests Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 #1 part : Preparation of tests ◦ You have to know the application ◦ You should know what users do (or will do) ◦ You should make small testS rather than a big one ◦ You should plan relevant tests for application Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 #2 part : Run tests ◦ You should do it more than once ◦ You should do several scenario to be sure and crossreference results ◦ You should get/save all data that you could have ◦ You have to write all your actions and results Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 #3 part : Interpret results ◦ If you don’t, you let people do it by themselves ◦ You need to say more than “It’s work (or not)!” ◦ Sloppy analysis will invalidate your time spent / work ◦ Months or years later, the context has been forgotten Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Interpret results 25% Running test 15% Creating Scenario 60% Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 manually, the boring way ◦ You have to put all elements ◦ You have to configure all elements POST / GET data HTTP headers Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 with the proxy, the happy way ◦ You “surf” on server with your browser ◦ jMeter will record data sent – GET / POST ◦ jMeter will handle HTTP headers ◦ jMeter will create a response assertion for each URL Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 In both cases (manually or by proxy) : ◦ you have to add realism with timers ◦ Timers will simulate user “reading” or pausing ◦ Nobody clicks a million times per minute ◦ Unless you test a website for people on Ecstasy Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Stop talking, and make a live demo ! Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Test Plan ◦ Add “Thread Group” ◦ Add “HTTP Request Defaults” Config “Server Name” and “port” ◦ Add “HTTP Cookie Manager” Check “Clear cookie on each iteration” Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Workbench : “Add HTTP proxy” ◦ Check “Add Assertions” ◦ Select “Recording controller” ◦ Use patterns to filter (or not) ◦ Add “Listener > View Results Tree” Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Record your visit Do a first run with 1 user Complete “Response Assertion” Clean/Remove “non-relevant links” Do another run for check Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 On response assertions ◦ Test response code is useless and wrong ◦ Test on specific text for each page Use a sample text Use a regular expression Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 On Thread Group ◦ Number of threads (users ?!) Number of independent threads launched ◦ Ram-up period in seconds Seconds between the beginning of a thread and the next Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Aggregate report Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Results Tree Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Graph Result (if you can understand it) Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Why FusionReactor ? A HUMAN CAN UNDERSTAND THIS !!!! Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? JVM Memory Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? CPU Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? CPU Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? Database Requests Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? DB Request Average Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? DB Request Average Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? Request Activity Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? Request Activity Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? Request Activity Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Where to look ? Request Activity Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Get / watch/ verify all data that you can have. Don’t base all your interpretation on only one tool. Be careful with SNMP monitoring tools (like cacti/zabbix) A new monitoring tool on beta : Morpheus for Railo. Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Add more tests (other paths, other ways) Add complexity to tests (but not too much) Write a strategy of testing (You could have to justify it) Interpret results… Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Clean previous results after each run. Restart services before each run Test once manually Test “as human” on a run to “sniff around” Test each scenario separately before mixing Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Test with data loaded from a CSV file (like auth) Connect and use auth from a LDAP Retrieve data from the loaded page Follow links from a starting page (not recommended) Test java or database directly… Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Request/sec. is not User capacity ◦ Users take from 30 to 60 sec/page ◦ 20 req/sec capacity ◦ => 600 – 1200 actives users capacity per sec Inversely : ◦ (Users target / avg time spend per page) = Req/sec target Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Michael Hnat from BlueGras FusionReactor / Intergral Team Aurélien Deleusière from Prisma IT Jocelyne Treilly from Mondadori France Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Questions ? Thanks for your attention Twitter : @jlepage_info Don’t leave now… I get a last surprise ! Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013 Jérôme Lepage – Scalability Tests with jMeter – CFCamp 2013