{"id":8129,"date":"2024-04-22T16:01:01","date_gmt":"2024-04-22T08:01:01","guid":{"rendered":""},"modified":"2024-04-22T16:01:01","modified_gmt":"2024-04-22T08:01:01","slug":"\u5206\u5e03\u5f0f\u538b\u6d4b\u5de5\u5177Grinder\u7684Hello World\u793a\u4f8b\u6559\u7a0b","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8129.html","title":{"rendered":"\u5206\u5e03\u5f0f\u538b\u6d4b\u5de5\u5177Grinder\u7684Hello World\u793a\u4f8b\u6559\u7a0b"},"content":{"rendered":"
\u672c\u6587\u4ee5\u538b\u6d4b\u4e00\u4e2aHTTP\u670d\u52a1\u6765\u8bf4\u660eGrinder\u7684\u4f7f\u7528\u65b9\u6cd5\u3002\u672c\u6587\u7684\u811a\u672c\u662fWindows\u811a\u672c\uff0cLinux\u7684\u811a\u672c\u4e0e\u6b64\u76f8\u4f3c\u3002\u9700\u8981\u6307\u51fa\u7684\u662fConsole\u53ea\u80fd\u90e8\u7f72\u5728\u5e26\u6709\u56fe\u5f62\u754c\u9762\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\uff0c\u5426\u5219\u542f\u52a8\u65f6\u4f1a\u62a5java.awt\u7684\u5f02\u5e38\u3002\u800cAgent\u5219\u4e0d\u9700\u8981\u56fe\u5f62\u754c\u9762\u3002<\/p>\n
\u521b\u5efa\u6587\u4ef6\u5939grinder-3.11-console\u548cgrinder-3.11-agent\u3002\u5c06\u6587\u4ef6\u5939grinder-3.11\u4e0b\u7684\u6240\u6709\u6587\u4ef6\u548c\u5b50\u6587\u4ef6\u5939\u540c\u65f6\u590d\u5236\u7ed9grinder-3.11-console\u548cgrinder-3.11-agent<\/p>\n<\/li>\n
<\/p>\n<\/li>\n<\/ul>\n<\/li>\n
\u914d\u7f6eConsole<\/p>\n
cd \u5230grinder-3.11-console\u4e0b<\/p>\n<\/li>\n
\u521b\u5efa\u914d\u7f6e\u6587\u4ef6grinder.properties\u3002Console\u7684grinder.properties\u4f18\u5148\u7ea7\u9ad8\u4e8eAgent\u7684grinder.properties\uff0c\u5982\u679c\u4e8c\u8005\u6709\u76f8\u540c\u7684\u914d\u7f6e\u9879\u5219\u6700\u7ec8\u6267\u884cConsole\u7684\u914d\u7f6e\u3002<\/p>\n
# \u6bcf\u4e2aAgent\u5f00\u542f\u591a\u5c11\u4e2a\u8fdb\u7a0b\ngrinder.processes=2\n# \u6bcf\u4e2aAgent\u8fdb\u7a0b\u5f00\u542f\u591a\u5c11\u4e2a\u7ebf\u7a0b\ngrinder.threads=3\n# \u6bcf\u4e00\u4e2a\u7ebf\u7a0b\u6267\u884c\u591a\u5c11\u904d\u6d4b\u8bd5\u811a\u672c\ngrinder.runs=100\n<\/code><\/pre>\n<\/li>\n- \n
\u521b\u5efastartConsole.cmd,\u5047\u8bbe\u9879\u76ee\u7684\u6839\u76ee\u5f55\u662fC:\\document\\project\\grinder-3.11-console<\/p>\n
set GRINDERPATH=C:\\document\\project\\grinder-3.11-console\njava -classpath %GRINDERPATH%\\lib\\grinder.jar net.grinder.Console\n<\/code><\/pre>\n<\/li>\n- \n
\u521b\u5efagrinder.py<\/p>\n
from net.grinder.script.Grinder import grinder\nfrom net.grinder.script import Test\nfrom net.grinder.plugin.http import HTTPRequest\n \ntest1 = Test(1, \"Hello World\")\nrequest1 = HTTPRequest()\ntest1.record(request1)\n \nclass TestRunner:\n def __call__(self):\n result = request1.GET(\"http:\/\/192.168.16.15:8080\/webservice?d=c_load_test \")\n<\/code><\/pre>\n<\/li>\n- \n
\u5728cmd\u7a97\u53e3\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\uff0c\u6253\u5f00Console\u5e94\u7528\u754c\u9762<\/p>\n
C:\\document\\project\\grinder-3.11-console>startConsole.cmd\n2018-08-21 08:48:42,245 INFO org.eclipse.jetty.server.Server: jetty-7.6.1.v20120215\n2018-08-21 08:48:42,417 INFO org.eclipse.jetty.server.AbstractConnector: Started SelectChannelConnector@:6373\n<\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<\/li>\n
- \n
\u914d\u7f6eAgent<\/p>\n
\n- \n
cd\u5230 grinder-3.11-agent\u76ee\u5f55\u4e0b<\/p>\n<\/li>\n
- \n
\u521b\u5efastartAgent.cmd<\/p>\n
set GRINDERPATH=C:\\document\\project\\grinder-3.11-agent\njava -classpath %GRINDERPATH%\\lib\\grinder.jar net.grinder.Grinder %GRINDERPATH%\\grinder.properties\n<\/code><\/pre>\n<\/li>\n- \n
\u521b\u5efagrinder.properties<\/p>\n
grinder.consoleHost=127.0.0.1\ngrinder.consolePort=6372<\/code><\/pre>\n<\/li>\n- \n
\u521b\u5efagrinder.py,\u5b9e\u9645\u8fd0\u884c\u7684\u65f6\u5019\u4f1a\u6267\u884cconsole\u76ee\u5f55\u4e0b\u7684grinder.py\uff0c\u4f46agent\u76ee\u5f55\u4e0b\u8fd9\u4e2agrinder.py\u4e5f\u5fc5\u987b\u6709\u5426\u5219\u4f1a\u62a5\u9519\u3002<\/p>\n
from net.grinder.script.Grinder import grinder\nfrom net.grinder.script import Test\n \ntest1 = Test(1, \"Hello World\")\n \nclass TestRunner:\n def __call__(self):\n<\/code><\/pre>\n<\/li>\n- \n
\u5728cmd\u7a97\u53e3\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\uff0c\u542f\u52a8Agent<\/p>\n
C:\\document\\project\\grinder-3.11-agent>startAgent.cmd\n2018-08-21 11:26:21,395 INFO agent: The Grinder 3.11\n2018-08-21 11:26:21,427 INFO agent: connected to console at localhost\/127.0.0.1:6372\n2018-08-21 11:26:21,427 INFO agent: waiting for console signal\n<\/code><\/pre>\n <\/p>\n<\/li>\n
- \n
\u5728Console\u7684\u8fdb\u7a0b\u6807\u7b7e\u9875\u91cc,\u5982\u679c\u4ee3\u7406\u8fdb\u7a0b\u5904\u4e8e\u5df2\u8fde\u63a5\u72b6\u6001\uff0c\u5219\u51c6\u5907\u5c31\u7eea\u3002<\/p>\n<\/li>\n
- \n
<\/p>\n<\/li>\n<\/ul>\n<\/li>\n
- \n
\u70b9\u51fb\u542f\u52a8Worker\u8fdb\u7a0b\uff0c\u5f00\u59cb\u6d4b\u8bd5\u3002<\/p>\n<\/li>\n
- \n
<\/p>\n<\/li>\n
- \u7136\u540e\u518d\u70b9\u51fb\u5f00\u59cb\u6536\u96c6\u7edf\u8ba1\u6570\u636e\u3002<\/li>\n
- <\/li>\n<\/ul>\n
\u76f8\u5173\u6587\u7ae0\uff1a<\/p>\n
\u300a\u5206\u5e03\u5f0f\u538b\u6d4b\u5de5\u5177Grinder\u7684\u793a\u4f8b\u6559\u7a0b : headers\u53caCookie\u8bbe\u7f6e\u300b<\/p>\n","protected":false},"excerpt":{"rendered":"\u5206\u5e03\u5f0f\u538b\u6d4b\u5de5\u5177Grinder\u7684Hello World\u793a\u4f8b\u6559\u7a0b\u672c\u6587\u4ee5\u538b\u6d4b\u4e00\u4e2aHTTP\u670d\u52a1\u6765\u8bf4\u660eGrinder\u7684\u4f7f\u7528\u65b9\u6cd5","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8129"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8129"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8129\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}