On Mon, Nov 19, 2012 at 6:46 PM, Felix Gallo <
felix...@gmail.com> wrote:
> Are you having a performance problem, or are you just worried about
> cleanliness?
The second. I'm still in the exploratory phase, in fact the final
product might not even be in Ruby.
I was trying to wrap my head around best ways of modelling data with
Redis' datastructures, so that I'm not missing something obvious in
how to store this information for the type of queries I need.
> If it's actual measured performance, then what I tend to do for highly
> static data is to trade space for time and run the query pre-fork (cf.
>
http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-before_fork)
> and cache the data (here, the subscriptions metadata) in ruby data
> structures.
>
> The downside of this is that you have to signal the app server (e.g.
>
http://unicorn.bogomips.org/SIGNALS.html) whenever your static data changes
> significantly enough, in order to force a cache invalidation. If you are
> feeling sufficiently frisky you could even have the app server detect this
> condition and revalidate itself, but in practice I haven't found that to be
> worth the time spent.
>
> Generally, even for a fairly heavily loaded app server doing upwards of
> thousands of requests per second, as long as the redis server is in the same
> data center, this optimization is of little discernible benefit.
In this case the beanstalkd job updates the subscription info so the
appserver should be notified everytime a job completes, which is very
frequently, so I'm not sure this calls for such complexity.
Interesting strategy though, for other cases, thanks.
Thanks for your answer.
Jesus.