Question

I found that my Sinatra application was so freaking slow, only happens on VMWare image on i3, i don't know why, it doesn't happened on same VMWare image on AMD APU, the line that causes the slowness is:

DataMapper.setup(:default, 'postgres://myuser:mypassword@127.0.0.1/mydbname')

it tooks almost 40-45 seconds to run that line wnen on VMWare image on i3, and i don't know why, is there any way to overcome this? this happens on Pry/IRB, on Ruby and JRuby.

It doesn't happened when using active_record or psql command line:

ActiveRecord::Base.establish_connection( adapter: 'postgresql', host: '127.0.0.1', database: 'mydbname', username: 'mypassword', password: 'mypassword', port: 5432 )

Ruby version: ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]

PostgreSQL version: postgres (PostgreSQL) 9.3.1

JRuby version: jruby 1.7.5 (1.9.3p392) 2013-10-07 74e9291 on OpenJDK Client VM 1.7.0_40-b60 [linux-i386]

Was it helpful?

Solution

this command solves my problem:

echo 127.0.0.1 `cat /etc/hostname` >> /etc/hosts
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top