0

I have a problem, I use the cx_oracle + aiohttp + threadpollexecutor bundle to call a function in the database that checks parameters and insert data into Oracle tables. I noticed a strange feature: the very first request after midnight runs for more than 17 seconds, but all subsequent requests run for 20 milliseconds. The connection pool is not broken and is used as a global variable via a function. What could be the problem and why only the first request behaves like this??

RKG
  • 87
  • 4
  • At a rough guess the firewall is killing connections and the connection pool is having to recreate them. Can't say may without knowing more info. – Christopher Jones Sep 18 '20 at 22:43

1 Answers1

0

Christopher Jones gave you a suggestion. The easiest way to find out for sure is to set the environment variable DPI_DEBUG_LEVEL to the value 4 prior to running your application and redirecting stderr to a log file. Then you can see which ODPI-C function was run immediately after midnight and how long it took. If Chris' suggestion is correct, the likely call will be dpiConn_create().

Anthony Tuininga
  • 6,388
  • 2
  • 14
  • 23
  • Thanks Christopher, Anthony! I'll try it today. – RKG Sep 22 '20 at 08:30
  • And a small question - is there a way to deal with this? What is the best way to recreate the connection pool so as not to slow down the app? – RKG Sep 22 '20 at 09:07
  • @ChristopherJones dpiStmt_execute() so long (first call function with inserts after night): 8 seconds, it's not dpiConn_create() – RKG Sep 22 '20 at 21:08