-
Notifications
You must be signed in to change notification settings - Fork 368
Description
Currently, whenever we read an RDD from Redis, we first filter the given keys that have the expected value type. We do this by sending a pipelined TYPE
command for each key to redis.
For a large busy redis server this takes quite a lot of time and the redis server is also blocked to serve this request, not being able to server other clients.
If we are certain that values are going to be of a certain type, we should allow to skip this check through a boolean switch.
If we do encounter a value of not the expected type, it might result in a ClassCastException
somewhere. Not handling this exception is OK if we skip the type check. The exception can be handled at a higher level.
Alternatively, we can also do Optimistic exception handling, where we skip the check, start reading values, then try to cast it to the expected type, and if that fails, ignore that value, maybe do a debug log, and move on. This is probably more efficient to do than the filtering by TYPE command beforehand. Also, this way, we can completely eliminate filterKeysByType
, and not need to add a boolean switch to toggle to all APIs.