Re: Fragment Caching kind of expiring

2011-05-06 Thread joshmckin
Thought there would be lots of folks making use of fragment caching :(

On May 5, 3:34 pm, joshmckin joshmc...@gmail.com wrote:
 We have started to make use of some basic Rails 3 based caching to
 improve performance of our site, but  are having an issue.

 I am trying to use fragment caching to cache a portion in our head
 that contains a select box that (depending on the user) could have
 over 300 options. Although the local-test implementation went off
 without a hitch there appears to be a problem expiring the cache on
 Heroku. When the user chooses an option in the select, the cache
 should expire and the page reloads showing the select in the header
 with the user choice as the selected options, which does happen on the
 first page refresh, however on subsequent reloads or when the user
 navigates to another page the older expired version of the select
 will show somethings (about 50% of the time). I am guessing this may
 have something to do distributed memcached servers and the shared
 heroku environment. Has anyone else had this experience? I had no luck
 searching. I've opened a ticket but thought I might get lucky here ;)

 Here is a gist with a copy of the code I'm usinghttps://gist.github.com/957855
 (nothing special)

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Fragment Caching kind of expiring

2011-05-06 Thread chris
Fragment caching writes to the filesystem, doesn't it? And that's a big 
no-no in the heroku env. You're going to have to use memcached instead. But 
I would really recommend trying to use varnish and loading the select box 
options in via JS on page load.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Fragment Caching kind of expiring

2011-05-06 Thread joshmckin
Actually it caches to the tmp folder which is available in Heroku.
Plus: http://devcenter.heroku.com/articles/caching-strategies#fragment_caching
confirms fragment caching as an option.

My state that it has something do with memcache was incorrect, as like
you said it writes to the file system. We have multiple dynos running,
I wonder if that may be causing the issue.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Fragment Caching kind of expiring

2011-05-06 Thread Mike Abner
Dynos aren't guaranteed to run on the same machine, so they won't necessarily 
share the same /tmp directory. Best bet is to never rely on it being there or 
having the right data.

Mike
On Friday, May 6, 2011 at 11:39 AM, joshmckin wrote: 
 Actually it caches to the tmp folder which is available in Heroku.
 Plus: http://devcenter.heroku.com/articles/caching-strategies#fragment_caching
 confirms fragment caching as an option.
 
 My state that it has something do with memcache was incorrect, as like
 you said it writes to the file system. We have multiple dynos running,
 I wonder if that may be causing the issue.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
 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 heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Fragment Caching kind of expiring

2011-05-06 Thread joshmckin
Correct Mike and why I went with Chris's suggestion. I set my
config.cache_store = :dalli_store and it appear to fix my problem and
initial testing seems to be good. I'll post an update if it fails.

On May 6, 1:48 pm, Mike Abner mike.ab...@gmail.com wrote:
 Dynos aren't guaranteed to run on the same machine, so they won't necessarily 
 share the same /tmp directory. Best bet is to never rely on it being there or 
 having the right data.

 Mike







 On Friday, May 6, 2011 at 11:39 AM, joshmckin wrote:
  Actually it caches to the tmp folder which is available in Heroku.
  Plus:http://devcenter.heroku.com/articles/caching-strategies#fragment_caching
  confirms fragment caching as an option.

  My state that it has something do with memcache was incorrect, as like
  you said it writes to the file system. We have multiple dynos running,
  I wonder if that may be causing the issue.

  --
  You received this message because you are subscribed to the Google Groups 
  Heroku group.
  To post to this group, send email to heroku@googlegroups.com.
  To unsubscribe from this group, send email to 
  heroku+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://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 heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Fragment Caching kind of expiring

2011-05-06 Thread joshmckin
All is good now. Its always the little things:)

On May 6, 1:52 pm, joshmckin joshmc...@gmail.com wrote:
 Correct Mike and why I went with Chris's suggestion. I set my
 config.cache_store = :dalli_store and it appear to fix my problem and
 initial testing seems to be good. I'll post an update if it fails.

 On May 6, 1:48 pm, Mike Abner mike.ab...@gmail.com wrote:







  Dynos aren't guaranteed to run on the same machine, so they won't 
  necessarily share the same /tmp directory. Best bet is to never rely on it 
  being there or having the right data.

  Mike

  On Friday, May 6, 2011 at 11:39 AM, joshmckin wrote:
   Actually it caches to the tmp folder which is available in Heroku.
   Plus:http://devcenter.heroku.com/articles/caching-strategies#fragment_caching
   confirms fragment caching as an option.

   My state that it has something do with memcache was incorrect, as like
   you said it writes to the file system. We have multiple dynos running,
   I wonder if that may be causing the issue.

   --
   You received this message because you are subscribed to the Google Groups 
   Heroku group.
   To post to this group, send email to heroku@googlegroups.com.
   To unsubscribe from this group, send email to 
   heroku+unsubscr...@googlegroups.com.
   For more options, visit this group 
   athttp://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 heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Fragment Caching kind of expiring

2011-05-06 Thread Kerri Miller
Fragment caching is a great mechanism for caching widgets or partials
in your application. Fragment caching uses (and requires) the Heroku
Memcache add-on. 

On Fri, May 6, 2011 at 11:39 AM, joshmckin joshmc...@gmail.com wrote:
 Actually it caches to the tmp folder which is available in Heroku.
 Plus: http://devcenter.heroku.com/articles/caching-strategies#fragment_caching
 confirms fragment caching as an option.

 My state that it has something do with memcache was incorrect, as like
 you said it writes to the file system. We have multiple dynos running,
 I wonder if that may be causing the issue.

 --
 You received this message because you are subscribed to the Google Groups 
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
 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 heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.