scala-redis icon indicating copy to clipboard operation
scala-redis copied to clipboard

Get pipeline result slow when connect to remote redis server

Open yangliuyu opened this issue 9 years ago • 3 comments

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

yangliuyu avatar Sep 10 '14 11:09 yangliuyu

Hi - Has there been any update to the findings? I haven't yet had the time to look into it. Will address this shortly.

debasishg avatar Sep 15 '14 18:09 debasishg

@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?

fanhk avatar Jan 19 '15 08:01 fanhk

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.

debasishg avatar Jan 25 '15 18:01 debasishg