If you look into using a database, the graph database Neo4j could be of interest as well. Some people use it in Clojure and have written different wrappers for it, see: http://wiki.neo4j.org/content/Clojure
I'm not sure regarding handling this amount of simultaneous threads, but Neo4j is designed to lock only the nodes and relationships (edges) involved in a transaction. /anders On 9 Okt, 17:15, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > Honestly, this sounds like a problem for a full-fledged database. > With Clojure/datalog, you'll need to persist your records to disk > manually. At some point, your thousands of references will start to > look like a mini-database anyway. If you can fit your data into a > relational schema, use that; if not, try a graph database like > Mulgara. > -SS > > On Oct 8, 10:21 pm, Robert Luo <robort...@gmail.com> wrote: > > > Hi, I am working on a server project, which requires thousands records > > of data stored in memory, and they will be accessed by thousands of > > threads simultaneously. > > I intend to use datalog to store all my data, sharing the whole > > database by a reference. > > However, I am afraid of concurrency of this design, say if one thread > > changed any piece of the data, the whole data structure must be > > protected by dosync, and if another thread try to update it at the > > same time (by alter), it may cause retries, and because there are many > > many threads, the retries may happen too often. > > Another approach is just like in Java, we store each record as a ref, > > then we can dosync a single record. It seems like a row level lock > > rather than a database level lock in my opinion. Is this correct? > > However, this design seems too Java-like and we can not use datalog to > > do that. > > > Which approach is better? Or is there better design? Thanks for your > > opinion. --~--~---------~--~----~------------~-------~--~----~ 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 Note that posts from new members are moderated - please be patient with your first post. 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 -~----------~----~----~----~------~----~------~--~---