On Fri, Aug 21, 2015 at 3:41 PM, Dale Ackerman <
dale...@gmail.com> wrote:
> Hi Thanks for the reply.
>
> My question came about due to information I had gotten regarding the Sequel
> gem It is a ORM like ActiveRecord but the author had stated that Passenger
> held onto some descriptor or handle and some how shared connection pool
> between forked processes?
I think that person is referring to smart spawning. See:
https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/#unintentional-file-descriptor-sharing
However, this does not apply at all if you are using JRuby, because
smart spawning is not supported when using JRuby. When using JRuby,
Passenger will always use direct spawning.
> 1.) Community version of Passenger will only Fork New Processes example 5
> processes == 5 complete independent versions of the application load managed
> etc. by Passenger. Even for Jruby.
Yes.
> 2.) The forked processes created and managed by Passenger are completely
> resource independent (Memory, I/O...)
Yes.
> 3.) For Community version of Passenger and JRuby(JVM) each request is load
> balanced across "Processes" again example 5 JRuby processes == 5 concurrent
> request.
Yes.
> So no advantage to using JRuby?
One advantage is better Java integration. Another advantage is that
you can leverage all the JRuby performance improvements over MRI (e.g.
the JIT and the garbage collection), with the exception of
multithreading.
> There are not any request threads
> created in the JRuby (Rails or Sinatra) application?
There is only 1 request thread in each JRuby application process.
> 4.) The Enterprise version of Passenger does allow Threading if the
> underlying language can take advantage. so example 1 Jruby Process ==
> However many concurrent request threads...?
That depends on the configuration:
https://www.phusionpassenger.com/library/config/apache/reference/#passengerthreadcount
> and it is at this point that
> resources such as connection pools would be shared.
Yes, but only within a single process.
> The author of the Sequel ORM gem recommended closing newly initialized
> connections before rackup completes i.e. run MyApplication
That advice is exactly like what is documented at
https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/#unintentional-file-descriptor-sharing.
However, the Sequel author's advice does not apply at all in your
case, because you are using JRuby, so no smart spawning is supported.
> So if I configure my JRuby application to use 10 DB connection in the pool I
> am wasting my time and resources because each Process can only handle one
> request/response at a time?
Yes. It only makes sense to configure the DB pool size if you have
enough threads running.