Trying to figure out how to manage / use long-lived database connections. I have too little experience of this kind since I used DB with only small systems (up to 150 concurrent users, each of which had its own user interface / pass, so at any time there were up to 150 long-lived DB connections) or web pages (each the page request has its own connection to the database, which lasts less than a second, so the number of simultaneous connections to the database is small).
This time, a Java server and a Flash client will appear. Java connects to PostgreSQL. The joints are expected to be durable, i.e. They are expected to start when the Flash client connects to the Java server and end when the Flash client disconnects. Would it be better to share one connection between all users (clients) or make a private connection for each client? Or would some other solution be better?
*) One / common connection:
- (+) pros
- only one database connection for the entire system
- (-) minuses:
- Transactions cannot be used (for example, "user1.startTransaction (); user1.updateBooks (); user2.updateBooks (); user1.rollback ();" for one general connection there will be rollback changes that are performed using user2)
- long requests from one user may affect other users (however not sure about this)
*) :
- (+)
- (-) :
- , .. 10000 , 10000 , , , :) , , .
-, .. 15/60/900 (?) , . , . , , , , , - ..
"" - , (, " last_visit = now(), id =: user_id" ), , (, -, ). , , , , , ...
... ? ?