I don't have a good answer for your question, but note there is no guarantee that your requests will be served from the same physical machine - we'll move the dyno around as demanded by the cloud. memcached is the way to do persistent (beyond single request) caching. We're a few days away from making it public beta.
Oren On Tue, Mar 9, 2010 at 9: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. > > -- 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.
