This is the last article in this series I will explore some extra RPC is the server that will serve us to implement an application server, but without losing generality. We will also have to perform a performance test, seeing the througput (requests per second) that has the server.
Extras
Services on the server side takes initialization parameters. This will allow us to pass data to configure the service. These parameters are accessed through getParameters method () of the Service class, which returns a map with the setup.
Validation Service
Before adding a service to the server, perform the following checks:
That the implementation of the service must have a parameterless constructor
That the service implementation must implement the service interface
Do not overload methods in the service
That the return type of method parameters are serializable
These checks help to avoid common mistakes.
Authorized to execute
Before you actually run a service method is invoked an interceptor: onPreExecution. If successful, then passed to invoke the service, if not exceptionally NotExecutedException out. This is going to be used to implement, for example, security mechanisms and auditing (logging).
Performance
With the performance test we check to see if the design is scalable as we wanted. The test was performed on a notebook that has an Intel model T9500 (C2D 2.6GHz, 6MB cache Penryn core) with 2GB of RAM on 32-bit Ubuntu 9.04 and java6. The results were:
Case Client processes Client threads Orders by thread Total orders Time (secs) Requests / second 1
5
30
2500
375000
207
1811.59
2
10
30
2500
750000
229
3275.11
While not a rigorous stress test, gives a good approximation of the performance and scalability of the service: by doubling the number of orders, but time goes by 10.6%. Also, there is a value that can be adjusted in the creation of the server that is the pool size of the layer Workers Order that orders shipped to the Service layer. The default size is 10, but if you're facing a multi CPU configuration can increase this value to obtain better performance. For the performance tests we used a pool of 10 Workers.
An application server based on an older version of the RPC mechanism is in place for several years one of the largest banks in Uruguay.
In the next article we will start with the introduction to the application server and what are the main components.
Stay tuned!
