I am developing an API for a product based on an Oracle database, and I tried to use the ruby-oci8 gem, but I had a strange problem - OCI8.new is very slow, it takes 1.2-1.5 seconds to connect to the database.
For instance:
~ mmulev$ irb
2.1.1 :001 > require 'oci8'
=> true
2.1.1 :002 > def test
2.1.1 :003?> t0 = Time.now
2.1.1 :004?> OCI8.new('SCHEMA', 'STRONG_PASS', '//db_host:port/service_name')
2.1.1 :005?> Time.now - t0
2.1.1 :006?> end
=> :test
2.1.1 :007 > test
=> 1.217809
2.1.1 :008 >
The same thing in php (oci_new_connect) it takes about 0.1-0.2 seconds to establish a connection and a return handler.
Are there any other solutions besides the connection pool?
PS ruby API code was profiled by method_profiler and Benchmark, oracle v-11g
source
share