Subject | Controlling sweep in Firebird Embedded |
---|---|
Author | canacourse |
Post date | 2011-10-25T20:20:24Z |
Using Firebird embedded via Ado provider and noticed that occasionally our c# application takes several minutes to start up - twenty minutes in fact. After shutting down the application and connecting to the same database with IBexpert the same delay is observed.
I'm pretty sure this is down to automatic garbage collection but we appear not to be able to control it and this issue has happened several times. These is what we've tried or thought might work so far.
1. Set sweep interval to 0 and run gfix sweep in the early hours.
Gfix does does not run against an embedded database
Fbvalidator does not appear to work on an firebird embedded database. (Maybe for the same reasons as gfix) see http://tracker.firebirdsql.org/browse/DNET-399
2. Set sweep interval to 20000 and set "GCPolicy = background" in firebird.conf
Sweep does not appear to be running. The application ran overnight and many 100' of 1000's of records are added and deleted. Yet when the app is restarted the next day the delay occurs. SELECT is called at least once a minute in the app.
Not sure if it will help but here is some stats for the database just before the app was restarted and the 20 minute delay occurred. Sweep interval was 20000.
Oldest transaction 1463306
Oldest active 1702095
Oldest snapshot 1702095
Next transaction 1702097
And from a few minues after the app was fully loaded (After 20 minute delay)
Oldest transaction 1702097
Oldest active 1712652
Oldest snapshot 1712652
Next transaction 1712653
Anything else we can try? Or should we move to another version of Firebird so we can run manual sweep.
Thanks.
I'm pretty sure this is down to automatic garbage collection but we appear not to be able to control it and this issue has happened several times. These is what we've tried or thought might work so far.
1. Set sweep interval to 0 and run gfix sweep in the early hours.
Gfix does does not run against an embedded database
Fbvalidator does not appear to work on an firebird embedded database. (Maybe for the same reasons as gfix) see http://tracker.firebirdsql.org/browse/DNET-399
2. Set sweep interval to 20000 and set "GCPolicy = background" in firebird.conf
Sweep does not appear to be running. The application ran overnight and many 100' of 1000's of records are added and deleted. Yet when the app is restarted the next day the delay occurs. SELECT is called at least once a minute in the app.
Not sure if it will help but here is some stats for the database just before the app was restarted and the 20 minute delay occurred. Sweep interval was 20000.
Oldest transaction 1463306
Oldest active 1702095
Oldest snapshot 1702095
Next transaction 1702097
And from a few minues after the app was fully loaded (After 20 minute delay)
Oldest transaction 1702097
Oldest active 1712652
Oldest snapshot 1712652
Next transaction 1712653
Anything else we can try? Or should we move to another version of Firebird so we can run manual sweep.
Thanks.