Scala Java Python Ruby Thrift Lua Other
Switch branches/tags
Clone or download
mosesn and jenkins finagle-stats: Decrease contention in MetricsBucketedHistogram#add
Problem

When we profile h2 servers, we see contention in MetricsBucketedHistogram#add.

Solution

Change BucketedHistogram to be memory safe and remove intrinsic locking from
MetricsBucketedHistogram.  I tried ReentrantReadWriteLock in BucketedHistogram,
but it was too slow.  I tried several cheap read-write lock implementations
(lock on updating an integer and spin, atomic integer and spin, semaphore, StampedLock)
before finally settling on AQS, which is very fast.  I also started using an
AtomicIntegerArray so that racing in `add` would be safe.  However, converting
`num` and `total` to AtomicIntegers also lost us some speed.

JIRA Issues: CSL-5626

Differential Revision: https://phabricator.twitter.biz/D173413
Latest commit 0fff922 Jun 18, 2018
Permalink
Failed to load latest commit information.
.github Twitter OSS: Add ISSUE_TEMPLATE Jul 7, 2016
doc Twitter-oss: Prepare OSS libraries for release 18.6.0 Jun 14, 2018
finagle-base-http Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-benchmark-thrift/src/main/thrift Format all BUILD files in source/{e,f,g,h,i,j,k,l}* with buildifier Feb 20, 2018
finagle-benchmark finagle-core, twitterserver: Introduce a load balancer registry May 17, 2018
finagle-core Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-example finagle-docs: Update deprecated usages in docs Apr 25, 2018
finagle-exception replace deprecated org.scalatest.mock.MockitoSugar with org.scalatest… Jun 12, 2018
finagle-exp replace deprecated org.scalatest.mock.MockitoSugar with org.scalatest… Jun 12, 2018
finagle-http-cookie/src/main/java/com/twitter/finagle/http/netty3 finagle-base-http: Add SameSite to DefaultCookie Apr 19, 2018
finagle-http Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-http2 Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-init Format all BUILD files in source/{e,f,g,h,i,j,k,l}* with buildifier Feb 20, 2018
finagle-integration replace deprecated org.scalatest.mock.MockitoSugar with org.scalatest… Jun 12, 2018
finagle-memcached Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-mux Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-mysql finagle-mysql: Add docs to OK May 30, 2018
finagle-netty3 Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-netty4-http finagle-netty4-http: Remove dead field in Netty4ClientStreamTransport Jun 13, 2018
finagle-netty4 finagle, util: Remove usages of deprecated NonFatal and DefaultTimer.… Jun 13, 2018
finagle-redis Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-serversets Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-stats finagle-stats: Decrease contention in MetricsBucketedHistogram#add Jun 18, 2018
finagle-thrift Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-thriftmux finagle-core: Fix overlapping Pants build testing targets May 21, 2018
finagle-toggle finagle-toggle: Make StandardToggleMap mutable May 5, 2018
finagle-tunable Format all BUILD files in source/{e,f,g,h,i,j,k,l}* with buildifier Feb 20, 2018
finagle-zipkin-core Remove deprecated Scala "Procedure" syntax for tests/scala/:: target … Jun 14, 2018
finagle-zipkin-scribe pants: Rename {lib,}thrift-0.5.0 to {lib,}thrift Mar 22, 2018
project Twitter-oss: update OSS libraries post-release to 18.7.0-SNAPSHOT Jun 15, 2018
site finagle-doc: GitHub not Github Oct 13, 2017
.gitignore fix broken WatermarkPool link in doc, also add *.pyc to .gitignore Feb 23, 2015
.mailmap add a .mailmap Dec 16, 2011
.travis.yml finagle: Change .travis.yml to use finagle-zipkin-scribe Feb 27, 2018
ADOPTERS.md finagle: Fix adopters typo Feb 21, 2018
CHANGES Twitter-oss: Prepare OSS libraries for release 18.6.0 Jun 14, 2018
CODE_OF_CONDUCT.md Add CODE_OF_CONDUCT.md Jun 20, 2017
CONFIG.ini Fix some lint errors in CONFIG.ini and OWNERS - missing newlines - tr… Feb 29, 2016
CONTRIBUTING.md finagle: Make OSS instructions for locally building docs more explicit Dec 12, 2017
CONTRIBUTORS [split] finagle-doc: beginnings of a finagle user's guide Feb 21, 2013
GROUPS [split] Use new git-review with simplified OWNERS/GROUPS May 18, 2012
LICENSE Project scaffolding Oct 18, 2010
NOTICE finagle-thrift: Removed duplicated libthrift files May 3, 2018
OWNERS finagle: dschobel to root owners Jan 13, 2017
README.md Twitter-oss: update OSS libraries post-release to 18.7.0-SNAPSHOT Jun 15, 2018
build.sbt Twitter-oss: update OSS libraries post-release to 18.7.0-SNAPSHOT Jun 15, 2018
link-netty.sh [split] finagle-core: introduce Transports and Dispatchers Apr 12, 2012
pushsite.bash csl: Updated pushsites scripts for sbt 1.0.x Nov 10, 2017
sbt Upgrade sbt to 1.1.4 Apr 26, 2018

README.md

Finagle

Build status Codecov Project status Gitter Maven Central

Status

This project is used in production at Twitter (and many other organizations), and is being actively developed and maintained.

Finagle logo

Releases

Releases are done on an approximately monthly schedule. While semver is not followed, the changelogs are detailed and include sections on public API breaks and changes in runtime behavior.

Getting involved

Finagle is an extensible RPC system for the JVM, used to construct high-concurrency servers. Finagle implements uniform client and server APIs for several protocols, and is designed for high performance and concurrency. Most of Finagle’s code is protocol agnostic, simplifying the implementation of new protocols.

For extensive documentation, please see the user guide and API documentation websites. Documentation improvements are always welcome, so please send patches our way.

Adopters

The following are a few of the companies that are using Finagle:

For a more complete list, please see our adopter page. If your organization is using Finagle, consider adding a link there and sending us a pull request!

Contributing

We feel that a welcoming community is important and we ask that you follow Twitter's Open Source Code of Conduct in all interactions with the community.

The master branch of this repository contains the latest stable release of Finagle, and weekly snapshots are published to the develop branch. In general pull requests should be submitted against develop. See CONTRIBUTING.md for more details about how to contribute.