Inactive sessions Oracle JDBC

Hi,

I have couple opened sessions in INACTIVE status. I want to have only one session. How can I achieve this?

Thanks in advance for your help!

Advanced configuration in your connection settings in Ignition. Set Max Idle to zero. If you really only want to allow one connection, set max active to one.

Do note that disabling connection pooling like this will crush performance, as every request will have to wait if the connection is busy, and there will never be an idle one to keep latency low.

1 Like

How can I check, if one session is enough? Is there some tool in gateway diagnostics to check it?

Yes, there are gateway diagnostics that should help.

1 Like

Hi,

Thanks for your answers!

I watched the store and forward diagnostics for couple minutes and these values were one of the highests:

Will one session handle it?

Do note that disabling connection pooling like this will crush performance, as every request will have to wait if the connection is busy, and there will never be an idle one to keep latency low.

We send data from PLC to database and it's crucial for us to keep the order of variables. If one session is busy, will Ignition keep the order of values?

Looks like a light load. One session is likely to suffice.

Sorry, that's a horrible design. The data should always carry unambiguous ordering information with it. I don't think you'll find any other guarantees at all. (Ignition's historian includes timestamps with each data point, so that should be fine.)

Thanks again for response.

Couldn't find this info in the doc - when and why Ignition creates another database session?

All database connections, by default, are "pooled". That is, multiple simultaneous connections are created and kept open (per the advanced settings) so that queries don't have to wait for the time it takes to open a connection (session). When the query is done with the connection, instead of closing, it is returned to the pool. This architecture is commonly used for high-performance applications (really, necessary for high performance).

The pool also means queries can run in parallel--improving response time, and avoiding problems when an occasional query takes a long time.

Thanks!

as every request will have to wait if the connection is busy

So how much delay should appear, to make database connection to decide, that another session is needed?

No delay. If the active connections is less than the allowed, and no idle connection is available to use, a new connection is created and used immediately.

Hmm, I meant - how long the connection should be busy, to trigger the database to create new connection/session?

It doesn't work that way. When a query needs to run, and no idle connection is available:

  • If the maximum number of connections is already active, the query goes on a wait queue.

  • Otherwise, a new connection is created and used.

  • When there are queries waiting in the queue, and an active query finishes, the connection is handed to the first waiting query.

Hi,

I've set Max Idle to zero and Max Active to one and we've started to get these errors:

I had to return to Max Idle = 8 and Max Active = 8 to stop the errors.

What should we do, to make the change without errors?

You should contact support. I'm not sure what you are trying to achieve is possible with Ignition's connection pooling architecture.