A Fast Object Request Broker
This is a project for the Component-Based Software Design exam of the Master Degree in Embedded Computing Systems at Scuola Superiore Sant'Anna, Pisa.
The project consists in the implementation of an Object Request Broker (ORB) and Remote Procedure Call (RPC) mechanism.
A distributed program using the FORB library to perform RPC calls could gain performance improvements in certain scenarios, without any penalization if said conditions are met. The optimal scenario is the one in which multiple communicating components are deployed on different containers (or virtualized environments) on the same host. This often happens in cloud environments and the common solution so far is to use sockets to exchange data, even if the two containers are on the same host.
The approach of this library is to use a shared memory area instead if the optimal scenario is detected, which eliminates the need of bytes marshalling/unmarshalling when serialization/deserialization of exchanged data is performed. If said condition is not met, the library uses once again socket communication, so communication between various hosts is not affected by the library itself.
While right now this acceleration mechanism works only if the two programs that need to communicate share an IPC namespace, it can be further expanded in the future to adapt it to the more general scenario illustrated above.
The project is build under CMake and thus it resembles common CMake projects file tree structure.
Source files are within sub-folders of the root folder, each associated with a sub-project which can be either built separately or altogether the main project.
The folders containing sub-projects are:
- compiler — the compiler for the FORB IDL language, which is an Interface Definition Language that resembles CORBA IDL language and that can be used to define classes that can be accessed remotely using the FORB library RPC mechanism.
- library — the FORB library itself, it contains all source code and headers needed to build and install the shared library under a Linux host. Public headers (which will be installed on the host include path) are within library/include subfolder.
- profiler contains a performance evaluation application that consists of a client-server application that measures round-trip-time on various data transfers.
Other folders are:
- examples — contains a few examples of FORB IDL files.
- evaluation — contains the results of two performance evaluations obtained on two different machines using the profiler application.
- docs — contains input Doxygen files, used either during CMake build or during automatic documentation generation (see Documentation).
Building the project requires CMake. It is pretty simple to build in Release
mode as it requires only the creation
of a build
folder within project root (to perform out-of-source build) and the execution of the following lines
within said folder:
cmake ..
make all
That's basically it, the build command will then generate a folder within build
directory for each source folder
(basically compiler, library, tests and profiler), each containing the targets associated with the corresponding source folder.
This will build also Doxygen documentation, see Documentation.
To execute a compiled target, simply move to the corresponding folder in build
subtree and execute it.
For example, to start the profiler application that has been used in [project-report.pdf] to evaluate framework performances, move to
build/profiler
folder and execute
./profiler_server &
./profiler_client ../../profiler/rpc_db.json
Results will be written to build/profiler/results
folder, similarly as they are in subfolders of evaluation folder.
The previous command will build everything in Release mode, which doesn't have any relevant informations for debug purposes. To build it again using Debug mode, create a new build
folder and use cmake -DCMAKE_BUILD_TYPE=Debug ..
instead of previous cmake ..
command. Debug mode won't generate Doxygen documentation, but it can still be accessed via the online documentation, see Documentation.
Once the project has been built using previous procedure it can be easily installed under the Linux host by
executing make install
as superuser within build
directory.
This command will install:
- Compiler executable
forbcc
under/usr/bin/
- Shared library
libforb.so
under/usr/lib/
- Include files under
/usr/include/forb
- A few shared
.cmake
files in/usr/share/forbcc/cmake
andusr/share/libforb/cmake
which can be used to build other projects with CMake that use FORB-generated sources. A more detailed explanation will be added soon.
Notice that is totally not necessary to install the library to build targets within tests or profiler folders, because
it will automatically use files within build
directory to compile FORB IDL files and link each target with
the shared library, re-building needed files on-demand if necessary
This project uses Doxygen to document code for both the compiler and the shared library.
Documentation for the project can be found online on CodeDocs website here.
For now there is no project main documentation file, but each class in compiler and library targets has been properly documented. Check them out by clicking on the
Classes
button or simply use this link.
The docs folder contains two Doxyfile, which will be used depending the type of build performed:
- when building using CMake in
Release
mode (inDebug
mode Doxygen generation is disabled), the docs/CMakeDoxyfile.in will be used; - the other file, docs/Doxyfile.in will be used only to generate documentation using CodeDocs whenever a new commit is pushed on the main branch on the GitHub repo.