Jmeter mina2 Summary

Source: Internet
Author: User
Tags sendmsg
  1. Public class testyuan extends act1_amplerclient {
  2. Private Static string label = "cbctest ";
  3. Private string IP;
  4. Private string port;
  5. Private string instype;
  6. Private sampleresult SR;
  7. Public void setuptest (javasamplercontext arg0 ){
  8. System. Out. println ("setuptest ");
  9. }
  10. Public sampleresult runtest (datagamplercontext arg0 ){
  11. IP = arg0.getparameter ("ip ");
  12. Port = arg0.getparameter ("Port ");
  13. Instype = arg0.getparameter ("instype ");
  14. Sr = new sampleresult ();
  15. Sr. setsamplelabel (Label );
  16. Try {
  17. Sr. samplestart (); // record the program execution time and execution result
  18. // Send data
  19. String S = getinsdata (instype );
  20. System. Out. println ("Send begin! ");
  21. Sendmsg (IP, integer. parseint (port), S );
  22. Sr. setsuccessful (true );
  23. System. Out. println ("send over! ");
  24. } Catch (throwable e ){
  25. Sr. setsuccessful (false );
  26. } Finally {
  27. Sr. sampleend ();
  28. }
  29. Return SR;
  30. }
  31. Private string getinsdata (string instype2) throws exception {
  32. String retstr;
  33. Try {
  34. Retstr = redinput (instype2 );
  35. } Catch (exception e ){
  36. System. Out. println ("instype:" + instype2 + "file not exist! ");
  37. Throw E;
  38. }
  39. Return retstr;
  40. }
  41. Public void teardowntest (datagamplercontext arg0 ){
  42. }
  43. Public arguments getdefaultparameters (){
  44. Arguments Params = new arguments ();
  45. Params. addargument ("ip", "99.6.150.31 ");
  46. Params. addargument ("Port", "8016 ");
  47. Params. addargument ("instype", "1 ");
  48. Return Params;
  49. }
  50. Private void sendmsg (string IP, int port, string data) throws exception {
  51. Clientsocket = new clientsocket (null, IP, Port );
  52. Xmliniplus ini = NULL;
  53. Try {
  54. INI = clientsocket. clientconnect ("dcinsfrm", "10041004", data/*, tmslistener */);
  55. } Catch (exception e ){
  56. // SET payment to suspicious electronic instructions to fail-check payment to suspicious
  57. System. Out. println ("exception:" + E. getmessage ());
  58. Throw E;
  59. }
  60. System. Out. println ("Success return! ");
  61. }
  62. Public static string redinput (string instype) throws exception {
  63. Char data [] = new char [1024]; // create an array containing 1024 characters
  64. Filereader Fr = NULL;
  65. Try {
  66. // Fr = new filereader ("C: \ dcqrybkp. xml ");
  67. Fr = new filereader ("C: \ dcinsfrm _" + instype + ". xml ");
  68. } Catch (exception e ){
  69. E. printstacktrace ();
  70. Throw E;
  71. } // Create an object fr
  72. Int num = 0;
  73. String STR = NULL;
  74. Try {
  75. Num = Fr. Read (data );
  76. STR = new string (data, 0, num); // convert the character list to a string
  77. Fr. Close ();
  78. } Catch (exception e ){
  79. E. printstacktrace ();
  80. Throw E;
  81. }
  82. Return STR;
  83. }
  84. }

The project uses Mina for underlying socket communication, and performance tests are required. LoadRunner is too difficult, jemeter is small, and the functions are complete. Implement jemete tcpsampler by yourself.

 

Summary:

 

1. thread group: indicates a certain number of concurrent users. It can be used to simulate concurrent users to send requests. The actual request content is defined in sampler, Which is contained by the thread group. You can create a thread group in "test plan-> Add-> thread group", and then there are several input columns in the thread group panel: thread count, ramp-up period (in seconds) number of cycles, in which ramp-up period (in seconds) indicates that all threads have been created during this time. If there are 8 threads and ramp-up = 200 seconds, the thread startup interval is 200/8 = 25 seconds. The advantage is that there is no heavy load on the server at the beginning. A thread group is designed to simulate concurrent loads.

2. Sampler
Java request: a self-written Sampler

3. Aggregate reports
Label: Sample name
Samples: the total number of requests sent during the running process. Generally, the value is equal to the number of threads * The number of cycles (prerequisite: The test is completed as planned, with no threads terminated abnormally ), for example, if five threads exist and each thread loops for 10 times, the number of samples in the corresponding row is 5*10 = 50. The total samples is the sum of samples in each request.
Average: average response time
Median: Median in response time
90% line: Response Time: 90% lines
Min: minimum response time
MAX: Maximum response time
Error %: error rate (number of failed requests/number of all requests)
Throughput: throughput, number of requests processed per second/minute (For details, refer to the units following "/")
KB/sec: the amount of data received from the server per second, equivalent to throughput/sec in LoadRunner
[Note] the overall value is not the sum of all columns. Is the statistical value of all samples, such as: Overall min = min {min} of each samples, overall max = max {max} of each Samples}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.