On Mon, Feb 1, 2021 at 9:33 AM 颜文泽 <nnsmgs...@gmail.com> wrote:
>
>
> $ go version
> go version go1.13 linux/amd64
>
>
> I'm not sure how to deal with this phenomenon when I find that the parallel 
> performance using go routine is not very good when writing database(olap) 
> code.

What does runtime.GOMAXPROCS(0) return on your system?

In general the Go runtime is optimized for the case where there are
more goroutines than there are processors.  Goroutines that run for a
long time without yielding the processor are preempted.  I don't think
that preemption process considers the possibility that there is
nothing else to do.

Do you expect your real program that have long running CPU-bound
goroutines, and to not have any other work to do (i.e., no network
connections and no file I/O)?  If so the goroutine scheduler may not
be well tuned for your code.

Also note that the scheduler changed significantly in Go 1.14, so it's
worth testing that.  I have no particular reason to think that it will
be better, but it may well be different.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWbb101_AxigbuUiTbwk_ZJKoA97TAtXfJQx4Ji799k2g%40mail.gmail.com.

Reply via email to