On the surface:1. Job is scheduled with a timer2. A timer expires3. Client pulls the job out of the queue and executes it
I assume by "surprise you in unexpected ways" you mean: that the Redis expiry of data should be viewed as an implementation detail from the API point of view.
Question: if relying on the behavior of data expiry in Redis as a reliable external API is not recommended, then why was the ability to listen to key expiry via keyspace notifications added?
We do not require that timers be precise or accurate to a millisecond. I need to ensure that:1. Timers are not lost or abandoned as worker clients come and go.
2. Do not require a massive timer scan upon worker client reconnect to Redis in order to determine which timers in fact need to be processed, (i know this can be addressed by complicating the timer storage structure by storing timeouts in a sorted set, but this does not scale that well and becomes more complex since you'd need to shard the sorted set too)
3. Do not require timers to be 'owned' by different worker clients before they are removed from Redis to be executed by the client. Ownership leads to an inactive client's timers needing to be reassigned to someone else, the reassignment would need to poll on on a schedule, and now you cant seamlessly start and stop clients without introducing a big latency due to the reassignment delay.
4. Only a single worker client gets notified of each expiring timer (do not fight over each expiring timer ala redis keyspace expiry notifications)
In other words, I want persistent, scalable timers that do not complicate the application logic unnecessarily. I was hoping to be able to support this within Redis by chaining functionality already exposed in Redis via a different API (Keyspace notifications).
I know I can implement all the above requirements by adding various complexity to my application, but honestly it seems like the cost/benefit of having Redis capable of performing atomic actions on data expiry such as placing a key into a list should weight more heavily on the scales.
Question: if relying on the behavior of data expiry in Redis as a reliable external API is not recommended, then why was the ability to listen to key expiry via keyspace notifications added?
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.
Are you saying that if my redis server is not doing anything and I set a TTL on a key of 5 seconds, if i check for that key 6 seconds later it will likely still be there? My experience contradicts this. My understanding is that redis is being conservative about time guarantees on key expiry for the sake of performance in case 1 billion keys end up inserted with the same millisecond TTL. I understand the limitation of placing such a load on the system and the necessity of delaying expiry under such extreme conditions, however that is NOT my use case.
My use case is to create timers, several thousand every second that will expire about 20 seconds hence. If unrelated query load spikes cause redis to expire the timers 22 seconds later or 25 seconds later, it's not a big deal for me. As long as the expiry is 'usually' guaranteed to be 'near' wall clock time, I am happy with it.
So long story short, this is not some theoretical million timers type of use case that will break redis and explode the server. It is a very well bounded problem. It is especially for this reason that I was hesitant to build complex client side logic to handle resuming of timers that 'should' be possible to handle entirely by adding the trivial mechanism I proposed earlier.
On Tuesday, January 13, 2015 at 9:07:02 AM UTC-8, GregA wrote:On Mon, Jan 12, 2015 at 8:23 AM, Jacob T <jtr...@gmail.com> wrote:Question: if relying on the behavior of data expiry in Redis as a reliable external API is not recommended, then why was the ability to listen to key expiry via keyspace notifications added?I don't think anyone is asking you to not depend on Redis' behavior with respect to whether or not an expire event is fired. Redis will expire keys.They are asking you to not depend on the accuracy of the timing of expire events. Redis will not expire keys according to the wall clock time (some will, many won't).-Greg
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.