In most cases, a benchmark written
using the Faban
driver framework will want to simulate user load to one or more
servers. Various mechanisms and protocols exist for such
communications. But since a single Faban agent typically simulates
multiple users, great care has to be given to the communications layers
to ensure that each simulated user actually uses their own separate
resources such as socket connections.
Many of the client-side communications
libraries do
an excellent job at pooling resources. This greatly benefits the
performance and address space size of the client program. However, such
optimizations usually render the libraries unsuitable for user
simulation work, just because of the sharing that happens will not
accurately simulate the number of users specified.
The Faban driver framework provides transports for http/https which provide simplified APIs for web access. There are two implementations of transports based on two client libraries:
HttpTransport.newInstance();To just use the auto timers and prevent connection sharing, you can also just load the transport implementation as follows:
static {
Class.forName("com.sun.faban.driver.transport.sunhttp.SunHttpTransport");
}
HttpTransport.setProvider("com.sun.faban.driver.transport.hc3.ApacheHC3Transport");To just use the auto timers and prevent connection sharing, you can also just load the transport implementation as follows:
HttpTransport.newInstance();
static {
Class.forName("com.sun.faban.driver.transport.hc3.ApacheHC3Transport");
}
The Faban transports have been
implemented in a way to
eliminate or minimize resource sharing between simulated
users. A
very important feature is also the support for automatic
timing.
Beyond that, the provided transports also include a host of convenience
methods to make communication with the server very easy to implement.
The Faban driver framework still
allows for
communication protocols not
supported by Faban transports but provided by other client libraries.
But the developer or user will need to either ensure that resource
pooling between threads does not happen or accept the inaccuracy of the
simulation. If the target library allows for setting the socket
factory, automatic timing may still work by setting the socket factory
to TimedSocketFactory.
The method to call is commonly named "setSocketFactory." Otherwise, the
only option would be to use manual timing.
Please see Recording Time
for more information about timing.