[go-nuts] Re: database/sql: Latency when calling DB.QueryContext()

2017-06-29 Thread Kai Zhang
In the mysqlConn.Close() method of mysql driver, it just send a quit command, not wait for the server reply. So the latency is neglectable. But in my sql driver, I did some clean up, that make the conn.Close() block. Now I fix this problem by doing close asynchronously, and keep conn.Close() r

[go-nuts] Re: database/sql: Latency when calling DB.QueryContext()

2017-06-29 Thread Kai Zhang
here is the benchmark result for mysql driver: k@k-ThinkPad-X270:sql$ go test -v -bench . --benchtime 60s -parallel 10 BenchmarkNoMaxLifetime-4 1000 13480 ns/op BenchmarkMaxLifetime1S-4 1000 14356 ns/op PASS ok _/home/k/Desktop/work/test/sql 303.967s The benchmark code is he

[go-nuts] Re: database/sql: Latency when calling DB.QueryContext()

2017-06-29 Thread Kai Zhang
Thanks for the reply. > I don't think this has anything to do with the Context method variants or > Context related code. > Yes, the DB.Query() method also has this problem. This is just two different checks. One when the connection is returned, one > periodically. You seemed to say this wa

Re: [go-nuts] Re: Why copy is much slower than append when clone a slice?

2017-06-29 Thread Keith Randall
On Thu, Jun 29, 2017 at 12:04 PM, notcarl via golang-nuts < golang-nuts@googlegroups.com> wrote: > If Element was a pointer type, it would need to zero it first though, > right? > > Yes, the don't-bother-zeroing optimization can only be done for pointerless types. > > On Tuesday, June 27, 2017 a

Re: [go-nuts] Re: Why copy is much slower than append when clone a slice?

2017-06-29 Thread notcarl via golang-nuts
If Element was a pointer type, it would need to zero it first though, right? On Tuesday, June 27, 2017 at 8:11:01 PM UTC-7, Keith Randall wrote: > > This looks like it is all due to the extra zeroing required for the Copy > test. CloneWithAppend does not need to zero the newly allocated slice >

[go-nuts] Re: database/sql: Latency when calling DB.QueryContext()

2017-06-29 Thread Daniel Theophanes
I don't think this has anything to do with the Context method variants or Context related code. This is just two different checks. One when the connection is returned, one periodically. You seemed to say this was introducing latency. Can you make some benchmarks with a real driver, one with the

[go-nuts] Re: Why copy is much slower than append when clone a slice?

2017-06-29 Thread homemadepicklesrgood
this simplified group of files show the same anomaly: https://gist.github.com/homemadepicklesaregood/fc25f3f7bf294bb919a8f8d2986d0d87 those knowing the internals of the introduced calls(growslice, slicepanic) within clone1.s should be able to pin point the cause. there also seems to be a bit mo

[go-nuts] Re: json unmarshling error > cannot unmarshal object into Go struct field ParticipantIty.Player of type []utils.Playe

2017-06-29 Thread suburb4nfilth
That was it, i had a few more errors of the same type with other structs, but then i followed your advice and everything works now. Thank you! On Thursday, June 29, 2017 at 3:42:24 PM UTC+3, C Banning wrote: > > Try: > >> type ParticipantIty struct { >> ParticipantId int >> PlayerPla

[go-nuts] can you point me in the direction of some well designed restful apis built in golang?

2017-06-29 Thread Eoin Ahern
hi Guys, I was wondering if you can you point me in the direction of some well designed restful apis build in golang ? Ive already built a small restful api with golang. it works but its small scale toy project. I would like to look at a few open source api's built with golang th

[go-nuts] Re: json unmarshling error > cannot unmarshal object into Go struct field ParticipantIty.Player of type []utils.Playe

2017-06-29 Thread C Banning
Try: > type ParticipantIty struct { > ParticipantId int > PlayerPlayer > } > On Thursday, June 29, 2017 at 6:10:03 AM UTC-6, Martin Spasov wrote: > > Hey guys, > > I have been trying to decode a json object into a struct with nested > structs. When the struct is 1 level deep it

[go-nuts] Re: Go 1.9 Beta 2 is released

2017-06-29 Thread alb . donizetti
But if you have other numbers please share them, it'll certainly interesing to see them. Il giorno giovedì 29 giugno 2017 13:38:18 UTC+2, Parker Evans ha scritto: > > Congratulations on the Beta 2 release, pretty excited to test it out. > Lots of interesting updates! > > I did notice one thing w

[go-nuts] Re: Go 1.9 Beta 2 is released

2017-06-29 Thread alb . donizetti
Unstripped "hello world"s are ~20% bigger on my Linux system too, but it seems like the loss is much smaller on real programs, e.g. see Brad comment here: https://github.com/golang/go/issues/6853#issuecomment-307155309 A. Il giorno giovedì 29 giugno 2017 13:38:18 UTC+2, Parker Evans ha scritto

[go-nuts] json unmarshling error > cannot unmarshal object into Go struct field ParticipantIty.Player of type []utils.Playe

2017-06-29 Thread suburb4nfilth
Hey guys, I have been trying to decode a json object into a struct with nested structs. When the struct is 1 level deep it does not create problems, but if i have a struct with an attribute that is a struct i get the error present in the title. Here is part of the code : Json : { "

[go-nuts] Re: Go 1.9 Beta 2 is released

2017-06-29 Thread Parker Evans
Congratulations on the Beta 2 release, pretty excited to test it out. Lots of interesting updates! I did notice one thing when I was playing around with Beta 1 and now Beta 2 that I wanted to ask about. Is it expected that binary size would increase in this release? A toy example that has be

Re: [go-nuts] Re: Canonical http upload code

2017-06-29 Thread Kai Hendry
Just to conclude since I accidentally went into a private conversation with Dave, that a simple example here: https://github.com/kaihendry/go-upload Handles large uploads with ease. Something is amiss with https://github.com/wmark/caddy.upload/issues/24 that I need to track down, though I've got a

[go-nuts] Re: golang thrift server 28k/s request client many dial tcp timeout ,why??

2017-06-29 Thread Kai Zhang
May be reach the max file descriptor limit , when timeout occurred, may check the output of following command on the server side ss -lnt On Thursday, June 8, 2017 at 11:58:55 PM UTC+8, 刘桂祥 wrote: > >I have a very simple golang thrift server. the handle is very easy > just to return >

[go-nuts] Re: golang thrift server 28k/s request client many dial tcp timeout ,why??

2017-06-29 Thread Kai Zhang
May be read max file descriptor limit , when timeout occurred, may check the output of following command on the server side ss -lnt On Thursday, June 8, 2017 at 11:58:55 PM UTC+8, 刘桂祥 wrote: > >I have a very simple golang thrift server. the handle is very easy > just to return >

[go-nuts] database/sql: Latency when calling DB.QueryContext()

2017-06-29 Thread Kai Zhang
Go version 1.8.3 In DB.QueryContext(), Go will close long live connection which exceeded the duration setted by DB.SetConnMaxLifetime(), the code is below database/sql/sql.go 895 func (db *DB) conn(ctx context.Context, strategy connReuseStrategy) (*driverConn, error) { 896 db.mu.Lock() 8