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
{{ message }}
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
使用的是微博搜索那个例子,将数据改为从自己数据库中搜索,但是写入的速度很慢,每分钟只能写入3000-5000条,已经使用了协程,不知道是不是哪里写错了。代码如下
Using the Weibo search example, the data is changed to search from my own database, but the write speed is very slow, only 3000-5000 can be written per minute. Correspondence has been used,I don't know where it was wrong.Code show as below
for i := 0; i < 100; i++ {
go indexXwz(xwzs)
}
func indexXwz(xwzs <-chan Xwz) {
for xwz := range xwzs {
searcher.IndexDoc(xwz.Id, types.DocIndexData{
Content: xwz.Name,
Fields: XwzScoringFields{
Timestamp: xwz.LatestDate,
CountNum: xwz.CountNum,
},
}, true)
}
searcher.Flush()
}
The text was updated successfully, but these errors were encountered:
@Cliff2016 Using internal sharding instead of fork routines with calling IndexDoc, it's not called "parallel processing". 并发的调用一个接口并不等于让内部分片产生效果,顶多是频繁调用接口,而且跟糟糕的是调用完了还去 flush 一下. You need to think like a program. 一个引擎 indexing 真正工作慢的原因往往在于io,所以没事不要去flush,这个引擎内部有分片机制,那就多用用这个机制,来提升效率。
使用的是微博搜索那个例子,将数据改为从自己数据库中搜索,但是写入的速度很慢,每分钟只能写入3000-5000条,已经使用了协程,不知道是不是哪里写错了。代码如下
Using the Weibo search example, the data is changed to search from my own database, but the write speed is very slow, only 3000-5000 can be written per minute. Correspondence has been used,I don't know where it was wrong.Code show as below
The text was updated successfully, but these errors were encountered: