Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gce: rm unnecessary GetMigInstanceTemplate locking
The lock held from (and covering most of) `GetMigInstanceTemplate()` prevents `InstanceTemplates.Get()` concurrent executions, while it's not really needed as all caches access functions used here already take care of locking cache accesses (and it's reading and filling one single cache entry per call). `InstanceTemplates.Get()` isn't fast (at about 0.5s/call in my test env), running all calls sequentially slows down startup significantly: ``` forceRefresh() fetchAutoMigs() workqueue.ParallelizeUntil(..., func() { <- can launch concurrent registerMigs registerMig() GetMigTemplateNode() GetMigInstanceTemplate() <- lock held FetchMigTemplate() client.gceService.InstanceTemplates.Get() <- slow API call ``` When running this change on a cluster having 800 MIGs, startup went from 6min to 1.5min. Also tested with a `-race` build.
- Loading branch information