\u8fd0\u884c\u5982\u4e0b\u4e24\u4e2a\u547d\u4ee4\u5206\u522b\u5b89\u88c5Crank\u7684cli(Controller)\u548cAgent\u3002<\/p>\n
\r\ndotnet tool update Microsoft.Crank.Controller --version \"0.2.0-*\" --global\r\ndotnet tool update Microsoft.Crank.Agent--version \"0.2.0-*\" --global<\/pre>\n\u9700\u8981.Net SDK 5.0\u73af\u5883<\/p>\n
\u5b89\u88c5\u5b8c\u6210\u540e\u6267\u884c\u547d\u4ee4crank\uff0c\u4f1a\u6253\u5370\u51fa\u5982\u4e0b\u53ef\u4ee5\u914d\u7f6e\u7684\u53c2\u6570\u548c\u4ecb\u7ecd\uff0c\u6216\u8005github\u67e5\u770b\u76f8\u5173\u53c2\u6570\u4ecb\u7ecd\u3002<\/p>\n
\r\nPS C:\\Users\\Stack\\Desktop> crank\r\nCrank Benchmarks Controller\r\n \r\nThe Crank controller orchestrates benchmark jobs on Crank agents.\r\n \r\nUsage: Crank [command] [options]\r\n \r\nOptions:\r\n -?|-h|--help Show help information\r\n -c|--config Configuration file or url\r\n -s|--scenario Scenario to execute\r\n -j|--job Name of job to define\r\n --profile Profile name\r\n --script Execute a named script available in the configuration files. Can be used multiple times.\r\n -j|--json Saves the results as json in the specified file.\r\n --csv Saves the results as csv in the specified file.\r\n --compare An optional filename to compare the results to. Can be used multiple times.\r\n --variable Variable\r\n --sql Connection string of the SQL Server Database to store results in\r\n --table Table name of the SQL Database to store results in\r\n --session A logical identifier to group related jobs.\r\n --description A string describing the job.\r\n -p|--property Some custom key\/value that will be added to the results, .e.g. --property arch=arm --property\r\n os=linux<\/pre>\n\u6267\u884ccrank-agent\uff0c\u542f\u52a8\u57fa\u51c6\u6d4b\u8bd5\u6240\u9700\u7684\u4ee3\u7406\u670d\u52a1\u3002github\u67e5\u770b\u76f8\u5173\u53c2\u6570\u4ecb\u7ecd\u3002<\/p>\n
\r\nPS C:\\Users\\Stack\\Desktop> crank-agent\r\nHosting environment: Production\r\nContent root path: C:\\Users\\Stack\\.dotnet\\tools\\.store\\microsoft.crank.agent\\0.2.0-alpha.21567.1\\microsoft.crank.agent\\0.2.0-alpha.21567.1\\tools\\net5.0\\any\\\r\nNow listening on: http:\/\/[::]:5010<\/pre>\n\u521b\u5efaCrank\u914d\u7f6e\u6587\u4ef6<\/strong><\/div>\n\u914d\u7f6e\u6587\u4ef6\u53c2\u8003\u5b98\u65b9hello.benchmarks.yml\u793a\u4f8b<\/p>\n
\u793a\u4f8b\u6587\u4ef6\u4e2d\u5f15\u5165\u4e86bombardier.yml\uff0c\u7531\u4e8e\u5927\u73af\u5883\u5bf9githubusercontent.com\u57df\u540d\u4e0d\u592a\u53cb\u597d\uff0c\u53ef\u4ee5\u8003\u8651\u5c06bombardier.yml\u4e0b\u8f7d\u5230\u672c\u5730\uff0cimports\u5f15\u5165\u672c\u5730\u8def\u5f84\u6216\u8005\u76f4\u63a5\u5c06\u6587\u4ef6\u5185\u5bb9\u52a0\u5165\u5230\u65b0\u5efa\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n
\r\nimports:\r\n -https:\/\/raw.githubusercontent.com\/dotnet\/crank\/main\/src\/Microsoft.Crank.Jobs.Bombardier\/bombardier.yml<\/pre>\n\u751f\u4ea7\u4e2d\u4f7f\u7528\u63a8\u8350imports\u6587\u4ef6\u7684\u65b9\u5f0f\uff0ccrank\u914d\u7f6e\u6587\u4ef6\u4e2d\u505a\u5c11\u91cf\u914d\u7f6e\u5c31\u53ef\u4ee5\u5b8c\u6210\u57fa\u51c6\u6d4b\u8bd5\uff0c\u5e76\u4e14\u53ef\u4ee5\u5f15\u5165\u4e0d\u540c\u7684Microsoft.Crank.Jobs.XXX\/XXX.yml,\u57fa\u4e8e\u4e0d\u540c\u7684\u57fa\u51c6\u6d4b\u8bd5\u5de5\u5177\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n
\u5176\u4ed6\u6d4b\u8bd5\u5de5\u5177\u914d\u7f6e\u6587\u4ef6\u90fd\u5728https:\/\/github.com\/dotnet\/crank\/blob\/main\/src\/Microsoft.Crank.XXX\u4e0b\u3002<\/p>\n
\r\nvariables:\r\n headers:\r\n none: ''\r\n plaintext: '--header \"Accept: text\/plain,text\/html;q=0.9,application\/xhtml+xml;q=0.9,application\/xml;q=0.8,*\/*;q=0.7\" --header \"Connection: keep-alive\"'\r\n html: '--header \"Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8\" --header \"Connection: keep-alive\"'\r\n json: '--header \"Accept: application\/json,text\/html;q=0.9,application\/xhtml+xml;q=0.9,application\/xml;q=0.8,*\/*;q=0.7\" --header \"Connection: keep-alive\"'\r\n connectionclose: '--header \"Connection: close\"'\r\n presetHeaders: none\r\n \r\njobs:\r\n bombardier:\r\n source:\r\n repository: https:\/\/github.com\/dotnet\/crank.git\r\n branchOrCommit: main\r\n project: src\/Microsoft.Crank.Jobs.Bombardier\/Microsoft.Crank.Jobs.Bombardier.csproj\r\n sourceKey: bombardier\r\n noBuild: true\r\n readyStateText: Bombardier Client\r\n waitForExit: true\r\n variables:\r\n connections: 256 #\u8bbe\u7f6e\u8fde\u63a5\u6570\r\n warmup: 15 #\u8bbe\u7f6e\u6d4b\u8bd5\u9884\u70ed\u6b21\u6570\r\n duration: 15 #\u8bbe\u7f6e\u6d4b\u8bd5\u65f6\u95f4\r\n requests: 0 #\u8bbe\u7f6e\u6d4b\u8bd5\u8bf7\u6c42\u5b9e\u4f8b\u6570\r\n rate: 0 #\u8bbe\u7f6e\u6bcf\u79d2\u8bf7\u6c42\u9891\u7387\r\n transport: fasthttp # | http1 | http2 \u8bbe\u7f6e\u4f7f\u7528golang\u7684fasthttp\u5e93\u53d1\u9001http\u8bf7\u6c42\r\n serverScheme: http\r\n serverAddress: localhost\r\n serverPort: 5000\r\n path: \r\n bodyFile: # path or url for a file to use as the body content\r\n verb: # GET when nothing is specified\r\n customHeaders: [ ] # list of headers with the format: ': ', e.g. [ 'content-type: application\/json' ]\r\n arguments: \"-c {{connections}} -w {{warmup}} -d {{duration}} -n {{requests}} --insecure -l {% if rate != 0 %} --rate {{ rate }} {% endif %} {% if transport %} --{{ transport}} {% endif %} {{headers[presetHeaders]}} {% for h in customHeaders %}{% assign s = h | split : ':' %}--header \\\"{{ s[0] }}: {{ s[1] | strip }}\\\" {% endfor %} {% if serverUri == blank or serverUri == empty %} {{serverScheme}}:\/\/{{serverAddress}}:{{serverPort}}{{path}} {% else %} {{serverUri}}:{{serverPort}}{{path}} {% endif %} {% if bodyFile != blank and bodyFile != empty %} -f {{bodyFile}} {% endif %} {% if verb != blank and verb != empty %} -m {{verb}} {% endif %}\"\r\n onConfigure: \r\n # - job.timeout = Number(job.variables.duration) + Number(job.variables.warmup) + 10;\r\n \r\n server:\r\n source: #\u6307\u5b9a\u9700\u8981\u6d4b\u8bd5\u7684\u9879\u76ee\uff0c\u672c\u6587\u76f4\u63a5\u4f7f\u7528\u672c\u5730\u8def\u5f84\r\n localFolder: .\r\n project: crank_demo.csproj\r\n readyStateText: Application started.\r\n # source: \u6307\u5b9a\u6d4b\u8bd5\u9879\u76ee\u7684\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\uff0c\u5e76\u901a\u8fc7branchOrCommit\u6307\u5b9a\u5206\u652f\r\n # repository: https:\/\/github.com\/dotnet\/crank\r\n # branchOrCommit: main\r\n # project: samples\/hello\/hello.csproj\r\n # readyStateText: Application started.\r\n \r\nscenarios: #\u914d\u7f6e\u57fa\u51c6\u6d4b\u8bd5\u573a\u666f\r\n crank_demo: #\u5b9a\u4e49\u65b9\u6848\u540d\uff0c\u6267\u884ccrank\u547d\u4ee4\u65f6\u6307\u5b9a\u8be5\u540d\u79f0\r\n application: \r\n job: server # \u6307\u5b9a\u6d4b\u8bd5\u9879\u76ee\u4e3a\u4e0a\u9762\u5b9a\u4e49\u7684server\r\n load:\r\n job: bombardier # \u6307\u5b9a\u6d4b\u8bd5\u5de5\u5177bombardier\r\n variables:\r\n serverPort: 5000 #\u914d\u7f6ehttp\u670d\u52a1\u7aef\u53e3\r\n path: \/ #\u914d\u7f6ehttp\u670d\u52a1\u5730\u5740\r\n \r\nprofiles:\r\n local:\r\n variables:\r\n serverAddress: localhost\r\n jobs: \r\n application:\r\n endpoints: \r\n - http:\/\/localhost:5010\r\n load:\r\n endpoints: \r\n - http:\/\/localhost:5010\r\n<\/value1><\/name1><\/pre>\n\u542f\u52a8Crank-Agent<\/strong><\/div>\n\u542f\u52a8agent\u540e\u6267\u884ccrank\uff0c\u4f1a\u6709\u4e00\u4e2a\u5982\u4e0b\u5b89\u88c5sdk\u7684\u52a8\u4f5c<\/p>\n
\r\n[09:29:05.261] Runtime: 6.0.0 (Current)\r\n[09:29:05.262] SDK: 6.0.100 (Current)\r\n[09:29:05.263] ASP.NET: 6.0.0 (Current)\r\n[09:29:05.265] Creating custom global.json\r\n[09:29:05.266] Desktop: 6.0.0 (Current)\r\n[09:29:05.266] Installing SDK '6.0.100' ...<\/pre>\n\u6240\u4ee5\u542f\u52a8agent\u65f6\u591a\u6307\u5b9a\u4e00\u4e2adotnethome\u53c2\u6570\uff0c\u907f\u514d\u91cd\u590d\u5b89\u88c5sdk\u3002<\/p>\n
\r\ncrank-agent --dotnethome 'C:\\Program Files\\dotnet'<\/pre>\n\u542f\u52a8Crank<\/strong><\/div>\n\r\ncrank --config .\\demo.benchmarks.yml --scenario crank_demo --profile local<\/pre>\n--scenario crank_demo: \u6307\u5b9a\u5b9a\u4e49\u7684\u6d4b\u8bd5\u573a\u666f<\/p>\n
--profile local :\u8bbe\u7f6e\u8f93\u51fa\u7ed3\u679c\u5230\u672c\u5730\uff0c\u5373\u63a7\u5236\u53f0\u8f93\u51fa<\/p>\n
\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u6307\u5b9a\u7ed3\u679c\u8f93\u51fa\u5230\u672c\u5730json\u6587\u4ef6\uff08--output results.json \uff09\u6216\u8005\u6570\u636e\u5e93\uff08--sql [connection-string] --table [table-name]\uff09<\/p>\n
\u7ed3\u679c\u8f93\u51fa<\/strong><\/span><\/div>\n\u8fd9\u91cc\u7701\u7565\u538b\u6d4b\u671f\u95f4\u7684\u65e5\u5fd7\u8f93\u51fa\uff0c\u76f4\u63a5\u5217\u51fa\u7ed3\u679c\u3002<\/p>\n
\r\n| application | |\r\n| --------------------- | ------------- |\r\n| CPU Usage (%) | 56 |\r\n| Cores usage (%) | 447 |\r\n| Working Set (MB) | 140 |\r\n| Private Memory (MB) | 157 |\r\n| Build Time (ms) | 7,232 |\r\n| Start Time (ms) | 501 |\r\n| Published Size (KB) | 91,292 |\r\n| .NET Core SDK Version | 6.0.100 |\r\n| ASP.NET Core Version | 6.0.0+ae1a6cb |\r\n| .NET Runtime Version | 6.0.0+4822e3c |\r\n \r\n \r\n| load | | \r\n| --------------------- | -------------- |\r\n| CPU Usage (%) | 46 | \r\n| Cores usage (%) | 370 | \r\n| Working Set (MB) | 29 |\r\n| Private Memory (MB) | 30 |\r\n| Build Time (ms) | 11,891 |\r\n| Start Time (ms) | 226 |\r\n| Published Size (KB) | 68,228 |\r\n| .NET Core SDK Version | 3.1.415 |\r\n| ASP.NET Core Version | 3.1.21+458d974 |\r\n| .NET Runtime Version | 3.1.21+df8abc0 |\r\n| First Request (ms) | 185 |\r\n| Requests | 912,005 |\r\n| Bad responses | 0 |\r\n| Mean latency (us) | 4,207 |\r\n| Max latency (us) | 138,999 |\r\n| Requests\/sec | 60,305 |\r\n| Requests\/sec (max) | 128,523 |<\/pre>\n\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Crank \u662f\u5fae\u8f6f\u65b0\u51fa\u7684\u4e00\u4e2a\u6027\u80fd\u6d4b\u8bd5\u6846\u67b6\uff0c\u96c6\u6210\u4e86\u591a\u79cd\u57fa\u51c6\u6d4b\u8bd5\u5de5\u5177\uff0c\u5982bombardier\u3001wrk\u7b49\u3002 Cran […]<\/p>\n","protected":false},"author":1482,"featured_media":121417,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-231278","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/231278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=231278"}],"version-history":[{"count":5,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/231278\/revisions"}],"predecessor-version":[{"id":231283,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/231278\/revisions\/231283"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/121417"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=231278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=231278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=231278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}