0

I'm using JDBC in my application with business logic(client). This JDBC connects to the database which is in another machine(server). In this case, my JDBC directly connects with the database and stores & retrieves data. This is TWO-TIER architecture right?

In another application, for example servlet programming, I'm simply having browser in my client machine which is the presentation Layer(Client tier). Let me consider my business logic as Application Layer(Second tier) and database as Data layer(Third tier). Still I'm using JDBC to connect my application(business logic) with the database. Second and third tiers reside at server now.

By the above example, in three tier architecture a browser only added additionally and kept my business logic at server. I'm not feeling any performance difference other than these. If I'm wrong please correct me and explain me the exact architecture of 2-tier and 3-tier with other examples. Thanks in advance dear friends.

Rajkumar
  • 269
  • 2
  • 6
  • 13

1 Answers1

0

What you say is right.

  1. You first example is two-tier.
  2. The second example is three-tier.

A three-tier architecture can represent an important performance gain if the link between browser and server is slower than the link between server and DBMS. This is because usually the business logic needs to make several calls to the DBMS and/or present to the user only a small part of the information returned by the DBMS. Having the business logic in the client while having a slow connection to the DBMS would represent an important performance penalty.

In a typical web scenario, the connection between client and server is usually several times slower than the connection between server and DBMS, and there is your performance gain.

pmoleri
  • 4,238
  • 1
  • 15
  • 25
  • Just to add a little point. Normally 2-tier run faster in small scale, due to less overhead. However, the main benefit of multi-tier architecture give us is scalability. – Adrian Shum Oct 11 '12 at 02:02
  • As well, in multi-tier architecture, we dont need to have the copy of business logic in each client machine as 2-tier architecture. Just place the business logic once in server is enough. Right? – Rajkumar Oct 11 '12 at 07:22
  • @AdrianShum agree, but only if you have a fast link to the dbms, if you have only one client (small scale) but you are connecting to the dbms via dialup modem, three-tier would probably be a lot faster. – pmoleri Oct 11 '12 at 13:44
  • @Rajkumar indeed that's another benefit, but the question was about performance, I think. – pmoleri Oct 11 '12 at 13:45
  • @pmoleri When the Business logic and DB reside at same machine only, the data retrieval and storing will be fast. If both are placed in different machines, then speed of retrieving data from and storing data to DB will depend on the connection speed between Application server(machine which is having business logic) and DB server. Am I right? – Rajkumar Oct 11 '12 at 16:48
  • The best configuration depends on the processing vs speed neeeds. If both BL and DBMS reside in the same server they share resources and perfomance can be worse than having different servers connected with a fast link, for example Gigabit. – pmoleri Oct 11 '12 at 17:27
  • Yeah. That is true. But if both reside at different machines and connection speed is very slow, then this would also make worse performance. Isn't? If both reside at same machine, making connection with DB will be faster than connecting with DB which is in another machine even they both share same resource? – Rajkumar Oct 12 '12 at 11:49
  • Yes, that's probably correct. Although, I can think in a scenarios where that's not necessarily true, for example, a not so slow connection between web server and dbms (50mbps wifi), and servers with few cpu cores for the expected load (concurrent clients), in such a case use two or more servers it's probably better. – pmoleri Oct 12 '12 at 13:31
  • Yes. Just now I got to know, even if we split the 'application and data' separately and keep both in the same machine, it is just layering and not tiering. Simply we organize the code logically in layers but it'll become tier only if we make physical deployment of layers. – Rajkumar Nov 02 '12 at 12:13