2010/1/14 mudphone <kyle...@gmail.com>:
> I believe it has to do with opening too many sockets on the Redis
> server, rather than the total number of members in the set.

Sounds possible. It would be worthwhile seeing if
(redis/with-server REDIS-SPEC
  (dotimes [i 100000] (redis/sadd "large-set" (random-value i))))
works as expected (ie: using just one connection) to help isolate the problem.

>From looking at
http://github.com/ragnard/redis-clojure/blob/master/src/redis/internal.clj
it appears that the sockets are cleaned up... so I'm thinking it is
actually more likely that the sockets are closed, but that you use
them all so fast that none are available before you request a new one
because their timeout has not expired. Sockets bind to a fixed remote
host port and a (usually) random local port. But the local ports
cannot be reused immediately (there is a timeout) unless the socket
specifically is set as reuse. If you ran out of sockets I would expect
an exception more like "no file descriptors". You could run netstat
when your program is half-way done to get a better picture.


> Any suggestions appreciated.

Consider using dotimes, or doseq instead of loop/recur
(doseq [i (range 10 0 -1)] (println i))  ;; if you want to count down
instead of up


I'm not a Redis user yet so apologies if not helpful.


Regards,
Tim.
-- 
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

Reply via email to