devxlogo

Servlets vs. Applets

Servlets vs. Applets

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

Answer:
This will depend on the application, the number of concurrentclients, the average network latency and bandwidth between a client andthe server, and other factors. In general, if you want yourapplication to scale to large numbers of users, you will want toforego the applet-centric solution. If each client applet has tocreate a separate connection to the database, transfer data, andprocess it locally, you face several potential bottlenecks.

First, youcould overload your database with too many connections. Second,you may have to transfer a lot of data over the network, which may takea long time. Third, the client may not have enough processingpower or memory to process all of the data in a timely manner, if atall. Other problems also exist, such as the inability to centralizebusiness 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 performstransaction processing, and a back-end server. The client is usuallylightweight, only able to issue queries and receive final results. Anexample of this would be a simple HTML form. The middle layer’s jobis to mediate access to server resources and possibly perform processingon the client’s behalf. The server, of course, stores the database orother service that the client ultimately wants to access. Additionaldata processing can happen on the server and extra tiers can be added ifmultiple resources need to be accessed.

Multi-tier architectures offer several advantages. The primary advantageis the ability to scale to larger numbers of clients. The transactionprocessing layer makes this possible. It can keep a pool of open connectionsto the server, using them as appropriate to serve client requests, savingthe overhead of opening a new connection for every client. Rather thanoverloading the server with queries, the transaction processor can throttleback the load on the server by serializing requests. Data processing canalso be removed from the client and pushed closer to the data. The secondmajor advantage is the ability to cleanly subdivide software development.Each layer performs a well-specified task that can be developed withoutoverly impacting the other layers.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist