TConnectionPool - Performance issue

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
stoffman
Senior Boarder
Senior Boarder
Posts: 50
Joined: 03.12.2020, 06:55

TConnectionPool - Performance issue

Post by stoffman »

A connection is being checked twice for being dead (by calling FConnections.Rollback) . Both when it is Acquired and when it is being returned to
the pool (see TConnectionPool.ReturnToPool and TConnectionPool.Acquire ).

Calling rollback is expensive.

I believe that TConnectionPool.ReturnToPool call is redundant. And removing it will not change the way applications actually work.


Thanks,
Yoni
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: TConnectionPool - Performance issue

Post by marsupilami »

Hello Yoni,

did you check that removing the call actually improves performance in your setup? Just out of curiosity: Which database / zeos driver do you use?

Best regards,

Jan
stoffman
Senior Boarder
Senior Boarder
Posts: 50
Joined: 03.12.2020, 06:55

Re: TConnectionPool - Performance issue

Post by stoffman »

Hi,

Sure. I removed the code and it does improve the performance. I'm using the PostgreSQL driver (connecting to server v13.2).

Doing a rollback is very expensive, as you have a full roundtrip to the server .


As aside note, there is also a bug that can lead to connection leakage when doing a rollback and the connection is set to AutoCommit, PostgreSQL throws an exception stating that an AutoCommit connection cannot be rolledback, then TConnectionPool.ReturnToPool marks this connection as unusable and obtains a new one while not closing or releasing the first
Post Reply