One ZConnection and many data aware components?

Discusions not-related to our Components

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
ccezar
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 19.06.2007, 18:07

One ZConnection and many data aware components?

Post by ccezar »

Hello,

I've finished coding stored procedures in my database and now it's time for user interface. I'm coding it in Delphi 7 with (surprise!) ZeosLib ;-)

The question is: which model is better from the performance and interoperability point of view?

1) One TZconnection component on the form, reused simultaneously by many datasources and dataware compontets?
2) Dedicated TZconnection component for each datasource existing on the form?

I'm using PostgresQL, so connection limit is not the issue.

Thank you in advance for any suggestions! :-)

Cezar
jozagulikoza
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.08.2007, 12:26

Post by jozagulikoza »

Mainly one TZConnection per aplication in a datamodul.

if you have TZConnetction per dataset and 10 datasets in your apl.
yuo have 10 real connenctons on DB serverve.
Imagine one aplication/user 10 connections on DB.
And imagine you have 15 users work with your program, 15X10 connectons.
ccezar
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 19.06.2007, 18:07

Post by ccezar »

OK. Doesn't it hurt TZconnection performance?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

As long as you don't use multiple independent theads all queries are run one by one anyway.
ccezar
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 19.06.2007, 18:07

Post by ccezar »

Well, I'm using threads. What will be ZConnection behaviour in this case? Will it be "blocking queue"?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

No idea...
All I can tell is that the database connection library is only loaded once. So maybe you get trouble when 2 connections use the same library. When connecting using different libraries you might be lucky the connections work 'simultaneously'.
Somebody else with more usefull information concerning threaded programs in combination with zeoslib?

Mark
jozagulikoza
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.08.2007, 12:26

Post by jozagulikoza »

If you use treads, yes open a connecton per tread
Can you tell us in which case you use treads.
Generali if you use trasacitons in your stored procedures it is enought, no needs for treafds.
I need more informations about your databese/aplication design.
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

FYI - I've been using Zeos in a multi-threaded Delphi app for some time now. It uses IntraWeb to produce a web application and the only problem I've had was with the TZSQLMonitor which was not completely thread safe.

BTW always use one TZConnection per thread.

Regards,

Ben
jozagulikoza
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 26.08.2007, 12:26

Post by jozagulikoza »

Its good exaple for multitreading and good design ;).
I havent proper solution for TZSQLMonitor in treads.
But, its not big problem for me.
Post Reply