Subject RE: [IBO] Slow speed over TCP/IP?
Author Eric Tishler
Hi Raymond,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />



Your problem is similar to mine. I am maintaining a fairly large-scale Client/Server system that has been implemented in Delphi and uses IB Objects accessing a Firebird Database. (It does not really matter if it is Firebird or InterBase)



Unfortunately, I inherited my application right after the initial release, so I was not involved in the initial design and implementation. And, I have spotted a number of places where the design is flawed.



In particular, I have 3 different types of clients that need to access a Firebird database. There are many of each of these 3 types of clients, so I have literally hundreds of clients that require access to Firebird on a regular basis.



In a proper implementation, what you are looking to accomplish is best approached as a formal Client/Server architecture.



There are many levels of design you can get into (n-tier, business object, etc...) but the most important point here is that you create a Server application to serve the client's requests. Rather than have the clients connect directly to Firebird, it is more reliably controlled by having a client make it's request to the Server application, and have the Server be the only application that accesses the database directly.



This way you limit access to the database through a single point, which provides a much better degree of control (both in the initial testing and the ongoing maintenance). Also, you can have the server application running on a second machine that is on a LAN along with the database machine. In this way you are further improving the reliability of database access by having your connections from the Server on the local area network to the database machine, not remotely.



You can also further improve performance by using a technique called Connection Pooling. That is, create a pool of persistent connections from the Server to the database. And, have the Server application 'dole out' these connections as needed by client requests. Once a request has been fulfilled, the Server places the connection back in the available pool. This decreases the overhead of reconnecting to the database, which can be a slow process depending on the load on the database server itself.



The Clients themselves should establish a socket connection to the Server to send requests in the form of a message, and well as receive Server responses back via messages, that contain the requested information. Of course you will have to devise a messaging scheme so that the Server can interpret the requests from the Client. And so the Client can interpret the response from the Server. Typically something like:



Client to Server:

<COMMAND><PARAM1><PARAM2><ENDOFCOMMAND> where the parameters are optional components depending on the nature of the request



Server to Client

<RESPONSE><DATA><ENDOFRESONSE> where the data returned is a direct response to the original request



You can get more sophisticated, with message numbering schemes and checksums. But TCP/IP covers a lot of this for you. The only potential pitfall is when the message in either direction is to large to send in one push. Hence, the need for the ENDOFCOMMAND and/or ENDOFRESPONSE tokens. In this case the Client or Server would have to continue reading incoming messages and append to the existing message context received so far, until the end token is received.



Hopefully you find this brief discussion on Client/Server architecture helpful. Believe me, it is not all that hard to design and implement. And the benefit gained in the form of system stability and control is well worth the effort.



Good Luck,



Eric Tishler

Software Architect

Resolute Partners, LLC

Cheshire, CT 06410

-----Original Message-----
From: rjschappe [mailto:rschappe@...]
Sent: Wednesday, June 30, 2004 11:47 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] Slow speed over TCP/IP?


I need to run several client applications remotely and I really
notice how slow the connection is (very painful!) and even after it
is connected, it just feels too sluggish...

I think I am missing something here!!!

Can anyone give me some pointers on how to speed up my apps when
running remotely via TCP/IP? settings to check, tips, tricks, etc...

-I am on a DSL running over a VPN to my client
-Running IBO 4.3Aa

Thanks for any help!,
--Raymond



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !



Yahoo! Groups Sponsor

ADVERTISEMENT
<http://us.ard.yahoo.com/SIG=129mm8imo/M=295196.4901138.6071305.3001176/D=groups/S=1705007183:HM/EXP=1088696976/A=2128215/R=0/SIG=10se96mf6/*http://companion.yahoo.com> click here
<http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=208370952>


_____

Yahoo! Groups Links


* To visit your group on the web, go to:
http://groups.yahoo.com/group/IBObjects/


* To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com <mailto:IBObjects-unsubscribe@yahoogroups.com?subject=Unsubscribe>


* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .




[Non-text portions of this message have been removed]