Guide to Client/Server Computing Part 1: Distributed Computing

Guide to Client/Server Computing Part 1: Distributed Computing
Page content

Part 1: Distributed Computing

A software program (or application system) consisting of a number of software components can be executed on one or more computers. If only one computer is involved, then the entire application system resides on that computer. If more than one computer are involved, then the software components are distributed across the computers.In the latter case, not only can we leverage the increased processing power of multiple computers, we can also divide system functionalities into multiple, loosely-coupled, highly-cohesive components and distribute them across a networked environment. Such is the essence of distributed computing.

So what if we can distribute system functionalities? What are its advantages? The greatest advantage of distributed computing is in its provision for maximizing the utility of every computer available. For most of the time, computers are not used and are left idle. With distributed computing, every computer can be used to perform some parts of the overall system functionalities.

How do we distribute components across a network of computers? A typical approach is to divide a software application into multiple layers catering for the presentation, business logic and database functionality commonly found in a business system. Where a layer is computing intensive, we use a more powerful computer to serve the layer, and where a layer does not require much computing, we can engage a less powerful computer for the purpose. For example, the database layer has been known to be computing-intensive and is thus separated from the other two layers. A more powerful computer machine is then used for the database layer.

How do components in a distributed computing environment communicate with one another? A component is a set of objects grouped together to provide a functionality or service. Objects send and receive messages from one another across a network. The object that sends a message is typically known as a client and the object that receives and responds to a message is known as a server. A client communicates with a server via a communication protocol which must first be established between the client and server. Messages sent from clients are acted upon by methods in a server. The server must, through a pre-determined means, inform the clients of the methods they can invoke. The server can choose to expose only those methods that it wants the clients to know and therefore invoke.

In a Java environment, distributed computing involves objects communicating with one another across multiple Java Virtual Machines (JVMs). Although it is fairly simple for a client object to invoke a method on a server object within a single Java Virtual Machine, the situation is a bit more complicated in a distributed computing environment as there are network complexities to deal with. To simplify method calls among objects across the network, Java provides a set of application programming interface (API) for remote object communications.

The API is known as the Java Remote Method Invocation (RMI) API. Supported by the Java Remote Method Protocol (JRMP), RMI is a mechanism for enabling an object in one JVM to communicate remotely with an object in another JVM. That is, a client can call a server in separate JVMs as if the server is residing in the same JVM as the client. Remote Method Invocation (RMI) is Java’s solution for inter-JVMs object communication. What RMI does is to make objects in separate JVMs behave like local objects in the same JVM. With RMI, objects can be called remotely, resources can be shared, and the processing load can be distributed over a number of computers. RMI promotes location transparency since clients are unaware of where the remote objects are located, and there is no difference in the way a method is invoked on a local or remote object. The underlying network-level communication among the separate JVMs is managed by the RMI system.

In our next article “Client/Server Computing Part 2: Remote Method Invocation (RMI)”, we will explain the Java RMI architecture.

This post is part of the series: Client/Server Computing

Programs have often been written to run on one computer. What if there are more than one computers available? Can we have a software program to run on more than one computers? How do we maximize the performance of these machines? How does Client/Server Computing address this need?

  1. A Guide to Client/Server Computing: Part One
  2. A Guide to Client/Server Computing: Part Two
  3. A Guide to Client/Server Computing: Part Three
  4. Java Naming and Directory Interface (JNDI)
  5. An RMI-IIOP Application