ROR is developing very slowly, and production works great

I have one rubyonrails application which turned out to be very slow in development mode. Everything is in order, but even a simple β€œhello world” takes a few seconds in dev. I checked the session store and all the possible causes that I found on the network, but I did not find the problem. Am I missing something in common? "Completed in 1657ms (View: 226, DB: 39)"

+4
source share
4 answers

Development is definitely slower as it reloads all components. The operating mode loads components only when the server starts.

If you find that your application is still too slow in Production mode, you can start looking for bottlenecks. You can start by optimizing your database queries with include and include. You can also try to remove your gems and plugins systematically to find parts that slow down your code.

+6
source

This usually happens if you use webrick, its so slow that it misses your eyes.

Try installing mongrel in dev

gem install mongrel

+1
source

Create a new application, make sure that it is too slow - this will point to your server stack (apache, mongrel, passenger, etc.), and not to your application. If this is just your application, then google rails profiling - and choose one of the many options for profiling an application.

0
source

WEBrick does a reverse DNS lookup when connecting default IP addresses. In other words, it is trying to determine if your IP address is associated with a domain name. This is optional and takes too much time, so you can disable it.

Open the file "l / ruby ​​/ lib / ruby ​​/1.9.1/webrick/config.rb" and find the line with :: DoNotReverseLookup => nil.

Change nil to true .

Enjoy it!

0
source

Source: https://habr.com/ru/post/1301965/


All Articles