{"id":187212,"date":"2013-07-19T23:18:03","date_gmt":"2013-07-19T19:18:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=187212"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=187212","title":{"rendered":"<span class=\"post_title\">\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 c \u043f\u043e\u043c\u043e\u0449\u044c\u044e Go<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440. <br \/>  \u0412\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 <a href=\"http:\/\/jmeter.apache.org\/\">JMeter<\/a>. \u0415\u0441\u043b\u0438 \u0432 \u043a\u0440\u0430\u0442\u0446\u0435 \u2014 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u043c\u043d\u043e\u0433\u043e-\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0438\u0448\u0435\u043a. \u041d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043e \u043d\u0435\u043c.<\/p>\n<h5>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c<\/h5>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0443\u0437\u0435\u043b, JMeter \u043f\u043e\u043c\u043e\u0433\u0430\u043b \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041f\u0440\u043e\u0444\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u0442, \u043d\u043e \u0432\u0441\u0435 \u0443\u043f\u0435\u0440\u043b\u043e\u0441\u044c \u0432 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. JMeter \u043d\u0435 \u043c\u043e\u0433 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a, \u0430 \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0440\u0435\u0436\u0438\u043c\u0430, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b OutOfMemory \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u043b\u043e\u0441\u044c, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u043b\u0430\u0441\u044c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 CPU \u2014 400%, \u0440\u0435\u0448\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u044b\u043b\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e. <br \/>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0438 \u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u2014 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u0438\u043d\u0438-\u0442\u0435\u0441\u0442, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c. \u0414\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Go \u043d\u0430 \u0432\u043a\u0443\u0441. \u0422\u0430\u043a \u0440\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 go-meter. \u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0438\u0431\u043e \u043d\u0435 \u0431\u044b\u043b\u043e, \u043b\u0438\u0431\u043e \u043e\u043d\u0438 \u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u0412\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434\u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h5>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h5>\n<p>  \u0414\u0443\u043c\u0430\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u044f\u0437\u044b\u043a \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0432\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"http:\/\/tour.golang.org\/\">\u0442\u0443\u0440<\/a> \u043f\u043e <a href=\"http:\/\/www.youtube.com\/watch?v=ytEkHepK08c\">\u044f\u0437\u044b\u043a\u0443<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u041a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442, \u0432 <a href=\"http:\/\/golang.org\/doc\/code.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0432\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435. <br \/>  \u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u044b\u0431\u0440\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e Go? \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u0432, \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u0435\u043d\u044f: \u043e\u043d \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439, \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c, \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0412\u044b \u0441\u043a\u0430\u0436\u0438\u0442\u0435, \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u042f \u0441 \u0412\u0430\u043c\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u043d\u043e \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u044b\u043b\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u043d\u043e \u0438 \u0443\u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435.<\/p>\n<h5>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c<\/h5>\n<p>  \u041d\u0435 \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u044f \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0442\u0435\u0441\u0442\u0430 \u0432 JSON \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0432\u043e\u0434\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430(\u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0438 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0438 \u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432). \u0421 JSON \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code class=\"go\">func (this *Settings) Load(fileName string) error { \tfile, e := ioutil.ReadFile(fileName); if e != nil { \t\treturn e \t} \te = json.Unmarshal(file, this); if e != nil { \t\treturn e \t} \treturn nil } <\/code><\/pre>\n<p>  \u041f\u043e\u0439\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c N-\u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0435\u0441\u0442\u044c Channels. \u0421\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u00ab\u0442\u0440\u0443\u0431\u044b\u00bb \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0439, \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a, \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0437\u0430 \u043d\u0430\u0441. \u0418\u0434\u0435\u044f \u0442\u0430\u043a\u0430\u044f: \u043f\u043e\u0442\u043e\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0436\u0434\u0435\u0442 \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043d\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u0442\u043e\u043a\u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b:  <\/p>\n<pre><code class=\"go\">type Status struct { \tIsError bool \tIsWarning bool \tIsSuccess bool \tDuration *time.Duration \tSize int64 \tIsFinished bool \tError *error \tFinishedAt *time.Time \tStartedAt *time.Time } <\/code><\/pre>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c M-\u0440\u0430\u0437 HTTP \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 POST \u0437\u0430\u043f\u0440\u043e\u0441, \u0442\u043e \u0435\u0449\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c:  <\/p>\n<pre><code class=\"go\">func StartThread(setts *settings.Settings, source *Source, c chan *Status){ \titeration := setts.Threads.Iteration \t\/\/\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 key, value \u0434\u043b\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \theader := map[string]string{} \tfor _, s := range setts.Request.Headers { \t\tkeyValue := regexp.MustCompile(&quot;=&quot;).Split(s, -1) \t\theader[keyValue[0]] = keyValue[1] \t}  \tsourceLen := len(*source)  \t\/\/\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 URL \turl := setts.Remote.Protocol + &quot;:\/\/&quot; + setts.Remote.Host + &quot;:&quot; + strconv.Itoa(setts.Remote.Port) + setts.Request.Uri \tif iteration &lt; 0 { \t\titeration = sourceLen \t} \tindex := -1 \tfor ;iteration &gt; 0; iteration-- { \t\tstatus := &Status{false, false, false, nil, 0, false, nil, nil, nil} \t\tindex++ \t\tif index &gt;= sourceLen { \t\t\tif setts.Request.Source.RestartOnEOF { \t\t\t\tindex = 0 \t\t\t} else { \t\t\t\tindex-- \t\t\t} \t\t} \t\t\/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \t\tvar s *bytes.Buffer \t\tif strings.ToLower(setts.Request.Method) != &quot;get&quot; { \t\t\ts = bytes.NewBuffer((*source)[index]) \t\t} \t\t\/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c HTTP \u0437\u0430\u043f\u0440\u043e\u0441 \t\treq, err := http.NewRequest(setts.Request.Method, url, s); if err != nil { \t\t\tstatus.Error = &err \t\t\tstatus.IsError = true \t\t\tc &lt;- status \t\t\tbreak \t\t} \t\t\/\/\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \t\tfor k,v := range header { \t\t\treq.Header.Set(k,v) \t\t} \t\t\/\/\u0417\u0430\u0441\u0435\u043a\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u044f \t\tstartTime := time.Now() \t\t\/\/\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \t\tres, err := http.DefaultClient.Do(req); if err != nil { \t\t\tstatus.Error = &err \t\t\tstatus.IsError = true \t\t\tc &lt;- status \t\t\tbreak \t\t} \t\tendTime := time.Now() \t\t\/\/\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \t\tstatus.FinishedAt = &endTime \t\tstatus.StartedAt = &startTime \t\tdiff := endTime.Sub(startTime) \t\t\/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u043f\u0440\u0438\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 3 \u0433\u0440\u0443\u043f\u043f (Error, Warning, Success) \t\tcheckStatus(setts.Levels, res, diff, status) \t\t\/\/\u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \t\tioutil.ReadAll(res.Body) \t\tres.Body.Close() \t\t\/\/\u041e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \t\tc &lt;- status \t\t\/\/\u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0435 \t\tif setts.Threads.Delay &gt; 0 { \t\t\tsleep := time.Duration(setts.Threads.Delay) \t\t\ttime.Sleep(time.Millisecond * sleep) \t\t} \t} \t\/\/\u041e\u043f\u043e\u0432\u0435\u0449\u0430\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \tstatus := &Status{false, false, false, nil, 0, true, nil, nil, nil} \tc &lt;- status } <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043e\u0442 \u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0435  <\/p>\n<pre><code class=\"go\">c := make(chan *Status, iteration * setts.Threads.Count) for i := 0; i &lt; setts.Threads.Count; i++{ \tgo StartThread(&setts, source, c) } for i := iteration * setts.Threads.Count; i&gt;0 ; i-- { \tcounter(&lt;-c) } fmt.Println(&quot;Completed&quot;) <\/code><\/pre>\n<h5>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h5>\n<p>  \u042d\u0442\u043e \u0441\u0430\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434. \u0412\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/a696385\/go-meter\">GitHub<\/a>, \u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0435\u0441\u044c \u0446\u0438\u043a\u043b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e \u0444\u0430\u043a\u0442\u0443, \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u044d\u0442\u043e\u0442 \u0447\u0443\u0434\u043e \u044f\u0437\u044b\u043a \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0441 \u043b\u0438\u0445\u0432\u043e\u0439, \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043e\u0431\u044a\u0435\u043c\u043e\u043c \u0432 3 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0431\u044b\u043b\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 JMeter \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0440\u0435\u0434\u043a\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 15%.<br \/>  \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 HTTP Restfull Web \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0432 MongoDB \u0438 Redis.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/187212\/\"> http:\/\/habrahabr.ru\/post\/187212\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440. <br \/>  \u0412\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 <a href=\"http:\/\/jmeter.apache.org\/\">JMeter<\/a>. \u0415\u0441\u043b\u0438 \u0432 \u043a\u0440\u0430\u0442\u0446\u0435 \u2014 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u043c\u043d\u043e\u0433\u043e-\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0438\u0448\u0435\u043a. \u041d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043e \u043d\u0435\u043c.<\/p>\n<h5>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c<\/h5>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0443\u0437\u0435\u043b, JMeter \u043f\u043e\u043c\u043e\u0433\u0430\u043b \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041f\u0440\u043e\u0444\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u0442, \u043d\u043e \u0432\u0441\u0435 \u0443\u043f\u0435\u0440\u043b\u043e\u0441\u044c \u0432 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. JMeter \u043d\u0435 \u043c\u043e\u0433 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a, \u0430 \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0440\u0435\u0436\u0438\u043c\u0430, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b OutOfMemory \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u043b\u043e\u0441\u044c, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u043b\u0430\u0441\u044c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 CPU \u2014 400%, \u0440\u0435\u0448\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u044b\u043b\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e. <br \/>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0438 \u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u2014 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u0438\u043d\u0438-\u0442\u0435\u0441\u0442, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c. \u0414\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Go \u043d\u0430 \u0432\u043a\u0443\u0441. \u0422\u0430\u043a \u0440\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 go-meter. \u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0438\u0431\u043e \u043d\u0435 \u0431\u044b\u043b\u043e, \u043b\u0438\u0431\u043e \u043e\u043d\u0438 \u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u0412\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434\u043a\u0430\u0442.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-187212","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/187212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=187212"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/187212\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}