scala-redis
scala-redis copied to clipboard
Get pipeline result slow when connect to remote redis server
Hi,
I got a slow case (> 1 minute) when fetch hash value synchronously from remote redis server. The code looks like below
import com.redis.RedisClient
val c = new RedisClient("10.0.5.20", 6379)
c.pipeline(p=>{
for(i<-Range(0, 10000)){
p.hget("msg:" +(900000+i), "favorite_count")
}}).get
If connect to local server, result returns in 1 second. I also tested using python client with same logic, it return in 1 second in both local and remote mode. Seems no problem at the server side.
redis client version is "net.debasishg" % "redisclient_2.10" % "2.12"
redis server version is 2.6.13
Hi - Has there been any update to the findings? I haven't yet had the time to look into it. Will address this shortly.
@yangliuyu the value which you get in this way is the type of Some.Could you tell me how to convert it? For a instance, in your code val c is some(String), how to convert it to String?
You can either use the Option.get
to have the String. But better is to use Option.map
and chain the computation as the get
will fail if it's a None
instead.