Re: [go-nuts] Why is go starting multiple child process?

2018-09-16 Thread the . warl0ck . 1989
Yeah, -T works in Arch, these are threads, not processes. Case closed :-) On Monday, September 17, 2018 at 12:55:30 PM UTC+8, Patrick Smith wrote: > > I don't know about Ubuntu 16.04. On my Arch Linux system, 'pstree -V' > shows "pstree (PSmisc) 23.1" > > On Sun, Sep 16, 2018 at 9:28 PM > > wro

Re: [go-nuts] Why is go starting multiple child process?

2018-09-16 Thread Michael Banzon
On Ubuntu you should be able to make it fancy and use htop with colouring of threads ;-) / Michael Den 17. sep. 2018 kl. 06.56 skrev Patrick Smith mailto:pat42sm...@gmail.com>>: I don't know about Ubuntu 16.04. On my Arch Linux system, 'pstree -V' shows "pstree (PSmisc) 23.1" On Sun, Sep 16,

Re: [go-nuts] Why is go starting multiple child process?

2018-09-16 Thread Patrick Smith
I don't know about Ubuntu 16.04. On my Arch Linux system, 'pstree -V' shows "pstree (PSmisc) 23.1" On Sun, Sep 16, 2018 at 9:28 PM wrote: > There's no -T in Ubuntu 16.04, am I wrong? > > On Monday, September 17, 2018 at 11:54:05 AM UTC+8, Patrick Smith wrote: >> >> Probably those are threads, no

Re: [go-nuts] Why is go starting multiple child process?

2018-09-16 Thread robert engels
You can use ‘top’ and use H to show threads. > On Sep 16, 2018, at 11:27 PM, the.warl0ck.1...@gmail.com wrote: > > There's no -T in Ubuntu 16.04, am I wrong? > > On Monday, September 17, 2018 at 11:54:05 AM UTC+8, Patrick Smith wrote: > Probably those are threads, not processes. Try 'pstree -T'.

Re: [go-nuts] Periodic task when time.Ticker and time.Sleep are pretty expensive

2018-09-16 Thread robert engels
For reference, similar code under Java consumes 2.5 % CPU. I tested the Go code under OSX, and it is roughly 10%, which seems to be very high. Might be because the “context switching” is performed/attributed to the process (since it is internal), where for other systems it is the system call on

Re: [go-nuts] Why is go starting multiple child process?

2018-09-16 Thread the . warl0ck . 1989
There's no -T in Ubuntu 16.04, am I wrong? On Monday, September 17, 2018 at 11:54:05 AM UTC+8, Patrick Smith wrote: > > Probably those are threads, not processes. Try 'pstree -T'. Also, I > believe the variable name is GOMAXPROCS, with an S at the end. > > On Sun, Sep 16, 2018 at 8:35 PM > > wro

[go-nuts] Re: http client POST/GET.. will not save cookie before do redirect request

2018-09-16 Thread Agniva De Sarker
On Thursday, 13 September 2018 08:15:20 UTC+5:30, Weeds Qian wrote: > > If you look at my sample code, you should know I only send one request by > http.POST, the following request is done by golang http client automaticly, > not issue by myself. > > You got the point , why the http client do

Re: [go-nuts] Why is go starting multiple child process?

2018-09-16 Thread robert engels
It appears (on OSX at least) the minimum number of threads a Go process will be 5. You need to understand that there are multiple threads for usually the following reasons: signal handling, GC collection, monitoring, OS events, timers, and others. The number of threads is going to vary based on

Re: [go-nuts] Why is go starting multiple child process?

2018-09-16 Thread Patrick Smith
Probably those are threads, not processes. Try 'pstree -T'. Also, I believe the variable name is GOMAXPROCS, with an S at the end. On Sun, Sep 16, 2018 at 8:35 PM wrote: > package main > import ( > "log" > "time") > > func main () { > log.Println("sleep 30s") > time.Sleep(30 * ti

[go-nuts] Why is go starting multiple child process?

2018-09-16 Thread the . warl0ck . 1989
0down votefavorite I have a simple go program like this, package main import ( "log" "time") func main () { log.Println("sleep 30s") time.Sleep(30 * time.Second)} When I star

Re: [go-nuts] A simplified generics constraint system.

2018-09-16 Thread Jonathan Amsterdam
On Friday, September 14, 2018 at 8:06:31 PM UTC-4, alanfo wrote: > > Thanks for your comments, Jonathan. > > I did in fact deal with all the cases you mention in my 'fuller' proposal: > > https://gist.github.com/alanfo/5da5932c7b60fd130a928ebbace1f251 > > where I'd used a device to restrict the b

Re: [go-nuts] Re: Perf : Multithreaded goroutines files I/O

2018-09-16 Thread Michael Jones
don't be confused about internal process time and external wall clock time here. On Sun, Sep 16, 2018 at 11:27 AM Thomas Solignac wrote: > I think the concurrent read overhead compensates the process > parallelization ! > > Both files are in attachment. > > Thank you for helping :-) > > > > Le d

Re: [go-nuts] modules and package cyclic dips

2018-09-16 Thread Sameer Ajmani
Hi Scott, thanks for boiling this down to the specific behavior you're looking for. Is there a specific feature request you'd like to make for this? If so, please file it in golang.org/issue. Thanks! S On Sun, Sep 16, 2018 at 4:01 PM Scott Cotton wrote: > Hi all, > > I just ran a test and answer

Re: [go-nuts] modules and package cyclic dips

2018-09-16 Thread thepudds1460
Hi Scott, Great, it looks like you ran your own test too. (We had both posted at approximately the same time a few minutes ago). --thepudds On Sunday, September 16, 2018 at 4:05:16 PM UTC-4, thepud...@gmail.com wrote: > > Hi Scott, > > Regarding your question about pre-release tags and 'go g

Re: [go-nuts] modules and package cyclic dips

2018-09-16 Thread thepudds1460
Hi Scott, Regarding your question about pre-release tags and 'go get -u', my understanding is that when the documentation says: 'The -u flag instructs get to update dependencies to use newer minor or patch releases when available.' ...the use of the phrase 'newer minor or patch release'

Re: [go-nuts] modules and package cyclic dips

2018-09-16 Thread Scott Cotton
Hi all, I just ran a test and answered my own question: It does not consider a "prerelease" a "release", so get get -u doesn't update to prereleases. In case it helps anyone, this distinction of terminology was unclear to me in the move to support prereleases. Apparently, a prerelease is not a

[go-nuts] Re: Perf : Multithreaded goroutines files I/O

2018-09-16 Thread Thomas Solignac
I think the concurrent read overhead compensates the process parallelization ! Both files are in attachment. Thank you for helping :-) Le dimanche 16 septembre 2018 20:02:33 UTC+2, Marc Zahn a écrit : > > You mean, loading the files in parallel take the ~same time as loading > them sequentia

[go-nuts] Re: Snapshot data with Go

2018-09-16 Thread Tamás Gulácsi
Create your key-value store in mmap - like coreos/boltdb. 2018. szeptember 16., vasárnap 5:44:18 UTC+2 időpontban Kasun Vithanage a következőt írta: > > I'm developing a *redis **like *server with Go. You can see the code repo > here . > I need to dump my *Mutex

[go-nuts] Re: Perf : Multithreaded goroutines files I/O

2018-09-16 Thread marc . zahn
You mean, loading the files in parallel take the ~same time as loading them sequentially? It seems that there is somewhere else a bottleneck... Am Sonntag, 16. September 2018 14:08:50 UTC+2 schrieb Thomas Solignac: > > Hello, > > I have a loading step, where I have something like 60 files to read

Re: [go-nuts] modules and package cyclic dips

2018-09-16 Thread Scott Cotton
Thanks again @thepudds for the helpful info. with module aware go get -u at tip on golang.org, it says """ The -u flag instructs get to update dependencies to use newer minor or patch releases when available. Continuing the previous example, 'go get -u A' will use the latest A with B v1.3.1 (not B

Re: [go-nuts] modules and package cyclic dips

2018-09-16 Thread thepudds1460
Hi Scott, Modules do provide support for semver pre-release notation. You can read more about it in these sections of the documentation, for example: https://tip.golang.org/cmd/go/#hdr-Module_queries https://tip.golang.org/cmd/go/#hdr-Pseudo_versions https://tip.golang.org/cmd/go/#hdr-Modu

Re: [go-nuts] modules and package cyclic dips

2018-09-16 Thread Scott Cotton
Thanks Sameer, I have a question about semver and modules, perhaps it was already answered somewhere, but if so I don't know where. The question is: semver.org allows for pre-release notation, the document below does not mention pre-release. To some extent Go uses pre-releases. I, for one, find

Re: [go-nuts] Periodic task when time.Ticker and time.Sleep are pretty expensive

2018-09-16 Thread Lei Ni
Thanks for the input Jan! When running the following exact code, I saw 20% %CPU in top as well, measured on a single socket E5-2696v4 server without any vm/container/CPU intensive task. package main import ( "time" ) func main() { ticker := time.NewTicker(time.Millisecond) defer tick

Re: [go-nuts] Perf : Multithreaded goroutines files I/O

2018-09-16 Thread Thomas Solignac
Thanks for your complementary answers. I guess NVMe disks could make my actual design efficient. But in actual configuration, I suppose so, the best design would be something like : [Reading routine x 1] -Channel> [Process routine x N] Le dimanche 16 septembre 2018 14:45:25 UTC+2, S

Re: [go-nuts] Perf : Multithreaded goroutines files I/O

2018-09-16 Thread Sameer Ajmani
Yes, Go can do concurrent file I/O. You might try using the execution tracer to see whether you're getting the parallelism you expect. There's a tutorial here: https://blog.gopheracademy.com/advent-2017/go-execution-tracer/ You might also check out my blog post on constructing parallel goroutine p

Re: [go-nuts] Perf : Multithreaded goroutines files I/O

2018-09-16 Thread Jan Mercl
On Sun, Sep 16, 2018 at 2:09 PM Thomas Solignac wrote: > I tried loading with goroutines and without, and I get substantially the same process time (38s). The I/O speed of the disk device as well of the interface it's connected to is finitie. Throwing more goroutines at the task can have a speed

[go-nuts] Perf : Multithreaded goroutines files I/O

2018-09-16 Thread Thomas Solignac
Hello, I have a loading step, where I have something like 60 files to read and process, as fast as possible. I tried loading with goroutines and without, and I get substantially the same process time (38s). *What is the more idiomatic ? Is Golang designed for concurrent files I/O ?* Note : One

[go-nuts] Re: Reproducible builds and rewriting buildid in binary

2018-09-16 Thread Ivan Daniluk
Wrong link to the related Go's issue. It's https://github.com/golang/go/issues/16860. On Sunday, September 16, 2018 at 2:49:19 PM UTC+3, Ivan Daniluk wrote: > > I needed to find a way to create reproducible builds, regardless of the > dev environment user uses. Luckily, Go gives almost everythin

[go-nuts] Reproducible builds and rewriting buildid in binary

2018-09-16 Thread Ivan Daniluk
I needed to find a way to create reproducible builds, regardless of the dev environment user uses. Luckily, Go gives almost everything needed for that out-of-the-box, and there is a great blog post by Filippo on the topic: https://blog.filippo.io/reproducing-go-binaries-byte-by-byte. If we have

Re: [go-nuts] Re: Snapshot data with Go

2018-09-16 Thread Peter Mogensen
On 09/16/2018 12:12 PM, Kasun Vithanage wrote: > Yes, forking is done using the OS. I was thinking of a workaround with go > The reason this works in (say) redis, is the copy-on-write feature of the kernel you get with the fork. You would have to implement all this in userspace to make a workar

[go-nuts] Re: Snapshot data with Go

2018-09-16 Thread Kasun Vithanage
Yes, forking is done using the OS. I was thinking of a workaround with go On Sunday, September 16, 2018 at 2:24:03 PM UTC+5:30, Lei Ni wrote: > > I am trying to do the same, but according to my understanding you can't do > that in Golang. When fork is called on Linux, the duplicated child process

Re: [go-nuts] Periodic task when time.Ticker and time.Sleep are pretty expensive

2018-09-16 Thread Jan Mercl
On Sun, Sep 16, 2018 at 10:49 AM Lei Ni wrote: func main() { ... for { select { case <-ticker.C: // call my function here } } } Is the above the actual code you're using for the CPU usage "benchmark"?

Re: [go-nuts] Contracts and fused multiply add

2018-09-16 Thread Wojciech S. Czarnecki
On Sat, 15 Sep 2018 11:53:51 +0200 "Wojciech S. Czarnecki" wrote: > With CGG `for type` contracts now you can use constraint > that allows for any custom type of base float64 Ie. **precisely** castable to a base of float64, so substitute type T with base of float32 will be treated as float32 >

[go-nuts] Re: Snapshot data with Go

2018-09-16 Thread Lei Ni
I am trying to do the same, but according to my understanding you can't do that in Golang. When fork is called on Linux, the duplicated child process is created with only one thread - the thread that called fork. This basically means your child process no longer has a working Go runtime/environ

[go-nuts] Periodic task when time.Ticker and time.Sleep are pretty expensive

2018-09-16 Thread Lei Ni
Hi all, In my Go program, I need to call a function roughly every millisecond. There is no hard real time requirement, so as long as I can call that function roughly 1,000 times a second (or let's say every 0.9-1.1 millisecond) everything is fine. I found time.Ticker and time.Sleep are both p

Re: [go-nuts] efficient way to csv.Reader() from a chan of string

2018-09-16 Thread Sherif Eldeeb
Even though Yannic's answer was really useful and appreciated, I ended up using io.Pipe() which looks simpler and more efficient (explained below): rp, wp := io.Pipe() go func() { defer wp.Close() for i := range feederChan { fmt.Fprintln(wp, i) } }(

[go-nuts] Is it safe that use a PoW NodeID and S/Kad DHT to replace CA cert in TLS

2018-09-16 Thread Auxten wpc
To implement a decentralized database named CovenantSQL , I wrote a TLS like P2P net stack. The main idea is removing CA Cert from the whole system by using a DHT for Naming and Key Exchange.* I am not a crypto expert, so if there's any flaw please