I'm not concerned with crashing; I plan to run the save operations
every few minutes at the bare minimum, and I don't really care if I
lose data inside of that window.

I was more just wondering if the mechanism existed; abandoning an
object to the abyss with no controls on it seems a little wasteful to
me. ;-)

Besides, designing an app for 5 nines uptime, at least the server
apps, doesn't seem like I should put too much time and effort into
worrying about crashes. :-)

On Dec 4, 8:29 am, "Clint Webb" <[EMAIL PROTECTED]> wrote:
> I personally would be careful with this.  It might be alright for tracking
> non-critical information.  Actually I use memcache for storing some things
> that a user does while they are looking around, but dont actually store it
> in the database.  if that data goes missing, its no big deal at all.
> However, using memcache to buffer writes, will probably not help you much.
>
> For anything that you will actually store in the database and use, You need
> something to be the "source of truth", which would normally be your
> database.  Having a mix of cache (buffer) and database adds a lot of
> complication that will not help you in the end.
>
> If your database cannot handle the write load, then I would first look at
> other options before trying to use memcache which is not designed for that
> at all.
>
>
>
> On Thu, Dec 4, 2008 at 10:19 PM, Josef Finsel <[EMAIL PROTECTED]> wrote:
> > It's a clever idea, but it has another issue. What happens to the data if
> > memcached crashes? Now the data that was written to the cache to be written
> > to the database upon deletion is gone. The real problem is that an idea like
> > this begins to treat memcached as a persistent data store instead of a
> > cache, which is a whole different level of complexity than a cache.
>
> > On Wed, Dec 3, 2008 at 9:41 PM, Justin Mecham <[EMAIL PROTECTED]>wrote:
>
> >> Not a problem per se, and yes, I know it's a cache. I was just trying
> >> to avoid having every write hit the database, intending to never
> >> handle a database write until a delete happened, or via an automated
> >> server side process. Like a memcache->dump_to_disk ;-)
>
> >> The more I think about it though, an update based on an index probably
> >> isn't a big deal to just run that update...
>
> >> My thought though was that I could set it so the database writes only
> >> happened every so often as the user was roaming about the site, but
> >> that leaves me with no recent copy of their data if they from the site
> >> after a few changes, before that frequency write happens. Thus the
> >> thought of a dbase save when that item was deleted. I suppose I could
> >> loop through open users and save people who haven't been saved lately;
> >> that idea appeals to me really.
>
> >> Just trying to contribute to the community. :-) Offering the end user
> >> an api spot to access those deleted items seems like a neat idea, if
> >> used cleverly. :-)
>
> >> On Dec 3, 9:27 pm, "Josef Finsel" <[EMAIL PROTECTED]> wrote:
> >> > My first thought is... No,let me answer your question a different way by
> >> > asking what problem you are trying to solve. memcached is an in-memory
> >> cache
> >> > which solves the problem of temporary storage of data where it's more
> >> easily
> >> > accessible than the source (
> >>http://en.wikipedia.org/wiki/Cache_(computing)<http://en.wikipedia.org/wiki/Cache_%28computing%29>
> >> ).
> >> > memcached is not:
>
> >> >    - a persistent store
> >> >    - a write-through cache
> >> >    - a database
>
> >> > Part of why memcached works so well is that it does one thing and one
> >> thing
> >> > only, cache data in memory until either the Expiration time comes or the
> >> > memory is needed as determined by the LRU algorithm. If you want
> >> memcached
> >> > to perform some function, such as call backs for expired/deleted items,
> >> > writing data to the database, high-availability via replicated caches
> >> > between servers, acting as a queue, then you don't want a cache, you
> >> want
> >> > something else, and there are a whole host of "extensions" to memcached
> >> like
> >> > memcachedb that probably provide what you need. The reason these are not
> >> in
> >> > memcached is because they add a great deal of overhead that slows down
> >> the
> >> > efficiency of the cache server.
>
> >> > If you have no problem with being tied to a MS platform, you can use
> >> > Velocity, which offers tagging and a whole host of other "improvements"
> >> over
> >> > memcached. But what it doesn't offer is the simple, fast efficiency of
> >> > memcached. I'm currently working with the CTP2 and dreading the fact
> >> that
> >> > CTP3 will have a write-through cache because the overhead is ugly. And
> >> > everything Dustin and Dormando say about tags.... I see why they aren't
> >> > implemented in memcached.
>
> >> > So, what problem are you trying to solve? It may be that memcached is a
> >> part
> >> > of it. But having memcached deletes write data to the database is
> >> troubling.
> >> > What happens if someone has directly updated the database between the
> >> time
> >> > the data is stored in the cache and the time it expires. Will the cache
> >> > version overwrite the changes in the database? Will it fail? If it
> >> fails,
> >> > should it notify someone?
>
> >> > So tell us what problem you need to solve and we might be able to help
> >> steer
> >> > you to the best solution.
>
> >> > Josef
>
> >> > On Wed, Dec 3, 2008 at 9:08 PM, Justin Mecham <[EMAIL PROTECTED]
> >> >wrote:
>
> >> > > I understand how memcached deletes items to be this, proto-code
> >> > > stylie:
>
> >> > > function server_add/replace_value(value){
>
> >> > >  while (server_used_memory>server_max_usable_memory)
> >> > >  {
> >> > >       delete_oldest_item()
> >> > >  }
>
> >> > > server_save(value)
>
> >> > > }
>
> >> > > understanding that the deleted items might more than one, would it be
> >> > > possible to somehow optionally return these deleted values to the
> >> > > functions on the application server? This would be spiffy for
> >> > > controlling database writes.
>
> >> > > a bit more of my shabby proto-code
>
> >> > > $deleted=null; //a variable to return the deleted values into
> >> > > $memcache->add($key,$value,false,600,$deleted);
>
> >> > > if($deleted!=null)
> >> > > {
> >> > >  foreach($deleted as $key=>$value)
> >> > >  {
> >> > >       dbase_save($deleted);
> >> > >  }
> >> > > }
>
> >> > > Let me know what you think. :-)
>
> >> > --
> >> > "If you see a whole thing - it seems that it's always beautiful.
> >> Planets,
> >> > lives... But up close a world's all dirt and rocks. And day to day,
> >> life's a
> >> > hard job, you get tired, you lose the pattern."
> >> > Ursula K. Le Guin
>
> >> >http://www.finsel.com/words,-words,-words.aspx(My<http://www.finsel.com/words,-words,-words.aspx%28My>blog)
> >> > -
> >>http://www.finsel.com/photo-gallery.aspx(My<http://www.finsel.com/photo-gallery.aspx%28My>Photogallery)
> >>  -
> >>http://www.reluctantdba.com/dbas-and-programmers/blog.aspx(My<http://www.reluctantdba.com/dbas-and-programmers/blog.aspx%28My>Professional
> >> > Blog)
>
> > --
> > "If you see a whole thing - it seems that it's always beautiful. Planets,
> > lives... But up close a world's all dirt and rocks. And day to day, life's a
> > hard job, you get tired, you lose the pattern."
> > Ursula K. Le Guin
>
> >http://www.finsel.com/words,-words,-words.aspx(My blog) -
> >http://www.finsel.com/photo-gallery.aspx(My Photogallery)  -
> >http://www.reluctantdba.com/dbas-and-programmers/blog.aspx(My
> > Professional Blog)
>
> --
> "Be excellent to each other"

Reply via email to