On Apr 3, 12:42 pm, "rzeze...@gmail.com" <rzeze...@gmail.com> wrote:
> Brian, I imagine you are asking this in relation to your blog engine?

Yep.  Thanks everyone for the help and ideas.  Unfortunately I do have
a ton of data in a DB already so Terracotta would be a lot of work.  I
rewrote everything to do ref updates inside agents, and it worked
(almost), but when I fired up 1000 concurrent threads to do
simultaneous updates and set a certain percentage of them to throw an
exception mid-transaction, I still ended up with the DB and the in-
memory copy out of sync.  Cleaning up when something failed was a
nightmare to try to coordinate.

I ended up storing all of my data in a single ref that holds the state
of the universe and running a background thread in an agent that grabs
a snapshot of the ref and syncs it with the DB every so often.  I
guess it's probably a little more Clojure-ish that way anyways, since
the DB will always see a consistent snapshot.  If this doesn't work
I'll have to try watches I guess.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to