<story><title>Why Is JRuby Slow?</title><url>https://earthly.dev/blog/jruby/</url></story><parent_chain></parent_chain><comment><author>habibur</author><text>Here&amp;#x27;s the summary: Ruby like most of all other Linux applications from that age was written to run in multi-process mode for parallelism, instead of being multi threaded.&lt;p&gt;But running multi-process is heavy on the JVM as it has to load the virtual machine and JIT for every process start, special when the processes are short lived.&lt;p&gt;Java solves it by encouraging running things as multi-threaded instead of multi-processed.&lt;p&gt;But Ruby wasn&amp;#x27;t built to run multi-threaded. And CRuby even if can run threads, does it by implementing a global thread lock. Aka, only one thread can run in a process at a time. The other threads have to wait until it finishes.&lt;p&gt;It looks like the multi-process implementation is good enough for CRuby and JRuby&amp;#x27;s attempt to turn it into multi threaded application didn&amp;#x27;t improve things.&lt;p&gt;Solution is to build a JVM that can load the virtual machine, JIT and execute applications fast enough like C programs.</text></comment>
<story><title>Why Is JRuby Slow?</title><url>https://earthly.dev/blog/jruby/</url></story><parent_chain></parent_chain><comment><author>crazy5sheep</author><text>There&amp;#x27;s once I was running some jruby stuff in jenkins during a build, the job kept on hanging on some stage, I thought there must be bug somewhere, I forced kill it a couple of times with no success, but kept the last one running before I head home. Then after a couple of hours, I found out an email said the built was passed... eventually, I had figured out that jruby was using &amp;#x2F;dev&amp;#x2F;random, since jenkins was running in vm, so no enough entropy was generated. after force mounting &amp;#x2F;dev&amp;#x2F;random to urandom, the hanging issue just disappeared.</text></comment>