Vyacheslav Smirnov - Speed ​​up Apache JMeter

Vyacheslav Smirnov - Speed ​​up Apache JMeter





Apache JMeter does not require advertising, but they rarely devote time to the speed of the load scripts themselves. Vyacheslav considers approaches to the optimal writing of scripts, which saves on load machines and allows you to look at JMeter in a new way.



Apache JMeter is a popular performance testing tool with many components and features. The same operations in Apache JMeter can be done in several ways.



, , . Apache JMeter .



Java-, Java Flight Recorder, jVisualVM, SJK, , , .



, Apache JMeter, , , , JVM/JDK .



! , Apache JMeter.





. , . , , Habr. .





. . , , - .





. Apache JMeter. - , Apache JMeter.





JMeter, , .



  • . 2003- .
  • , 50 , , .
  • ClickHouse, InfluxDB, Graphite. , , Grafana html-.
  • CI/CD.
  • .
  • .




5 . :



  1. HTTP-. HTTP- .
  2. . - .
  3. PostProcessor HTTP-.
  4. PreProcessor.
  5. . .




, , , , JMeter .





, :



  • , , , .
  • , , CI/CD-, .
  • .




, HTTP Request – .





Samplers.HTTP.Request.X. . GET- . . Samplers.HTTP.Request.X. X , . . . . GET- .





nginx , OS Process Sampler



nginx-. setup- tearDown-, OS Process Sampler nginx .





Nginx . – .





Thread Group HTTP Request. : , . – , Use KeepAlive. , .





, , – . 10 – , -, 100, 1000 , Loop Controller. «RequestCount», . , JMeter .





Thread Group : – Threads, – LoopCount.





, :



  • : 1, 2, 3.
  • . 1, 10, 50, 100 .
  • - Keep-Alive.


, .



, . .





, . ( – ) , . 300-400 .



, , 10, 4 000 . . .



, Keep-Alive , .





( , ) , , .





.



? Keep-Alive? , .





, ? benchmarks, JMeter, . , JMeter, , , .



JMeter, , . Keep-Alive . .





, Keep-Alive . .





Keep-Alive , , . . 50-100 .





, benchmarks: Keep-Alive . . . , , 10 . .





. benchmarks JMeter , , . . . . , . .





- 100, - , , 10. , , - , . 10 .



, 10 4 000 5 000 . , JMeter .





4 000 16 000 . , , . ,





:



  • . Telegraf, InfluxDB, Grafana.
  • , . Linux – Netstat .
  • Linux: /proc/sys/net/*.
  • .
  • : SJK, Java Fligth Recorder.
  • JMeter.


, 4 000 16 000 .





10 - . , . JMeter Backend Listener. Grafana.



, , . . 4 000-5 000. , 500 ( ) 16 000 ( 100 ). .





, . , Non HTTP response code. Linux , . Windows : . .



5,24 % . .





JMeter SJK, , , . . 64 % — socketConnect. . . JMeter , - , - . , , , nginx. .





, - . , . ?





  1. , . . - JMeter.
  2. JMeter. , .
  3. , . . - , Linux, .




JMeter: (RequestCount) 50. .





, , : 1, 10, 50, 100. , (50 100), 16 000 .



, , – .



10 , – . - .





, HTTP Cache Manager ? , , , : html-. .





, HTTP Cache Manager, . .



4 800. , - .





JMeter - HTTP Cache Manager’ socketConnect. . . nginx.





, . 10. HTTP Cache Manager .





. , , HTTP Cache Manager .





- . JMeter.





, , , , , , HttpClient4 Java. HttpClient4.



java- ( 8- Java), 3,3 . . . . , , , JavaClient , HttpClient4. JMeter. HTTP, ?





, JMeter . . - . . . socketConnect. .





. , . - .





. , . . 10 , . , TCP – , SSL – .



«false»: , .





. , ! 4 . 20 000 . 4- . , , - , , .





. HttpClient4, 3,3 . , , , 4 . .





. , . - .





. , , JMeter, . . .





, , . , nginx. , nginx , . . 0 1 200-1 300-1 400. , 10 , . . 10 – , 10 – . . . .





, – , – . – waits - . , , 3,5 .





, . . , Grafana, Telegraf … Netstat, , tcp_time_wati, , , 28 231. . . , . . . - , tcp_time_wait .





, nginx ( nginx 5555), NetStat.



, JMeter nginx , TIME_WAIT. . . 28 000 – JMeter , , : « ». , nginx : «, , », . . . , - .





, , . local_port_range. Ubuntu 32 000 61 000.



61 000 32 000, 28 000.



cat, «cat / », .





«echo», .



, 32 000 , . . : 1 025 60 999. , , .



@blog.kireev.pro. , tcp_time_wait , .





. . 1,6 . 500 16 000, 3 500 19 000. . 7 700.





, . .





JMeter, - socketConnect.





, Address not available ip_local_port_range.





, , socketConnect. Netstat: tcp_time_wait, . . Telegraf, Grafana, , 28 000. 32 768. , , . - , .





, , . . tw_ buckets , TIME_WAIT.



«cat», , Ubuntu 32 768.





, , , 65 000. .





, , . . - 3 500 19 000.





? Tcp_time_wait 32 768, . 46 000. , . . , .





. . local_port_range, , tw_buckets, tw_buckets - , . .





, JMeter - socketConnect, – 50 %. .





, TIME_WAIT-. «1» tcp_tw_reuse. «0».





, - , - 3,6 19 000 . . , .





, JMeter . socketRead, socketWrite, . . . .





«», , . , JMeter .





TIME_WAIT. . – 16 000, . , 30 000, , . , Gatling.





https://bit.ly/gatling-tuning



https://gatling.io/docs/current/general/operations/



Gatling, General/ Operations. Java .





, . , local_port_range.



. ? , , , 5, 6 , . , Linux nr_open . , , 300 000.



file-max 70 000 , . , .





tw_reuse = 1.





https://yandextank.readthedocs.io/en/develop/generator_tuning.html#tuning



Yandex.Tank. , , .



, tw_recycle. Tw_reuse . , Gatling , . , .



Yandex.Tank, Gatling, - , .





, tw_reuse 3,6 . .





, ?



  • , reset_state false, 3,9 .
  • Httpsampler Java, 3,3 .
  • Linux c tw_reuse 3,6 .
  • local_port_range - .


. .





, JMeter – socketConnect. read. 20 % timeout – . 11 % BackendListener. 12 % . JMeter.





, - . , .





. JMeter, .





, Thread Group 200 , 4 Heap Size



, 200 . 200 . , JMeter , .



1 . DD. , .





. . 5 . . 1,5 . , JMeter. 4 .





Java Fligth Recorder, , , , . . 200 . memory traffic ( ) , 2 . . . JMeter 200 2 , JFR . , overhead JFR.





SJK , socketRead, . . , , .





. - , Heap 4 , , 1 , 1,1 , OutOfMemoryError. . , 2 , HEAP 8 , . . , .





, . Httpsampler , .





, , , - .





, JMeter.





, .





HTTP Request , Save response as MD5 hash. ? , MD5 hash. , , . . . .





, . , , . . , . . 18 . 5,5 .





Java Flight Recorder, , . . . - . , .





, MD5 66 %, . . , . 33 % — socketRead. , MD5, . socketRead MD5.





- MD5 , . , . , .





, , .





200 , – , ? JMeter? , : wget, curl. OS Process Sampler JMeter. .





. Linux, wget. wget-download.sh. «url». , dev/null, . 2-3 , 400-600 , .





Windows. Wget … MinGW. Dev/null Windows .





, Wget . , , .





characters per second, JMeter, JMeter , Wget , , , . . .





, . , gzip.





gzip gzip. . . bash . .





JMeter , . . SampleResult. PostProcessor, BodySize , content-type, .





, JMeter , Wget body. .





. SampleRusult .





wget. : 0 2 .





, , :



  • – 5 ,
  • – 18 ,
  • wget – 2 .




, OS Process Sampler + JSR-223 . , . MD5 7 . .





.





JMeter.





, . , JMeter properties. , Sampler . 0. , , , .



100, 100 .





. . 1 . – 180 . 500 .





, , . . socketRead. , – socketRead .





, MD5 hash . . , , wget 2 . , , , . . JMeter .





- , , , MD5 . Wget . .



, , – .





– . , , .





, JMeter . - . , . Files Upload. , .





. , HTTP Request, .



Parameters. – . , .



Body Data, . . . .



– Files Upload. – . – , , – . , , .





. Parameters Files Upload .





Files Upload (body data) Body Data , - . . - , JMeter , .





, , Use multipart/form-data. - , form-data.





.





. , – . .





«», «», «», ? ?





, , 10 , , ? .





, 10 JSONs. JSONs. - . , . .



. . Sed. 100 , 10 Java - . , .





: Files Upload, , .





. , . PostProsser’?





JMeter. hint .





Boundary Extractor. JRS223 Sampler, , Apache JMeter, html-, . html-. , . . http- . Extractor.





Boundary Extractor, .







JSR-223 PostProcessor, Boundary Extractor.







BeanShell PostProcessor, Boundary Extractor.





CSS Extractor.





XPath Extractor tolerant parser. , XPath html.





. .



Boundary, 55 000 .



50 000 – .



JSR223 BeanShell. JSR223 , .



CSS Selector .



XPath . XPath .





PostProcessor’



, CSS Selector , . , CSS Selector JMeter, , , , . , CSS Selector , 200 CSS Selectors. 3-4 .





tolerant parser XPath. Boundary Extractor. CSS Selector, , .



. PostProcessors , .





PreProcessors .





, XML HTTP- Groovy PreProcessor , SimpleTemplateEngine, XML.



SimpleTemplateEngine XML, . , SimpleTemplateEngine , , , , XML.MarkupBuilder – , , .



, . . , , XML.MarkupBuilder, 5 . , .



XML.MarkupBuilder – . XML, , , , XML. . Groovy .



( ), Groove . , , .





, XML PreProcessors, MarkupBuilder. Groovy . . .





4 . .



:



  • JMeter ,
  • ,
  • , . , , 100 . 100 , , . 10 .
  • , , .




? : Maven, jmeter-maven-plugin IntelliJ IDEA. 10.



?





IntelliJ IDEA . JMeter. .



IDEA? , , refactoring. , , , html-content html, refactoring. , . . - refactoring JMeter-, , .



, , IDEA git. .





JMeter, ? , . , . .





jmeter-maven-plugin , .



. testPlanLibraries.





, : «Maven, ». .





, Maven Properties , JMeter, , , .



, , , , . . . .





Heap, , Heap.





, , SJK, .





Java Flight Recorder – . .





JVisual VM – , .





https://bit.ly/jmeter-bench



https://github.com/polarnik/Apache.JMeter.Benchmark.NG



, GitHub. 20 . , jmeter-maven-plugin, . .





, ?



:



  • . boost .
  • JMeter.
  • boost.
  • , , : Maven, jmeter-maven-plugin, IntelliJ IDEA. , , .




, : https://t.me/qa_load, 300 . , , !





! , , , . JMeter? – throughput, . throughput, , - ?



! , . : , , , , JMeter . : « ?». .



, , . . , , .



, - , . .



, , , . build , , pool , . JMeter , , .



, : 1,5 , 7 , 5 – . - . .



, - , , JMeter , , .



, - . Linux?



, Linux.



Windows - ?



Windows, . Windows, , , .



Update . ( )

(docs.microsoft.com)



? ? IP- , IP- . - , , , , IP-. . . , , IP, local host 5555, local host -. .



The old JMeter still had such an option when we could bind the current client to a specific IP. And we could expand the IP range on the client. Thus, do not climb into any setting, but simply say that the test is now being launched from three to four or five addresses. This has been removed in the current version. It can somehow be thought of differently.



I'm already with Windows, switched to Linux. In some moments, you have to return to Windows when testing scripting, but there is no need for great intensity and some outrageous things.




All Articles