Hacker News new | ask | show | jobs
by cachemoney 5400 days ago
I spent about a year as a maintainer of FlockDB, Twitter's social graph store. If you don't know, it's basically a sharded MySQL setup. One of the key pain points was optimizing the row lock over the follower count. Whenever a Charlie Sheen joins, or someone tries to follow spam us, one particular row would get blasted with concurrent updates.

Doing this in-memory in java via someAtomicLong.incrementAndGet() sounds appealing.

1 comments

> Doing this in-memory in java via someAtomicLong.incrementAndGet() sounds appealing.

Just for fun, in Clojure:

    (def current-id (atom (long 0)))
    (defn get-id [] (swap! current-id inc))