Reputation: 411
Our .NET web app uses ODP.NET for connections and its Oracle User for connecting to database is "webuserOracle". That web app always close connections and dispose connections.
However, on our Oracle 10g database, we see that sessions and processes values of Oracle User "webuserOracle" is always high, as they woudn't close or die.
We have decided to set up on Oracle profile for "webuserOracle" in order to limit the connect time up to 5 minutes.
CREATE PROFILE profile_webuserOracle LIMIT CONNECT_TIME 5;
ALTER USER webuserOracle PROFILE profile_webuserOracle;
Question:
For a web app, limiting connection to 5 minutes, means that the user could interact, say, 2 hours with the web app. The limit of 5 minutes is only for events triggered (like clicking a button) to connect to database. 5 minutes for everything that happened between Con.Open and Con.Dispose:
Dim con As OracleConnection = oraConexion()
con.Open()
''' There'll be a limit of 5 minutes to run the code here
con.Close()
con.Dispose()
Upvotes: 0
Views: 550
Reputation: 231661
Setting a CONNECT_TIME
in a profile for a web application is likely to be a very bad idea.
First off, generally, a three-tier application is going to make use of connection pools in the middle tier. That means that the middle tier servers open a pool of connections to the database that remain open for a long period of time and get handed out to web sessions as needed. That means that a single web user that is clicking around through the site is likely to get different database sessions with each click and that a single database session will be used by a very large number of web users.
If you set a CONNECT_TIME
for your connection pool connections,
select 1 from dual
) on every connection that it gets from the pool to verify that the 5 minutes hasn't elapsed before the interaction starts but there is no guarantee that the timeout won't be reached when you run the first query on the page. What is the real problem you are trying to solve? It is perfectly normal that the middle tier will maintain a pool of database connections that do not close. That is perfectly normal and healthy. If you want to reduce the number of connections that are open at any one time, you can adjust the connection pool settings on your middle tier servers.
Upvotes: 1