From Documentation

Jump to: navigation, search

  • Author
    James Chu, Engineer, Potix Corporation
  • Date
    September 2015
  • Version
    ZK 8.0



For the upcoming ZK 8, we have done a lot of performance tuning on both server side and client side. To determine the difference in performance between ZK 7 and ZK 8, we have arranged a test, using MVVM and children binding to generate 30 * 30 <div>s and <label>s. Moreover, we used the new feature - Shadow element in ZK 8 to generate the same components. As for the testing tools, we used JMeter to record the average response time, and VisualVM to record the memory consumption of each test case.

Test Environment

Listed in the following are the test's hardware spec, required software, and corresponding parameters.

  • Hardware
    • CPU: 2.9 GHz Intel Core i5
    • Memory: 16.00 GB
  • Software
    • ZK 7.0.6 CE
    • ZK 8.0.0 CE FL (20150914)
    • ZK 8.0.0 EE FL (20150914)
    • Jetty -7.6.8.v20121106
    • JDK
    • Apache JMeter 2.12
    • Visual VM 1.3.8
  • Configurations
    • Jetty
      • -Xms8096m
      • -Xmx8096m
    • JMeter
      • 100, 200, 400, 600, 800, 1000, 1200, 1500 concurrent threads in 1 second

Test Plan

There are two test cases in this performance test. First, we used children binding and MVVM to generate 30 * 30 <div>s and <label>s, and switch three versions: ZK 7.0.6 EE, ZK 8.0.0 CE, and ZK 8.0.0 EE. Second, we used the Shadow element to generate the same amount of components. Testing is done by simulating the situation of 100 to 1500 concurrent users accessing the page.

Test Case

The whole performance testing project for this article can be found on github.


    <div id="bind" apply="org.zkoss.bind.BindComposer"
         viewModel="@id('vm') @init('org.zkoss.ForEachVM')">
        <div id="host" style="display:none">
            <div children="@load(vm.array)">
                <template name="children">
                    <div children="@load(vm.array)">
                        <template name="children">
                            Test Label

public class ForEachVM {
	private static List<Integer> array = Collections.nCopies(30, 30);
	public void setArray(List<Integer> array) {}
	public List<Integer> getArray() {
		return array;


    <div id="bind" apply="org.zkoss.bind.BindComposer"
         viewModel="@id('vm') @init('org.zkoss.ForEachVM')">
        <div id="host" style="display:none">
           <forEach items="@load(vm.array)">
               <forEach items="@load(vm.array)">
                   Test Label1

Test Result

Memory Consumption

ZK8 performance test memory consumption.png

Response Time

ZK8 performance test response time.png


ZK 8 has both memory and response improvements; it is faster and lighter than ZK 7. If using ZK 8's new feature - Shadow Elements- the memory consumption is approximately one-third lighter than ZK 7 for 100 to 1500 concurrent users. In regard to the response time, ZK 8 is approximately 6 to 12 times faster than the old version. We hope you will like the speed enhancement of ZK 8!

Performance enhancement list

Enhancement in ALL editions

1. More efficient rendering on children binding.

2. Use a direct method invoking instead of java reflection for component to apply properties.

3. Use a lazy initialization of Java Object creation to reduce the memory footprint.

4. Use StringBuilder instead of StringBuffer for component rendering.

5. Use new string escape implementation.

6. Use java.util.concurrent framework instead of synchronised keyword.

MVVM enhancement in EE edition

1. Use a merge algorithm to reduce the MVVM tracking nodes.

2. Speed up Bind EL expression resolving.

Shadow Element enhancement

1. More lightweight and more efficient to support a collection data binding.

2. Auto-release the memory once it doesn't contain dynamical data attributes.


Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.
You got stuck here?
Let us know how we can improve this page
For specific questions please use the forum