Re: [go-nuts] Performance hit when using goroutine

2018-05-22 Thread Dave Cheney
The execution tracer will show this as it tracks resources that goroutines block on. Seriously I’m just going to keep suggesting the execution tracer until you try it :) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] Performance hit when using goroutine

2018-05-22 Thread Burak Serdar
On Tue, May 22, 2018 at 12:21 AM, Hawari Rahman wrote: > Hi Burak, > > Thank you for your reply, > Inside the HydrateCollection function there are database queries (at least > three), run using the same *sql.DB throughout the application. > >> Is it possible that >>

[go-nuts] Performance hit when using goroutine

2018-05-22 Thread Dave Cheney
The best tool to investigate this problem is the execution tracer. It will show you the activity of goroutines over time making is easy to spot contention. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Performance hit when using goroutine

2018-05-22 Thread Justin Israel
On Tue, May 22, 2018, 6:35 PM Hawari Rahman wrote: > After some more detailed investigation, it seems the most time consuming > process is a "Select by IDs" query. So to hydrate a Collection object, I > need to retrieve another objects through a SELECT WHERE id =

Re: [go-nuts] Performance hit when using goroutine

2018-05-22 Thread Jan Mercl
On Tue, May 22, 2018 at 7:12 AM Hawari Rahman wrote: > Is there something that I need to address in the previous code snippet? It's necessary to analyze and understand the code to figure out if adding concurrency makes sense. Just running many tasks in goroutines does

Re: [go-nuts] Performance hit when using goroutine

2018-05-22 Thread Hawari Rahman
After some more detailed investigation, it seems the most time consuming process is a "Select by IDs" query. So to hydrate a Collection object, I need to retrieve another objects through a SELECT WHERE id = ANY(?)" query in postgres. I'm curious on how the performance can differs greatly when

Re: [go-nuts] Performance hit when using goroutine

2018-05-22 Thread Hawari Rahman
Hi Burak, Thank you for your reply, Inside the HydrateCollection function there are database queries (at least three), run using the same *sql.DB throughout the application. Is it possible that > whatever connection HydrateCollection is operating on cannot handle > multiple concurrent

Re: [go-nuts] Performance hit when using goroutine

2018-05-21 Thread Burak Serdar
On Mon, May 21, 2018 at 11:12 PM, Hawari Rahman wrote: > Hi Everyone, > > So for the background, I have an API for retrieving data from a database. > For an endpoint there exists two function calls: > - SelectCollections - for retrieving the collection records > -

[go-nuts] Performance hit when using goroutine

2018-05-21 Thread Hawari Rahman
Hi Everyone, So for the background, I have an API for retrieving data from a database. For an endpoint there exists two function calls: - SelectCollections - for retrieving the collection records - HydrateCollection - for hydrating each collections (the second function is called on each