Optimization for number of goroutines using feedback controlPepabo R&D Institute, GMO Pepabo, Inc. 2019.07.25 GopherCon 2019 Optimization for number of goroutines using feedback control Principal engineer Yusuke MIYAKE @monochromegane Pepabo R&D Institute Introduction How many is the optimal number of goroutines? Performance tuning in case of pt �7 Find Goroutines Chan Chan Search Match pt Print … 8-32 goroutines (NumCPU*2-8) Linux, 4CPU, GOMAXPROCS=4 GOMAXPROCS=4 Performance tuning in case of pt �8 Find Goroutines Chan Chan Search Match pt Print … Real-time virus scan process Unstable 16 goroutines(NumCPU*2) macOS, 8CPU, GOMAXPROCS=8 Performance0 码力 | 66 页 | 13.04 MB | 1 年前3
The Way To Go - 2012.........371 Chapter 14—Goroutines and Channels ............................................................................375 14.1 Concurrency, parallelism and goroutines ......................... ....................................375 14.1.1 What are goroutines? ...............................................................................375 14.1.2 The difference between concurrency and parallelism command-line?.....379 14.1.5 Goroutines and coroutines .......................................................................381 14.2 Channels for communication between goroutines .......................0 码力 | 629 页 | 4.85 MB | 1 年前3
Go 101 (Golang 101) v1.21.0Package Imports §11. Expressions, Statements and Simple Statements §12. Basic Control Flows §13. Goroutines, Deferred Function Calls and Panic/Recover Go Type System §14. Go Type System Overview - a must concurrent programming support goroutines (green threads) and start new goroutines easily. channels (based on CSP model) and select mechanisms to do synchronizations between goroutines. the container types map either declared before or after any of its calls. Function calls can be deferred or invoked in new goroutines (green threads) in Go. Please read a later article (§13) for details. Exiting (or Returning)0 码力 | 630 页 | 3.77 MB | 1 年前3
Go 101 (Golang 101) v1.21.0Package Imports §11. Expressions, Statements and Simple Statements §12. Basic Control Flows §13. Goroutines, Deferred Function Calls and Panic/Recover Go Type System §14. Go Type System Overview - a concurrent programming support goroutines (green threads) and start new goroutines easily. channels (based on CSP model) and select mechanisms to do synchronizations between goroutines. the container types map either declared before or after any of its calls. Function calls can be deferred or invoked in new goroutines (green threads) in Go. Please read a later article (§13) for details. Exiting (or Returning) Phase0 码力 | 610 页 | 945.17 KB | 1 年前3
Go 101 (Golang 101) v1.21.0Package Imports §11. Expressions, Statements and Simple Statements §12. Basic Control Flows §13. Goroutines, Deferred Function Calls and Panic/Recover Go Type System §14. Go Type System Overview - a must concurrent programming support goroutines (green threads) and start new goroutines easily. channels (based on CSP model) and select mechanisms to do synchronizations between goroutines. the container types map either declared before or after any of its calls. Function calls can be deferred or invoked in new goroutines (green threads) in Go. Please read a later article (§13) for details. Exiting (or Returning) Phase0 码力 | 880 页 | 833.34 KB | 1 年前3
Real World Goanalogue: goroutines connected by channels. 3 Google Confidential Concurrency: goroutines Goroutines are like threads: • They share memory. But cheaper: • Smaller, segmented stacks. • Many goroutines per synchronization Look back at the sort example - how to tell when it’s done? Use a channel to synchronize goroutines: done := make(chan bool) doSort := func(s []int) { sort(s) done <- true } i := pivot(s) process(task) } } 3 Google Confidential Concurrency: communication A Go idiom: many worker goroutines receive tasks from a channel. type Task struct { // some state } func worker(in, out chan0 码力 | 49 页 | 595.19 KB | 1 年前3
Don’t print, Go debug!Print! Attach to process Debug Goroutines plan Superpower! 1 2 3 4 5 6 First steps Run to cursor Don’t debug. Print! Attach to process Debug Goroutines plan Superpower! 1 2 3 4 5 process Debug Goroutines Debug! What’s instead? First steps! plan Superpower! 1 2 3 4 5 6 First steps Run to cursor Don’t debug. Print! Attach to process Debug Goroutines Try to be faster Superpower! 1 2 3 4 5 6 First steps Run to cursor Don’t debug. Print! Attach to process Debug Goroutines Rarely you still need to print… Almost 9 years ago, while in Scala, I had an epic: The fix0 码力 | 36 页 | 1.15 MB | 1 年前3
Build web application with Golanggoroutine goroutines and concurrency are built into the core design of Go. They're similar to threads but work differently. Go also gives you full support to sharing memory in your goroutines. One goroutine it's not hard to run thousands of goroutines on a single computer. A goroutine is more lightweight, more efficient and more convenient than system threads. goroutines run on the thread manager at runtime it's very easy to use concurrency in Go by using the keyword go . In the above example, these two goroutines share some memory, but we would better off following the design recipe: Don't use shared data0 码力 | 327 页 | 1.63 MB | 1 年前3
The Expressiveness of Go
the same mechanism Orthogonality again! Monday, October 18, 2010 Concurrency and closures 33 Goroutines, channels, stacks and closures Monday, October 18, 2010 The model 34 Go has native support deterministic (well-defined ordering) and non-deterministic (mutual exclusion but order undefined). Go's goroutines and channels promote deterministic concurrency (e.g. channels with one sender, one receiver), make it good, you need: - stack management - closures Monday, October 18, 2010 Stacks 38 Goroutines have "segmented stacks": go f() starts f() executing concurrently on a new stack. Stack grows0 码力 | 49 页 | 839.26 KB | 1 年前3
1.3 Go practices in TiDB 姚维out all running goroutines ● Before the unit test runs, remembers all running goroutines ● After the unit test is finished, if there are any new goroutines, that are leaked goroutines func TestT(t *testing0 码力 | 32 页 | 1.76 MB | 6 月前3
共 88 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













