On 06/24/2012 08:51 PM, Liu Yuan wrote: > Old sockfd pool has following defect: > 0 statically allocated. > 1 use too many fds per sheep, not scalable > 2 implemented per thread, can't be shared between threads > 3 need resetting at every membership change > > The new sockfd cache aims to address these problems yet remain as effecient as > old one: > 0 dynamically allocated/deallocated at node granularity. > 1 cached fds are multiplexed by all threads. > 2 each session (for e.g, forward_write_obj_req) can grab one fd at a time > 3 if there isn't any FD available from cache, use normal connect_to() and close() > internally > 4 FD are named by IP:PORT uniquely, hence no need of resetting at membership > change > 5 the total number of FDs shrinks from (nr_gateway + nr_io) * nr_nodes to nr_nodes > 6 just add one more API, totally 3 APIs: sheep_{get,put,del}_fd() Hi Kazum, would you give a review? I'd like to merge it as soon as possible. I have heavily test it already. Thanks, Yuan |