{"id":195818,"date":"2013-10-01T02:18:03","date_gmt":"2013-09-30T22:18:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=195818"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=195818","title":{"rendered":"<span class=\"post_title\">Go: \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043c\u0435\u043d\u044f \u0442\u043e\u043f\u0438\u043a \u043e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 Go: <a href=\"http:\/\/habrahabr.ru\/post\/195574\/\">habrahabr.ru\/post\/195574\/<\/a>.<br \/>  \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u0430\u043b \u0430\u0432\u0442\u043e\u0440\u0430 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0438 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0442\u0435\u043c\u0430 \u0432\u0441\u0435 \u0436\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<br \/>  \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c, \u0434\u0430\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043f\u043e\u043f\u0440\u043e\u0448\u0443 \u043f\u0440\u0438\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u0442\u0435\u0440\u043c\u0438\u043d \u00ab\u043f\u043e\u0442\u043e\u043a\u00bb \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u00abthread\u00bb, \u0430 \u043d\u0435 \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u00abstream\u00bb. \u0421\u043f\u0430\u0441\u0438\u0431\u043e.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u0430\u043a \u0438 \u0430\u0432\u0442\u043e\u0440 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430, \u044f \u0442\u043e\u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u043b\u044e \u044f\u0437\u044b\u043a Go \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<br \/>  \u041c\u043d\u0435 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u043f\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0438\u043b\u044c \u0435\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0438 \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u043c \u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u0435.<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044c \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<br \/>  \u041d\u043e \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f.<br \/>  \u041d\u0430 \u043c\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435 \u0432 10-20 \u0440\u0430\u0437, \u043d\u043e \u043e\u043d\u0430 \u0431\u044b\u043b\u0430. \u0418 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u2014 \u0432 2 \u043f\u043e\u0442\u043e\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 2 \u0440\u0430\u0437\u0430.<br \/>  \u042f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043e \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043d\u0435\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0435 \u0446\u0438\u043a\u043b\u044b \u0438 \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439. \u0418 \u0432\u043e\u0442 \u0447\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"go\">\/* channel_test01.go   * Tests how go-routines interact with channels  * Call: channel_test01 --help   * Pls, do not use name &quot;channel_test&quot;, because this name always is used by go-pkg-system  *\/  package main  import ( \t&quot;fmt&quot; \t&quot;time&quot; \t&quot;flag&quot; \t&quot;os&quot; \t&quot;runtime&quot; )  \/\/ flag support for program var MAXPROCS int var LOAD_CYCLES int \/\/internal burden cycle  var Usage = func() {     fmt.Fprintf(os.Stderr, &quot;Usage channel_test01 [-maxprocs=NN] [-cycles=NN] \\n&quot;, os.Args[0]) }  func init() {     flag.IntVar(&MAXPROCS, &quot;maxprocs&quot;, 1, &quot;maxprocs for testing. From 1 to 256 &quot;);     flag.IntVar(&LOAD_CYCLES, &quot;cycles&quot;, 1000, &quot;burden internal cycle for testing. From 1 to 1000000 and more &quot;); }  func main() {      flag.Parse();\/\/get MAXPROCS and LOAD_CYCLES from flags      \/\/ runtime.GOMAXPROCS() returns previous max_procs     max_procs := runtime.GOMAXPROCS(MAXPROCS)      \/\/ second call to get real state     max_procs = runtime.GOMAXPROCS(MAXPROCS)     fmt.Println(&quot;MaxProcs = &quot;, max_procs)           ch1 := make(chan int)     ch2 := make(chan float64)  \tgo chan_filler(ch1, ch2) \tgo chan_extractor(ch1, ch2)      fmt.Println(&quot;Total:&quot;, &lt;-ch2, &lt;-ch2)  }  func chan_filler(ch1 chan int, ch2 chan float64) {      const CHANNEL_SIZE = 1000000       for i := 0; i &lt; CHANNEL_SIZE; i++ {         for j := 0; j &lt; LOAD_CYCLES; j++ {             i++         }         \/\/thus we avoid optimizer influence         i = i - LOAD_CYCLES          ch1 &lt;- i     }      ch1 &lt;- -1     ch2 &lt;- 0.0 }  func chan_extractor(ch1 chan int, ch2 chan float64) {      const PORTION_SIZE = 100000     total := 0.0      for {         t1 := time.Now().UnixNano()         for i := 0; i &lt; PORTION_SIZE; i++ {             \/\/ burden cycle             for j := 0; j &lt; LOAD_CYCLES; j++ {                 i++             }             i = i - LOAD_CYCLES              m := &lt;-ch1             if m == -1 {                 ch2 &lt;- total             }         } \t\t         t2 := time.Now().UnixNano()         dt := float64(t2 - t1)\/1e9 \/\/nanoseconds ==&gt; seconds         total += dt         fmt.Println(dt)     } }   <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h5>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h5>\n<p>  \u041c\u0430\u0448\u0438\u043d\u0430: Intel, 4 \u044f\u0434\u0440\u0430 \u043f\u043e 3\u0413\u0413\u0446, 4 \u0413\u0411 RAM, linux-x86-64, kernel-3.11, golang-1.1.2<\/p>\n<p>  \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 runtime.MAXPROCS \u043d\u0430 \u043c\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0440\u0430\u0432\u043d\u043e 256. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0438 \u0431\u043e\u043b\u044c\u0448\u0435, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e 256. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e = 1.<\/p>\n<p>  \u0427\u0438\u0441\u043b\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 (ps -C channel_test01 -L)<br \/>  \u041f\u0440\u0438 -maxprocs=1: 3 \u043f\u043e\u0442\u043e\u043a\u0430.<br \/>  \u041f\u0440\u0438 -maxprocs=2 \u0438 \u0431\u043e\u043b\u0435\u0435: \u0432\u0441\u0435\u0433\u0434\u0430 4 \u043f\u043e\u0442\u043e\u043a\u0430.<\/p>\n<p>  \u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u043e\u0441\u044c \u0435\u0449\u0435 2 \u043f\u043e\u0442\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0443 \u043c\u0443\u0441\u043e\u0440\u0430.<\/p>\n<p>  (\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432 \/proc\/cpuinfo \u043d\u0430\u043b\u0438\u0447\u0438\u0435 24 \u044f\u0434\u0435\u0440. \u041d\u0430 \u043d\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u0432\u043d\u043e 4. \u041d\u043e \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u043b \u0438 \u043f\u044f\u0442\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u2014 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0436\u0430\u0434\u043d\u0430\u044f vds-\u043a\u0430 \u043d\u0435 \u0441\u043f\u0435\u0448\u0438\u043b\u0430 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c, \u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430 \u0432\u044b\u043b\u0435\u0437\u0430\u043b \u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f).<\/p>\n<h6>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043f\u0440\u0438 cycles = 1000 <\/h6>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/5b1\/986\/143\/5b19861430d520ba06dfcfaf59ced2ed.png\" alt=\"perf-procs graph\"\/><\/p>\n<p>  \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 MAXPROCS=1<\/p>\n<h6>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u043e\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u043b\u0430\u0441\u0442\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h6>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/f92\/8df\/fad\/f928dffadee01623e59c073dd1d06234.png\" alt=\"perf-load graph\"\/><\/p>\n<p>  \u041f\u043e\u0434 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435 \u0436\u0435 \u0431\u0435\u0440\u0435\u0442 \u0441\u0432\u043e\u0435.<\/p>\n<h5>\u0412\u044b\u0432\u043e\u0434\u044b \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432<\/h5>\n<p>  \u041f\u0440\u0438 maxprocs=1 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 1 \u043f\u043e\u0442\u043e\u043a, \u043f\u0441\u0435\u0432\u0434\u043e-\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u0433\u043e\u043b\u0430\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c.<br \/>  \u041f\u0440\u0438 maxprocs=2 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438, \u0438 \u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u043d\u0430 \u0441\u043f\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 2 \u0440\u0430\u0437\u0430.<br \/>  \u041f\u0440\u0438 maxprocs=3..256 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0435 \u0440\u0430\u0441\u0442\u0435\u0442, \u043d\u043e \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u00ab\u043f\u0441\u0435\u0432\u0434\u043e-\u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438\u00bb, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0433\u043e\u043b\u0430\u043d\u0433\u0430. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u00ab\u043f\u0441\u0435\u0432\u0434\u043e-\u043f\u043e\u0442\u043e\u043a\u043e\u0432\u00bb.<br \/>  \u0421 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c maxprocs (\u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 256) \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u0441\u0435\u0432\u0434\u043e-\u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430. \u041d\u043e \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u041d\u0430 \u0441\u043f\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445 \u044d\u0442\u043e \u043d\u0430\u043c \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 10% \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h5>\u0412\u044b\u0432\u043e\u0434.<\/h5>\n<p>  \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 runtime.MAXPROCS \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0435\u0441\u0442\u0438 \u043a\u0430\u043a \u0432\u044b\u0438\u0433\u0440\u044b\u0448, \u0442\u0430\u043a \u0438 \u043f\u043e\u0442\u0435\u0440\u044e \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f, \u0447\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f. \t\t\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\/195818\/\"> http:\/\/habrahabr.ru\/post\/195818\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043c\u0435\u043d\u044f \u0442\u043e\u043f\u0438\u043a \u043e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 Go: <a href=\"http:\/\/habrahabr.ru\/post\/195574\/\">habrahabr.ru\/post\/195574\/<\/a>.<br \/>  \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u0430\u043b \u0430\u0432\u0442\u043e\u0440\u0430 \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0438 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0442\u0435\u043c\u0430 \u0432\u0441\u0435 \u0436\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0430 \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<br \/>  \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c, \u0434\u0430\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043f\u043e\u043f\u0440\u043e\u0448\u0443 \u043f\u0440\u0438\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u0442\u0435\u0440\u043c\u0438\u043d \u00ab\u043f\u043e\u0442\u043e\u043a\u00bb \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u00abthread\u00bb, \u0430 \u043d\u0435 \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u00abstream\u00bb. \u0421\u043f\u0430\u0441\u0438\u0431\u043e.  <\/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-195818","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/195818","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=195818"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/195818\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=195818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=195818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=195818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}