CORBA makes remote objects easy

Dan Kegel, LULA, 19 Feb 2002

Table of Contents

What is CORBA?

CORBA is like SOAP, RMI, DCOM, and RPC

Like SOAP, RMI, DCOM, and RPC:

CORBA is unlike SOAP

SOAP suffers from growing pains: CORBA had this kind of problem once too, but not anymore.

Worse, SOAP suffers from problems that probably won't go away:

CORBA is unlike RMI

RMI is great, but: Sun recognized this; Java now lets you use CORBA with RMI.

CORBA is unlike DCOM

DCOM works, but:

CORBA is unlike RPC

RPC is the basis of network file systems like SMB and NFS, and has been in use for over 15 years, but:

CORBA is well supported

CORBA has the following goodies:

CORBA in a nutshell

To use CORBA: Careful design is neccessary for robustness and good performance, just as with SOAP, DCOM, or RMI. These tools may make the network invisible, but just because you can't see it doesn't mean it can't hurt you.

Trivial Example: phone book without CORBA

/// Abstract C++ class to access a phone book
class PhoneBook {
    /// Look up the phone number for a given name
    String lookup(String name) = 0;

/// C++ program to use it
    /// Get access to a concrete subclass of PhoneBook
    MySQLPhoneBook book();

    String num = book.lookup("Fred Flintstone");
    std::cout << "Fred's number is " << num << endl;

Trivial Example: phone book with CORBA

/// file CorbaPhoneBook.idl: CORBA interface to a phone book
interface CorbaPhoneBook {
    /// Look up the phone number for a given name
    string lookup(in string name);

/// file C++ program to use CorbaPhoneBook
#include "CorbaPhoneBook.hh"

    /// Get a pointer to the naming service
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
    CORBA::Object_var nso=orb->resolve_initial_references("NameService"); 
    CosNaming::NamingContext_var nsv = CosNaming::NamingContext::_narrow(nso); 

    /// Look up the PhoneBook object
    CosNaming::Name name;
    name[0].id = "My Phone Book";
    CORBA::Object_var pbo = rootContext->resolve(name);
    CorbaPhoneBook_var book = CorbaPhoneBook::_narrow(pbo);

    /// Look up Fred's number with it
    CORBA::String_var num = book->lookup("Fred Flintstone");
    std::cout << "Fred's number is " << num << endl;

Real Example: ftp benchmark problem

To measure how many clients a FTP server can handle, you need a lot of clients -- more than you can really simulate with a single computer.

dkftpbench is a ftp benchmark that uses a single computer to simulate many users. It pooped out around five or so thousand ftp clients. I used CORBA to add distributed load generation to it; it can now test even the largest FTP server.

Real Example: ftp benchmark code

Copyright 2002, Dan Kegel
[Return to]