-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
- JRuby version (
jruby -v):jruby 1.7.26 (1.9.3p551) 2016-08-26 69763b8 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_101-b13 +jit [darwin-x86_64] - Operating system and platform (e.g.
uname -a):Darwin **.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
Description
Extensively Using ruby extend functionality blocks threads which in turns causes server performance issues.
extend method calls jruby addSubclass function which is a bottleneck.
Background
Many libraries that provide JSON serialization make use of extend. Under heavy load, this causes performance degradation.
Code Snippet to Reproduce Issue:
module Bar
def hello
p "hello from bar!"
end
end
class Foo
def hello
p "hello!"
end
end
threads = 1000.times.collect do
Thread.new do
10000.times do |i|
foo = Foo.new
foo.extend(Bar)
end
end
end
threads.each {|t| t.join }
Run the above code snippet and capture thread dump. You will see a lot of threads waiting to enter synchronized this block.
here is an example thread dump.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels