Task #906853: Implement ThreadLocalServiceData and reduce lock contentions during channel counter update
Task #906853: Implement ThreadLocalServiceData and reduce lock contentions during channel counter update

Summary:
Cache the counter updates on thread local data structures and aggregate/publish
the data from a separate thread periodically. The ThreadLocalServiceData is
implemented on top of the TLStats data structures.

I am plannig to deploy a private build to production tomorrow to test this
change in production, but figured it might be better to send the diff out first
and get code review feedbacks at the same time.

Test Plan: Run and pass unit tests. Run end-to-end testings on sandbox. (TBD)
Deploy a private build to a production server and make sure the thrift call
latency is reduced.

Reviewed By: xin@fb.com

FB internal diff: D540239


gaoyingie/folly,facebook/folly,stonegithubs/folly,clearlinux/folly,loverszhaokai/folly,leolujuyi/folly,constantine001/folly,PPC64/folly,clearlinux/folly,zhiweicai/folly,tempbottle/folly,SammyK/folly,doctaweeks/folly,SeanRBurton/folly,project-zerus/folly,bowlofstew/folly,sakishum/folly,upsoft/folly,arg0/folly,zhiweicai/folly,gavioto/folly,loversInJapan/folly,raphaelamorim/folly,lifei/folly,colemancda/folly,SammyK/folly,ykarlsbrun/folly,wildinto/folly,tomhughes/folly,clearlylin/folly,chjp2046/folly,Eagle-X/folly,ykarlsbrun/folly,bowlofstew/folly,mqeizi/folly,facebook/folly,floxard/folly,hongliangzhao/folly,ykarlsbrun/folly,reddit/folly,lifei/folly,facebook/folly,rklabs/folly,upsoft/folly,project-zerus/folly,raphaelamorim/folly,zhiweicai/folly,PoisonBOx/folly,tempbottle/folly,yangjin-unique/folly,charsyam/folly,colemancda/folly,romange/folly,guker/folly,PPC64/folly,rklabs/folly,SammyK/folly,arg0/folly,Eagle-X/folly,sonnyhu/folly,zhiweicai/folly,bikong2/folly,cppfool/folly,PPC64/folly,bowlofstew/folly,arg0/folly,SeanRBurton/folly,lifei/folly,Hincoin/folly,raphaelamorim/folly,shaobz/folly,theiver9827/folly,brunomorishita/folly,raphaelamorim/folly,xzmagic/folly,theiver9827/folly,Hincoin/folly,fw1121/folly,doctaweeks/folly,xzmagic/folly,chjp2046/folly,KSreeHarsha/folly,bsampath/folly,hongliangzhao/folly,bikong2/folly,SeanRBurton/folly,chjp2046/folly,theiver9827/folly,sakishum/folly,SeanRBurton/folly,yangjin-unique/folly,brunomorishita/folly,doctaweeks/folly,bsampath/folly,tomhughes/folly,clearlylin/folly,juniway/folly,tomhughes/folly,kernelim/folly,guker/folly,lifei/folly,clearlylin/folly,zhiweicai/folly,kernelim/folly,sakishum/folly,Hincoin/folly,bobegir/folly,sonnyhu/folly,loverszhaokai/folly,ykarlsbrun/folly,hongliangzhao/folly,yangjin-unique/folly,chjp2046/folly,Eagle-X/folly,brunomorishita/folly,SammyK/folly,mqeizi/folly,gavioto/folly,constantine001/folly,cppfool/folly,nickhen/folly,KSreeHarsha/folly,loversInJapan/folly,wildinto/folly,Orvid/folly,nickhen/folly,project-zerus/folly,ykarlsbrun/folly,cole14/folly,Eagle-X/folly,nickhen/folly,constantine001/folly,bsampath/folly,unmeshvrije/C--,mqeizi/folly,cppfool/folly,kernelim/folly,alexst07/folly,juniway/folly,alexst07/folly,alexst07/folly,alexst07/folly,wildinto/folly,Orvid/folly,bsampath/folly,cole14/folly,bsampath/folly,sonnyhu/folly,upsoft/folly,CJstar/folly,Orvid/folly,chjp2046/folly,KSreeHarsha/folly,unmeshvrije/C--,floxard/folly,colemancda/folly,doctaweeks/folly,cole14/folly,rklabs/folly,fw1121/folly,constantine001/folly,stonegithubs/folly,project-zerus/folly,brunomorishita/folly,bobegir/folly,lifei/folly,unmeshvrije/C--,juniway/folly,CJstar/folly,xzmagic/folly,charsyam/folly,bowlofstew/folly,fw1121/folly,SammyK/folly,unmeshvrije/C--,romange/folly,xzmagic/folly,arg0/folly,rklabs/folly,sonnyhu/folly,leolujuyi/folly,clearlylin/folly,nickhen/folly,bowlofstew/folly,Orvid/folly,gaoyingie/folly,upsoft/folly,reddit/folly,facebook/folly,reddit/folly,sonnyhu/folly,tomhughes/folly,cppfool/folly,PoisonBOx/folly,Hincoin/folly,floxard/folly,renyinew/folly,loversInJapan/folly,Hincoin/folly,stonegithubs/folly,reddit/folly,project-zerus/folly,constantine001/folly,raphaelamorim/folly,wildinto/folly,KSreeHarsha/folly,yangjin-unique/folly,guker/folly,alexst07/folly,sakishum/folly,guker/folly,leolujuyi/folly,CJstar/folly,CJstar/folly,rklabs/folly,sakishum/folly,bikong2/folly,CJstar/folly,tomhughes/folly,PoisonBOx/folly,clearlinux/folly,renyinew/folly,bikong2/folly,Eagle-X/folly,gavioto/folly,kernelim/folly,tempbottle/folly,reddit/folly,fw1121/folly,clearlylin/folly,bobegir/folly,PPC64/folly,romange/folly,ajtulloch/folly,leolujuyi/folly,charsyam/folly,cole14/folly,gavioto/folly,shaobz/folly,renyinew/folly,brunomorishita/folly,nickhen/folly,cole14/folly,charsyam/folly,KSreeHarsha/folly,bobegir/folly,bobegir/folly,clearlinux/folly,juniway/folly,shaobz/folly,SeanRBurton/folly,arg0/folly,hongliangzhao/folly,PoisonBOx/folly,kernelim/folly,tempbottle/folly,leolujuyi/folly,shaobz/folly,colemancda/folly,facebook/folly,loverszhaokai/folly,unmeshvrije/C--,mqeizi/folly,gaoyingie/folly,floxard/folly,gaoyingie/folly,PPC64/folly,renyinew/folly,clearlinux/folly,tempbottle/folly,wildinto/folly,ajtulloch/folly,doctaweeks/folly,romange/folly,shaobz/folly,floxard/folly,unmeshvrije/C--,colemancda/folly,fw1121/folly,gaoyingie/folly,loverszhaokai/folly,hongliangzhao/folly,cppfool/folly,PoisonBOx/folly,Orvid/folly,upsoft/folly,gavioto/folly,theiver9827/folly,theiver9827/folly,yangjin-unique/folly,loversInJapan/folly,guker/folly,ajtulloch/folly,renyinew/folly,stonegithubs/folly,stonegithubs/folly,romange/folly,juniway/folly,loverszhaokai/folly,mqeizi/folly,bikong2/folly,loversInJapan/folly,xzmagic/folly