2018/05/22 10:59:05 HydrateCollection took 41.497134ms
2018/05/22 10:59:05 HydrateCollection took 42.695152ms
2018/05/22 10:59:05 HydrateCollection took 22.870913ms
2018/05/22 10:59:05 HydrateCollection took 17.833512ms
2018/05/22 10:59:05 HydrateCollection took 18.765984ms
2018/05/22 10:59:05 HydrateCollection took 16.338906ms
2018/05/22 10:59:05 HydrateCollection took 14.660654ms
2018/05/22 10:59:05 HydrateCollection took 20.818716ms
2018/05/22 10:59:05 HydrateCollection took 18.57054ms
2018/05/22 10:59:05 Resolving Items took 172.9182ms
2018/05/22 10:59:05 SelectCollections took 173.992051ms
2018/05/22 11:21:36 HydrateCollection took 9.187861ms
2018/05/22 11:21:36 HydrateCollection took 63.651507ms
2018/05/22 11:21:36 HydrateCollection took 79.199976ms
2018/05/22 11:21:36 HydrateCollection took 122.349986ms
2018/05/22 11:21:37 HydrateCollection took 150.627746ms
2018/05/22 11:21:37 HydrateCollection took 168.432517ms
2018/05/22 11:21:37 HydrateCollection took 171.602705ms
2018/05/22 11:21:37 HydrateCollection took 179.127794ms
2018/05/22 11:21:37 HydrateCollection took 185.137562ms
2018/05/22 11:21:37 Resolving items took 185.434821ms
2018/05/22 11:21:37 SelectCollections took 187.358141ms
hydrateChan := make(chan error, len(collections))
for index := range collections {
go func(coll *Collection) {
hydrateChan <- r.hydrateCollection(coll)
}(&collections[index])
}
for i := 0; i < len(collections); i++ {
err := <-hydrateChan
if err != nil {
logrus.Error(err)
}
}
Is it possible that
whatever connection HydrateCollection is operating on cannot handle
multiple concurrent requests?
-j
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 concurrency is introduced.