Snappy Dashboards with Redis
31–40 of 46 posts
Re: Snappy Dashboards with Redis
#32This is exactly what I'm building http://www.instahero.com to solve. You don't have to build your own infrastructure, just write the relevant bit of code (or select a template) and you have a dashboard.
Re: Snappy Dashboards with Redis
#33This doesn't make any sense to me. Why store the values in Redis and use Ruby to do simple math? If you're using Postgres already, just store the stats in Postgres and use an aggregate or window function to grab the stats. (And collect those stats with triggers, in the first place.) If you're using Mongo already, just grab your stats with a map reduce query.
Re: Snappy Dashboards with Redis
#34Also, if you don't do this already, look into using bitsets to track users. As long as userID's are integers, it's real easy it saves a lot of space.
Re: Snappy Dashboards with Redis
#35This doesn't make any sense to me. Why store the values in Redis and use Ruby to do simple math? If you're using Postgres already, just store the stats in Postgres and use an aggregate or window function to grab the stats. (And collect those stats with triggers, in the first place.) If you're using Mongo already, just grab your stats with a map reduce query.
Re: Snappy Dashboards with Redis
#36Earlier quoted context omitted.
I've never used SQL triggers. We host our Postgres database with Heroku. As a result, I think I've ruled out database level solutions. On a related note, it feels good to know that everything our app needs to run is in the code base. Back in my C# days, I remember relying on stored procedures that were configured manually at the database level. Rails fights that with migrations and the callback chain too, so I guess…
> We host our Postgres database with Heroku. As a result, I think I've ruled out database level solutions. What does hosting with Heroku have to do with using a trigger? > On a related note, it feels good to know that everything our app needs to run is in the code base. Except the database schema and any additional indexes you need to make it not perform terribly. All basic setup, just like creating triggers. > Rails…
Re: Snappy Dashboards with Redis
#37This doesn't make any sense to me. Why store the values in Redis and use Ruby to do simple math? If you're using Postgres already, just store the stats in Postgres and use an aggregate or window function to grab the stats. (And collect those stats with triggers, in the first place.) If you're using Mongo already, just grab your stats with a map reduce query.
It looks like one of the things they're counting is clicks, so they could potentially have some pretty large datasets. I don't know how well Mongo's map-reduce works, but in Postgres, COUNT(star) [1] does not perform well for very large tables (e.g. 100 million rows). You wouldn't want to be doing a COUNT(star) once per minute for each customer that had their dashboard open on a plasma screen. Of course, there are ot…
Re: Snappy Dashboards with Redis
#38Re: Snappy Dashboards with Redis
#39This is a pretty standard way to handle counts and doesn't seem to have much to do with redis. In an SQL database you'd just do it with a trigger and your application wouldn't need to know a thing about it.
I've never used SQL triggers. We host our Postgres database with Heroku. As a result, I think I've ruled out database level solutions. On a related note, it feels good to know that everything our app needs to run is in the code base. Back in my C# days, I remember relying on stored procedures that were configured manually at the database level. Rails fights that with migrations and the callback chain too, so I guess…
Re: Snappy Dashboards with Redis
#40Earlier quoted context omitted.
Certainly you can implement this same pattern without Redis. Triggers in Postgres would be a reasonable way to do it. I didn't say you can't do this in Postgres, I said you can't do it with COUNT(). It does indeed sound like they're storing every click: that's precisely why using aggregate functions would be expensive.
You absolutely can do it without COUNT. Just increment a counter value, the same way they're doing it in Redis.