Since I've changed parts of our application to query the database through JSON web services instead of a persistent database connection, I tend to run into the 'Connection limit exceeded' problem more frequently.

Does SA create a new connection for every http-request? And if so, when does it get released?

asked 14 Feb '13, 04:07

Liam's gravatar image

accept rate: 0%

Yes, each time you send a HTTP request to the database the server needs to connect to the required database. Your server will have a connection limit defined according to the licensed number of users and/or configuration that you have set for the server.

The connection to the database exists for the duration of the HTTP request. I.e. the connection is established when the HTTP request is received and the connection is dropped/released when the response has been sent back to the client. Note that there may be a small delay (under a second) to actually release the connection after the last byte of the response has been sent.

permanent link

answered 14 Feb '13, 08:04

Mark%20Culp's gravatar image

Mark Culp
accept rate: 40%

edited 14 Feb '13, 08:05

What about requests with a session ID - in my understanding (cf. the quote), each such session is always handled by the same connection, and therefore the current number of required connections may by bigger than the number of concurrent HTTP request, right? (I.e. 10 sessions would require 10 database connections, even if only one session has an active request...)

To cite the docs:

Stale sessions should be deleted and an appropriate time out should be set to minimize the number of outstanding connections because each client application connection holds a license seat. Connections associated with HTTP sessions maintain their hold on the server database for the duration of the connection.

(14 Feb '13, 08:57) Volker Barth
Replies hidden

FWIW, the connection pool used by HTTP requests by default does not matter w.r.t. licensing, as stated here:

Database connections that are pooled within the HTTP connection pool are not counted as connections in use for the purposes of licensing. Connections are counted as licensed connections when they are acquired from the pool.

(14 Feb '13, 09:00) Volker Barth
Replies hidden

Volker, You are correct. If an HTTP session is used then the database connection is maintained across HTTP requests - i.e. the connection is not released until the session is deleted.

Liam did not mention that he was using sessions. However, if he is using a session then it would actually be to his advantage in this case (presuming he only has a single client) because all requests to a specific session ID gets serialized by the server whereas HTTP requests that are not session related (or for a different session ID) will get executed concurrently.

For example, most browsers these days will open multiple socket connections to the backend server(s) to maximize throughput and minimize the time needed to fetch all of the content for a display page. This quite often results in multiple concurrent requests being handled by the HTTP server and therefore needing multiple concurrent database connections. If these connections were all part of the same session (e.g. using a SESSIONID cookie) then these requests would be serialized by the server and only require one database connection instead of many.

(14 Feb '13, 09:17) Mark Culp
Comment Text Removed

Correct again... except the pooled connections are not counted while they are in the pool. As soon as a connection is removed from the pool to process an HTTP request the connection gets counted against the license count. I.e. while the connection is idle sitting in the "pool" of connections the connection is not counted; as soon as it is not idle it is counted.

(14 Feb '13, 09:20) Mark Culp

Wonderful feedback. Thank you gentlemen.

(17 Feb '13, 23:24) Liam

Any discussion of New School connection persistence should include a discussion of transactions, since an uncommitted transaction remains in effect until an Old School connection is dropped.

(18 Feb '13, 09:10) Breck Carter
showing 3 of 6 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 Feb '13, 04:07

question was seen: 922 times

last updated: 18 Feb '13, 09:10