DatabaseManager and connection pooling

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

icepick
Posts: 18
Joined: 03 Mar 2009, 17:43

Post by icepick »

Lapo wrote:
But it seems that if no queries are done for about an hour or so, the next query will take at least a few minutes, which is totally unacceptable
Ok I see. In this case it is possible that the connection between SFS and the DB becomes stale.

In order to avoid this you can simply keep it alive from time to time by simply sending a call to the database, maybe using an inexpensive query like "SELECT 1". It can be done like once every 20 - 30 minutes.

Cheers
Thanks, that could be it. How would you recommend doing that in an extension, since it's all event-driven? Start a separate thread in init() and just do queries from a timer in that thread?

Also, since DbManager uses a connection pool, will this prevent other connections in the pool from going stale as well?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Start a separate thread in init() and just do queries from a timer in that thread?
Yes, correct.
Also, since DbManager uses a connection pool, will this prevent other connections in the pool from going stale as well?
Yes, I think so.
Lapo
--
gotoAndPlay()
...addicted to flash games
icepick
Posts: 18
Joined: 03 Mar 2009, 17:43

Post by icepick »

Lapo wrote:
Start a separate thread in init() and just do queries from a timer in that thread?
Yes, correct.
Also, since DbManager uses a connection pool, will this prevent other connections in the pool from going stale as well?
Yes, I think so.
Seems to be working so far... I'm sure I'll be back here if that changes :wink:
Thanks for the help.
Post Reply