-
Notifications
You must be signed in to change notification settings - Fork 251
Open
Labels
effort/daysEstimated to take multiple days, but less than a weekEstimated to take multiple days, but less than a weekexp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulkind/enhancementA net-new feature or improvement to an existing featureA net-new feature or improvement to an existing featureneed/triageNeeds initial labeling and prioritizationNeeds initial labeling and prioritization
Description
The ProviderManager has a single event loop for managing all requests (puts, gets, etc.)
func (pm *ProviderManager) run(proc goprocess.Process) { |
The major operations in the event loop such as add and get provider block the event loop and can potentially take a long time (e.g. a network based datastore lookup)
go-libp2p-kad-dht/providers/providers_manager.go
Lines 135 to 153 in 06918c8
case np := <-pm.newprovs: | |
err := pm.addProv(np.key, np.val) | |
if err != nil { | |
log.Error("error adding new providers: ", err) | |
continue | |
} | |
if gcSkip != nil { | |
// we have an gc, tell it to skip this provider | |
// as we've updated it since the GC started. | |
gcSkip[mkProvKeyFor(np.key, np.val)] = struct{}{} | |
} | |
case gp := <-pm.getprovs: | |
provs, err := pm.getProvidersForKey(gp.key) | |
if err != nil && err != ds.ErrNotFound { | |
log.Error("error reading providers: ", err) | |
} | |
// set the cap so the user can't append to this. | |
gp.resp <- provs[0:len(provs):len(provs)] |
This would lead to the provide manager getting backlogged and a slow down in network responses.
If instead we allow for parallelism on the calls happening within the event loop, such as allowing many adds or gets happening at the same time, then we'd be enabling users to reduce response latencies by increasing the resources they use.
Metadata
Metadata
Assignees
Labels
effort/daysEstimated to take multiple days, but less than a weekEstimated to take multiple days, but less than a weekexp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulkind/enhancementA net-new feature or improvement to an existing featureA net-new feature or improvement to an existing featureneed/triageNeeds initial labeling and prioritizationNeeds initial labeling and prioritization