Please sign in to comment.
Performance improvements to spiral, counter, histogram & spiral_uniform
Changes include: Partition counter and spiral writes by erlang:system_info(scheduler_id) and a bitwise mask. There is also potential for better cache behavior given the fixed mapping between Erlang scheduler thread and partitioned key. Switch spiral and slide_uniform from ordered_set to set. Set supports fine grained locking whereas ordered_set requires a full-table lock. Combining set and separating values greatly reduces ETS contention. Change histogram to avoid an ETS insert if the sample passed into the histogram update function matches the result. There are 2 places in folsom where an ets:insert_new is done immediately followed by an ets:update_counter on the same key. Since, in the normal case, the key is likely to already exist, this can be optimized by trying the update_counter first in a try/catch and only do the insert_new if needed. This is provided as a utility function called folsom_utils:update_counter(). There is a bug in slide_uniform where it would not decrease the probability of doing a write the more updates it received in a particular moment. Effectively slide_uniform updates would always result in a write. This bug has been corrected, along with the Quickcheck test.
- Loading branch information...
Showing with 129 additions and 40 deletions.