Skip to content

Cache DecimalFormatSymbols instances to reduce lock contention#1414

Merged
headius merged 1 commit intojruby:jruby-1_7from
bbrowning:decimalformatcache
Jan 17, 2014
Merged

Cache DecimalFormatSymbols instances to reduce lock contention#1414
headius merged 1 commit intojruby:jruby-1_7from
bbrowning:decimalformatcache

Conversation

@bbrowning
Copy link
Contributor

Constructing new DecimalFormatSymbols instances requires locking, and
in some sample Rails apps this contention was bubbling up as a
bottleneck. So, this change caches DecimalFormatSymbols instances
per-thread just like NumberFormat instances are already cached.

The overall throughput in my test application wasn't much changed
because of ActiveRecord's connection mutex still sitting in this way,
but this does get rid of one source of multi-threaded lock contention.

Constructing new DecimalFormatSymbol instances requires locking, and
in some sample Rails apps this contention was bubbling up as a
bottleneck. So, this change caches DecimalFormatSymbol instances
per-thread just like NumberFormat instances are already cached.

The overall throughput in my test application wasn't much changed
because of ActiveRecord's connection mutex still sitting in this way,
but this does get rid of one source of multi-threaded lock contention.
headius added a commit that referenced this pull request Jan 17, 2014
Cache DecimalFormatSymbols instances to reduce lock contention
@headius headius merged commit 716ebbc into jruby:jruby-1_7 Jan 17, 2014
@enebo enebo added this to the JRuby 1.7.11 milestone Feb 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants