RPC

I l @ ve RuBoard

For users new to RPC, this section will provide a broad overview of what it is, and of the different components involved in the process. If you're already familiar with how RPC works, feel free to skip this section.

Speaking generically, RPC is a toolkit designed for distributed computing. It provides a framework for executing procedures on one system from another, completely independent system in a secure, reliable, and efficient manner.

The best way to understand the RPC programming model is perhaps by compar-ing it to the "regular" programming model, in which procedures, or functions, are invoked on the same system or within the same program. Figure 6.1 and Figure 6.2 illustrate the difference.

Figure 6.1. A local function call.

graphics/06fig01.gif

Figure 6.2. A remote function call.

graphics/06fig02.gif

As you can see from Figure 6.2, the RPC programming model is built completely around a client-server framework and consists of the following components:

  • An API to handle procedure registration and execution on the server, and procedure invocation on the client

  • A set of rules for encoding and decoding RPC requests and responses

  • A network transmission layer to actually perform communication between the client and server, and carry data packets back and forth (HTTP works well here, although other protocols may also be used)

Here's how it all comes together:

  1. A remote procedure is invoked by an RPC client.

  2. The procedure call, together with arguments (if any), is encoded into a request packet suitable for transmission across a network.

  3. The request packet is transmitted to the RPC server.

  4. The RPC server receives the packet and extracts the procedure name and arguments (if available) from it.

  5. The RPC server invokes the named procedure on the server and obtains a return value from it.

  6. The return value is encoded into a response packet.

  7. The response packet is transmitted back to the RPC client.

  8. The RPC client receives the response packet, decodes it, and extracts the procedure's return value from it. This result value can then be used by the client within a script or program.

Obviously, this is a simplified version of the RPC programming model ”it does not address issues such as procedure registration, state maintenance, error handling, or security. However, it should be sufficient to explain the fundamental principles of the programming model, and lay the foundation for the material in subsequent sections.

If you want to learn more about RPC, drop by this book's companion web site, which contains links to web sites with more information on the topic.

I l @ ve RuBoard


XML and PHP
XML and PHP
ISBN: 0735712271
EAN: 2147483647
Year: 2002
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net