You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything is received properly by the channel, meaning if 3000 CIDs were provided I will definitely get 3000 counter appear in the log message. So after a lot of replications I think that the select statement in the db/client.go file is causing the problem.:
gofunc(wg*sync.WaitGroup, persisterIDint) {
deferwg.Done()
logEntry:=log.WithField("persister", persisterID)
for {
// give priority to the dbDone channel if it closedselect {
case<-db.doneC:
logEntry.Info("finish detected, closing persister")
returndefault:
}
select {
casep:=<-db.persistC:
switchp.(type) {
case (*models.CidInfo):
....
case (*models.PeerInfo):
....
case (*models.CidFetchResults):
....
}
case<-db.ctx.Done():
logEntry.Info("shutdown detected, closing persister")
return
}
}
}(&persisterWG, persister)
From my experience select statements can become slow. In this particular instance some CIDs might take up (from what I have observed it might be more or less) to 30 minutes to be inserted into the database. In the end everything is inserted into the DB as expected.
Although I am not 100% certain the select statement is at fault, maybe the logic of inserting into the database is slow in it of itself.
The text was updated successfully, but these errors were encountered:
FotiosBistas
changed the title
Persisting into DB
Persisting into DB becoming very slow
Jan 14, 2023
You are right - the process could go much faster if we were writing into the DB more efficiently.
I'll try to implement a SQL query batching system, which should remove a huge part of the select bottleneck
Problem
I encountered this during the development of the HTTP server. I have inserted debug messages inside the
hoarder/discoverer.go
file:Everything is received properly by the channel, meaning if 3000 CIDs were provided I will definitely get 3000 counter appear in the log message. So after a lot of replications I think that the select statement in the
db/client.go
file is causing the problem.:From my experience select statements can become slow. In this particular instance some CIDs might take up (from what I have observed it might be more or less) to 30 minutes to be inserted into the database. In the end everything is inserted into the DB as expected.
Although I am not 100% certain the select statement is at fault, maybe the logic of inserting into the database is slow in it of itself.
The text was updated successfully, but these errors were encountered: