Java Reference
In-Depth Information
This kind of test is not a macrobenchmark either: there is no security (e.g., the user does not
log in to the application), no session management, and no use of a host of other Java EE fea-
tures. Because it is only a subset of an actual application, it falls somewhere in the
middle—it is a mesobenchmark. Mesobenchmarks are not limited to the Java EE arena: it is
a term I use for benchmarks that do some real work, but are not full-fledged applications.
Mesobenchmarks have fewer pitfalls than microbenchmarks and are easier to work with than
macrobenchmarks. It is unlikely that mesobenchmarks will contain a large amount of dead
code that can be optimized away by the compiler (unless that dead code actually exists in the
application, in which case optimizing it away is a good thing). Mesobenchmarks are more
easily threaded: they are still more likely to encounter more synchronization bottlenecks than
the code will encounter when run in a full application, but those bottlenecks are something
the real application will eventually encounter on larger hardware systems under larger load.
Still, mesobenchmarks are not perfect. A developer who uses a benchmark like this to com-
pare the performance of two application servers may be easily led astray. Consider the hypo-
thetical response times of two application servers shown in Table 2-1 .
Table 2-1. Hypothetical response times for two application servers
App server 1 App server 2
Simple JSP
19 ms
50 ms
JSP with session 75 ms
50 ms
The developer who uses only a simple JSP to compare the performance of the two servers
might not realize that server 2 is automatically creating a session for each request. She may
then conclude that server 1 will give her the fastest performance. Yet if her application al-
ways creates a session (which is typical), she will have made the incorrect choice, since it
takes server 1 much longer to create a session. (Whether the performance of subsequent calls
differs is yet another matter to consider, but it is impossible to predict from this data which
server will do better once the session is created.)
Even so, mesobenchmarks offer a reasonable alternative to testing a full-scale application;
their performance characteristics are much more closely aligned to an actual application than
are the performance characteristics of microbenchmarks. And there is of course a continuum
here. A later section in this chapter presents the outline of a common application used for
many of the examples in subsequent chapters. That application has an EE mode, but that
Search WWH ::

Custom Search