Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java Servlets
Expertise: Beginner
Nov 5, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Servlets vs. Applets

We currently use applets to allow users to access a database, but are looking for ways to improve performance. Is a servlet-based solution faster than an applet-based solution?

This will depend on the application, the number of concurrent clients, the average network latency and bandwidth between a client and the server, and other factors. In general, if you want your application to scale to large numbers of users, you will want to forego the applet-centric solution. If each client applet has to create a separate connection to the database, transfer data, and process it locally, you face several potential bottlenecks.

First, you could overload your database with too many connections. Second, you may have to transfer a lot of data over the network, which may take a long time. Third, the client may not have enough processing power or memory to process all of the data in a timely manner, if at all. Other problems also exist, such as the inability to centralize business logic, leading to software maintenance difficulties.

The preferred design for such a system is a three-tier architecture. A three-tier system consists of a client, a middle layer that performs transaction processing, and a back-end server. The client is usually lightweight, only able to issue queries and receive final results. An example of this would be a simple HTML form. The middle layer's job is to mediate access to server resources and possibly perform processing on the client's behalf. The server, of course, stores the database or other service that the client ultimately wants to access. Additional data processing can happen on the server and extra tiers can be added if multiple resources need to be accessed.

Multi-tier architectures offer several advantages. The primary advantage is the ability to scale to larger numbers of clients. The transaction processing layer makes this possible. It can keep a pool of open connections to the server, using them as appropriate to serve client requests, saving the overhead of opening a new connection for every client. Rather than overloading the server with queries, the transaction processor can throttle back the load on the server by serializing requests. Data processing can also be removed from the client and pushed closer to the data. The second major advantage is the ability to cleanly subdivide software development. Each layer performs a well-specified task that can be developed without overly impacting the other layers.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date