On 23 May 2016 10:05 p.m., "saurabh verma" <saurabh.vrm@gmail.com> wrote:
>
> Hey Guys,
> I am running a service which has one controller action. I am connected to external db. For any db query, I am getting slow response. Looks like execution time is ok, but still there is some other delay which I am not able to figure out. When I am running this endpoint I am getting the following rails logging statement. I can understand active_record time, but don't know the remaining response time. I also tried to get the time spend for the method function1(mentioned in the below code), which is exactly same as total time(3561 ms)
>
> Completed 200 OK in 3561.5ms (Views: 0.3ms | ActiveRecord: 644.8ms)
>
>
>
> Here is my code
>
> class MyModel < ActiveRecord::Base
>
> if Rails.env != 'test'
> establish_connection("#{Rails.env}")
> end
>
> class << self
> def function1
> self.first
> end
> end
> end
>
> database.yml
>
> development:
> adapter: 'sqlserver'
> mode: 'dblib'
> host: 'MyHost'
> username: 'username'
> password: 'secret'
> database: 'MyDB'
> pool: 1
>
Write a simple shell script to connect and run a query and see how long that takes. That will tell you if it is an issue connecting to the remote db
Colin
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/be80bab3-a44e-40ae-9eb8-04335df5fed8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsnSGaRUL7LUZgtBFft3rv7%2BOcmX5rM4RGzyiYap%2BivaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment