Showing posts with label Performance. Show all posts
Showing posts with label Performance. Show all posts

Wednesday, March 04, 2009

JMeter


Apache JMeter is a GUI that allows to compose a performance test without writing a single line of code! Basically what needs to do, in order to implement a performance test, is to properly insert test components such as "thread group, "loop control", "http requests" and "performance data graph", into the test plan. Of course the parameters of these test components should be specified, for instance, how many iterations of the http request are wanted. Then simply start it and a curve as well as data is presented!

With the help of JMeter, I am able to tell in a very simple test, when 27 urlrewrite rules are enabled, the OMII-UK website has a throughput of 3030.915 per minute, i.e., 19.796 ms per request; when rules disable, the throughput is 3005.259 per minute, i.e., 19.965 ms per request. In other words, in this setting, where urlrewrite 2.6 is used, urlrewrite rules pose a 0.9% slowdown. Though the credibility of this particular test result needs to be established.

Monday, November 03, 2008

Hibernate Performance

(This is one of my old Google Notes.)

I have used YourKit to benchmark the performance of Hibernate some time ago.

In my database, I have two tables: Project and Release. Project is associated with release in a one-to-many relationship. In my setting, a SQL statement using JDBC costs from several milliseconds to ~30 milliseconds; serving a JSP costs from 1 second to 3 seconds in the first run, then from tens of milliseconds to ~250 milliseconds in the later run.

In Hibernate,
  • Getting a single project (as well as its releases) costs 234ms in the first run, and 14ms in average (excluding the first run);
  • Getting all projects costs 547ms in the first run, and 96ms in average;
  • Getting some partial information of all projects, costs 282ms in the first run, and 15ms in average.
The reason for that the first run is much slower, is because Hibernate does bytecode instrumentation to generate proxy object on the first touch of ORM, which is quite expensive. However, the late runs approximate JDBC's performance.

Some Hibernate tips:
  • Chapter 19 of the Hibernate reference describes how to improve its performance.
  • Use set instead of list. List uses the id as index, thus creates a large data structure with lots of empty cells.
  • Associated objects are initialized in a lazy way. They need to be touched to bring into memory.