On Tue, Mar 9, 2010 at 11:02 PM, Alex Chaffee <[email protected]> wrote:
> I've got some frequently-accessed data I'd like to store in RAM > between requests. I'm using Sinatra so I'll probably just use an LRU > cache in a @@class variable. I think I can muddle through all the > technical issues but one: > > How big can I reasonably make my cache? I.e. how high (or low) should > I put my threshold before I start expiring unused data? > > The only guidance I could find from a quick perusal of heroku.com was > on http://legal.heroku.com/aup: "Dyno RAM usage: 300MB - Hard" -- > which is good to know, but not a complete answer. I'll obviously want > to set my cache well below that limit. But without monitoring tools I > don't have any idea how much RAM is used by the normal processing of > Rack + Sinatra per request, nor do I know how many requests are being > serviced per second. My cache is supposed to increase performance, not > decrease it by hammering the dyno into swap space, or otherwise > interfering with other system functions on the dyno. > > So... any ideas? Has anyone else done this? Are there any low-level > monitoring tools I can use to find out how much RAM I'm currently > using, or how loaded the system is, or anything of that nature? Would > New Relic help here (and does it work for Sinatra apps)? > > BTW, although I may want to use memcached as an *additional* caching > layer, what I'm interested in exploring now is the feasibility of > storing transient data in the app server itself. (I don't want the > overhead of instantiating Ruby objects, especially ActiveRecord > objects, not to mention that memcached isn't officially available as > an addon.) > > --- > Alex Chaffee - [email protected] - http://alexch.github.com > Stalk me: http://friendfeed.com/alexch | http://twitter.com/alexch | > http://alexch.tumblr.com > > -- > You received this message because you are subscribed to the Google Groups > "Heroku" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<heroku%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/heroku?hl=en. > > Are you sure you need to do this? Is it slow enough that you've decided this is a necessary optimization? My experience has been that Heroku is extremely fast, and worrying about things like this aren't necessary, they just make the code base more complex and less reliable for no noticeable gain. I've spent days complicating my code base, making optimizations that were pointless. Both DataMapper and ActiveRecord make some very impressive optimizations already. If you haven't documented an issue with speed, and profiled your app to see where the real problem lies, then you might want to try that before taking the time and effort, to "muddle through all the technical issues". -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
