Pages in Guide

Getting Started


The example source package contains several runnable examples. The examples use a simple PingPong service where a client can call “ping” on a server. Client Code Firstly we declare who the client is and who the server is that we’re going to connect to. Note that the client does not actually bind to port 1234, it is just used as a “name”. PeerInfo client = new PeerInfo("clientHostname", 1234); PeerInfo server = new PeerInfo("serverHostname", 8080); The main client class to start with is a DuplexTcpClientPipelineFactory which works together with Netty Bootsrap to construct client channels.

Performance Tips


Netty Since protobuf-rpc-pro uses Netty to provide the io over TCP, optimization of Netty will help increase performance. Here is a good article giving ideas how to squeeze the most out of Netty. http://gleamynode.net/articles/2232/ JVM options -server -Xms2048m -Xmx2048m -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods Using the JVM options described increased throughput by 15% under certain conditions*. protobuf-rpc-pro configuration If you do not call a client RPC method from within the processing of a server side RPC call then configure your server side DuplexTcpServerBootstrap with a SameThreadExecutor.

SSL Guide


This guide explains how to setup keystores and certificate truststores in order to secure TCP communications between RPC client and server. The code required to secure communications is trivial and shown below for both client and server. The effort or price for the additional security is the effort and maintenance involved in managing the “trusted material” ie. keys, certificates and keystores. Client Code The client must initialize a RpcSSLContext and register this with the bootstrap prior to peering with the server.

SpringFramework


Thanks to Dieter Mayrhofer for contributing this example code. It shows one way to configure a server side implementation using spring. The code and runner is checked into the ( demo package ). The example starts a DefaultPingPongServerImpl service which is provided as standalone example. Dependency on Spring Introduce the following maven dependencies to spring. <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.0.5.RELEASE</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.0.5.RELEASE</version> <type>jar</type> <scope>compile</scope> </dependency> Server Spring Component The main spring component uses PostConstruct and PreDestroy annotations to startup and tear down the component cleanly.