clojurewerkz / spyglass

A Clojure Memcached client (also: Couchbase, Kestrel). Built on top of SpyMemcached, supports ASCII and binary protocols, strives to be 100% feature complete.

Home Page:http://clojurememcached.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is (c/text-connection endpoint) threadsafe?

whamtet opened this issue · comments

Thanks for the great client!

Is (c/text-connection endpoint) threadsafe or should I create a separate client for each thread? We've been getting some strange timeout messages.

Thread safety is a property of an algorithm/workload and you haven't explained what your threads are going to do with the connection. Ultimately Spyglass connections are nothing more than Spymemcached connections and as far as I can tell Spymemcached was designed with concurrent access in mind.

@whamtet yes it is because what exactly your app does is incredibly important and that is specific to your algorithm/workload. Concurrency safety is not a universal property and one cannot claim that a library is universally safe or unsafe, even if it is as small as Spyglass, without knowing how exactly it is used.

@whamtet consider how you'd answer the question if "safely used" is not known (since it is not known to me or any other reader who's not on the same project as you are). If the answer is "it depends on what exactly safely and used mean here", it's an algorithm/workload/use case property.