- Previous thread: jruby-user - Memory leak issue after restart of rails application in tomcat
- Next thread: jruby-user - sqljdbc4.jar and rails 3
- Threads sorted by date: jruby-user 201007
I am running a jruby application on sinatra and using activerecord and
after I have given the application a significant amount of traffic, i
start to run out of connections in my connection pool. It got me
thinking that since i am not in rails and i have manually configured
activerecord myself, should i add code to return the connections to
the pool at the end of each request to sinatra? My guess is that
rails does this for free, but not in sinatra and this might be the
cause of my issue.
thx.
-karl
http://xircles.codehaus.org/manage-email
after I have given the application a significant amount of traffic, i
start to run out of connections in my connection pool. It got me
thinking that since i am not in rails and i have manually configured
activerecord myself, should i add code to return the connections to
the pool at the end of each request to sinatra? My guess is that
rails does this for free, but not in sinatra and this might be the
cause of my issue.
thx.
-karl
http://xircles.codehaus.org/manage-email
That exactly what i did in an after filter. I also had to set :lock, true
Jay
Jay
Why did you have to set lock to true?
Thx!
That exactly what i did in an after filter. I also had to set :lock, true
Jay
> I am running a jruby application on sinatra and using activerecord and after I have given the application a significant amount of traffic, i start to run out of connections in my connection pool. It got me thinking that since i am not in rails and i have manually configured activerecord myself, should i add code to return the connections to the pool at the end of each request to sinatra? My guess is that rails does this for free, but not in sinatra and this might be the cause of my issue.
>
> thx.
>
> -karl
>
> >
> http://xircles.codehaus.org/manage-email
>
>
http://xircles.codehaus.org/manage-email
Why did you have to set lock to true?Thx!
Jay
> I am running a jruby application on sinatra and using activerecord and after I have given the application a significant amount of traffic, i start to run out of connections in my connection pool. It got me thinking that since i am not in rails and i have manually configured activerecord myself, should i add code to return the connections to the pool at the end of each request to sinatra? My guess is that rails does this for free, but not in sinatra and this might be the cause of my issue.
>
> thx.
>
> -karl
>
> http://xircles.codehaus.org/manage-email
Thx!
That exactly what i did in an after filter. I also had to set :lock, true
Jay
> I am running a jruby application on sinatra and using activerecord and after I have given the application a significant amount of traffic, i start to run out of connections in my connection pool. It got me thinking that since i am not in rails and i have manually configured activerecord myself, should i add code to return the connections to the pool at the end of each request to sinatra? My guess is that rails does this for free, but not in sinatra and this might be the cause of my issue.
>
> thx.
>
> -karl
>
> >
> http://xircles.codehaus.org/manage-email
>
>
http://xircles.codehaus.org/manage-email
Why did you have to set lock to true?Thx!
Jay
> I am running a jruby application on sinatra and using activerecord and after I have given the application a significant amount of traffic, i start to run out of connections in my connection pool. It got me thinking that since i am not in rails and i have manually configured activerecord myself, should i add code to return the connections to the pool at the end of each request to sinatra? My guess is that rails does this for free, but not in sinatra and this might be the cause of my issue.
>
> thx.
>
> -karl
>
> http://xircles.codehaus.org/manage-email
We are using a builder template and I was setting instance variables
on my sinatra object. (I have a class that derives from Sinatra::Base
When I retrieve information from ActiveREcord I was setting it to an
instance variable on the class and invoking builder to generate some
XML. This was getting in the way of multiple requests... I think... I
was getting odd errors before setting lock to true.
Now that things are working and we are profiling the system I am going
to go back and "investigate" that decision to see what I can do.
Jay
on my sinatra object. (I have a class that derives from Sinatra::Base
When I retrieve information from ActiveREcord I was setting it to an
instance variable on the class and invoking builder to generate some
XML. This was getting in the way of multiple requests... I think... I
was getting odd errors before setting lock to true.
Now that things are working and we are profiling the system I am going
to go back and "investigate" that decision to see what I can do.
Jay
Makes sense. I added this to my my Sinatra::Base class but i am still
running out of db connections:
after do
ActiveRecord::Base.clear-active-connections!
end
Any ideas?
thx!
http://xircles.codehaus.org/manage-email
running out of db connections:
after do
ActiveRecord::Base.clear-active-connections!
end
Any ideas?
thx!
http://xircles.codehaus.org/manage-email
hmm. I do that as well here is a snippet of my code:
#ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish-connection(db-configs[MAP-ENV])
class MapServiceApp < Sinatra::Base
use SeaChange::CausalityFilter
set :lock, true
configure do
SeaChange::Logging.init('.')
end
LOGGER = SeaChange::Logging.get-logger("map-service")
#LOGGER = $stdout
LOGGER.debug "Logger map-service initialized"
end
helpers do
def logger
LOGGER
end
end
after do
#close all db connections if we are using JDBC pooling closing
here will just return to the pool.
ActiveRecord::Base.clear-active-connections!
end
I guess the next question is :
What database are you using? What jdbc driver? Could that need to be
configured differently?
What app container are you running under? We war up our app and run
it in tomcat
Jay
#ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish-connection(db-configs[MAP-ENV])
class MapServiceApp < Sinatra::Base
use SeaChange::CausalityFilter
set :lock, true
configure do
SeaChange::Logging.init('.')
end
LOGGER = SeaChange::Logging.get-logger("map-service")
#LOGGER = $stdout
LOGGER.debug "Logger map-service initialized"
end
helpers do
def logger
LOGGER
end
end
after do
#close all db connections if we are using JDBC pooling closing
here will just return to the pool.
ActiveRecord::Base.clear-active-connections!
end
I guess the next question is :
What database are you using? What jdbc driver? Could that need to be
configured differently?
What app container are you running under? We war up our app and run
it in tomcat
Jay
I am using jetty-rackup, but i am using activerecord connection
pooling to mysql. Here is my database.yml
staging:
adapter: jdbcmysql
database: mydatabase
username: username
password: **********
host: 127.0.0.1
port: 3307
pool: 30
Thanks!
-karl
http://xircles.codehaus.org/manage-email
pooling to mysql. Here is my database.yml
staging:
adapter: jdbcmysql
database: mydatabase
username: username
password: **********
host: 127.0.0.1
port: 3307
pool: 30
Thanks!
-karl
http://xircles.codehaus.org/manage-email
I forgot to mention that I am using sql server 2000. Which uses the
jtds driver
hmm. I wonder if there is something going on at the jdbc driver layer...
actually I am not specifying the pool size... (isn't it 5 by default?)
here is my info:
production:
adapter : jdbcmssql
jndi : java:comp/env/jdbc/map-service-ds
Jay
jtds driver
hmm. I wonder if there is something going on at the jdbc driver layer...
actually I am not specifying the pool size... (isn't it 5 by default?)
here is my info:
production:
adapter : jdbcmssql
jndi : java:comp/env/jdbc/map-service-ds
Jay
the big difference is that you are using the app server's data
source. I am going to give that a try and see if i notice anything
different.
thx
http://xircles.codehaus.org/manage-email
source. I am going to give that a try and see if i notice anything
different.
thx
http://xircles.codehaus.org/manage-email
Related Threads
- Haskell-cafe - finding the right mathematical model - haskell-cafe
- Using sockets (nsIServerSocket) in XPCOM component (Firefox Extension) - dev-extensions
- Panic in destroy_dev_sched_cb() for tty - freebsd-stable
- wp-hackers - Auto-generation of post - wordpress-hackers
- android-developers - Does anybody know why PackageManager.getApplicationIcon() doesn't work in Android 2.2 Froyo? - android-developers
- PATCH 0/2 - blktrace: startup / shutdown race fixes - linux-kernel
- ARIN Meetings Fellowship to Attend ARIN XXVI - Apply by 6 August - nanog
- help with loading core files - gnu-gdb
- g_file_storage broken in gregkh-07-usb-2.6.35-rc5.patch - linux-usb
- asterisk-users - VUC Friday: Twilio OpenVBX - asterisk-users