Faster And Lighter, The Performance Test On ZK8"

From Documentation
Line 126: Line 126:
 
1. More lightweight and more efficient to support a collection data binding.
 
1. More lightweight and more efficient to support a collection data binding.
  
2. Auto-release the memory once it doesn't contain a dynamical data attributes.
+
2. Auto-release the memory once it doesn't contain dynamical data attributes.
  
 
{{Template:CommentedSmalltalk_Footer_new|
 
{{Template:CommentedSmalltalk_Footer_new|

Revision as of 07:35, 21 September 2015

DocumentationSmall Talks2015SeptemberFaster And Lighter, The Performance Test On ZK8
Faster And Lighter, The Performance Test On ZK8

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

Introduction

In the upcoming ZK 8, we have done a lot of performance tuning on both server side and client side. To determine the difference of 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. About 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

The following paragraph includes this 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 1.7.0.80
    • 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.

children-binding.zul:

<zk>
    <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
                        </template>
                    </div>
                </template>
            </div>
        </div>
    </div>
</zk>

ForEachVM.java:

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

forEach.zul

<zk>
    <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)">
           <div>
               <forEach items="@load(vm.array)">
                   Test Label1
               </forEach>
           </div>
           </forEach>
        </div>
    </div>
</zk>

Test Result

Memory Consumption

ZK8 performance test memory consumption.png

Response Time

ZK8 performance test response time.png

Summary

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!

Enhancement Notes

Enhancement in ALL editions

1. Re-implement children binding mechanism.

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.


Comments



Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.