On Friday, August 21, 2015 at 7:20:19 AM UTC-7, Dale Ackerman wrote:
>
> Thanks Jeremy;
>
> So if I am using JRuby/Sinatra on Community Passenger I will need to
> basically close/disconnect my newly initialized connections basic example
> of config.ru
>
> openedge_jdbc_uri = {
> :adapter => 'jdbc',
> :username => 'someuser',
> :password => 'somepassword',
> :driver => 'com.ddtek.jdbc.openedge.OpenEdgeDriver',
> :url =>
> 'jdbc:datadirect:openedge://somedbserver.bogus.com:7910;databaseName=customer'
> ,
> :pool_timeout => 120,
> :max_connections => ENV['RACK_ENV'].to_s.downcase == 'production' ? 16 :
> 4,
> :convert_types => false,
> :logger => $logger,
> :after_connect => Proc.new{|con|
> stmt = con.createStatement()
> stmt.execute("SET SCHEMA 'PUB'")
> }
> }
>
> DB = Sequel.connect(openedge_jdbc_uri)
> DB.extension(:newrelic_instrumentation)
> DB.extension(:connection_validator)
> DB.extend_datasets(Sequel::Progress::DatasetMethods)
> # Invalidate connection if idle for 1/2 hour
> DB.pool.connection_validation_timeout = 1800
> DB.extend_datasets(SequelProgessTenDatasetMethods)
>
> DB.disconnect
>
> run MyAwesomeWebService
>
>
>
> I have one more question: In the above code I set a pool size of 16. Now
> if I am deployed on a Passenger JRuby Sinatra stack and Passenger allocates
> 5 Processes(Forked) I would end up with 5 x 16 = 80 db connections?
> Further more because now we can only handle 5 concurrent requests (5
> Processes) I am only using 5 of the 80 db connections?
>
JRuby/JVM doesn't support forking, so I'm not sure you need the
DB.disconnect. You only need to use DB.disconnect if you are forking and
loading the app before the fork. I doubt that is the case on JRuby, but
the Phusion guys would know better than I.
> I wonder if I really need to go to a real Java (JVM) application server?
> (I don't want to do that. We are really a ruby shop. The only reason I
> am using JRuby is mostly because of having to connect to OpenEdge via JDBC).
>
You could always try puma with JRuby, I hear that combination is pretty
good. I don't have any production experience running JRuby apps, most of
my apps are low traffic and run fine on MRI/Unicorn.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.