0

Exteremely slow response

asked 2017-09-03 16:34:47 +0800

dagarwal gravatar image dagarwal
101

Hello Team,

I am evaluating ZK for our next project. I invested lot of time for other framework like Vaadin. I am pleased with the zk's capability of autowiring and the development pace it provides. But, I am seeing some serious performance issue with simple ViewModel bindings:

ComponentVM.java

package com.rs.studio.vm;

import java.util.Map;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.Clients;

public class ComponentVM {

private String name;

@Init
public void init() {
    String selectedComp = Executions.getCurrent().getParameter("selectedComponent");

        this.name = selectedComp;

}

@Command
@NotifyChange("Save")
public void Save() throws Exception {
    System.out.println("Save something");
}

public String getName() {
    return this.name;
}

public void setName(String name) {
    this.name = name;
}

}

test.zul

<zk>
<include id="contentInclude" ></include>
<button id="New"
        onClick='contentInclude.setSrc("/component/component.zul")' visible="true">
    </button>
</zk>

component.zul

<zk>

<div apply="org.zkoss.bind.BindComposer"
    viewModel="@id('vm') @init('com.rs.studio.vm.ComponentVM') @load(vm.name) @save(vm.name, before='submit')">

    <grid>

        <columns>

            <column></column>
            <column></column>

        </columns>
        <rows>

            <row>
                <label value="Component Name"></label>
                <textbox value="@bind(vm.name)"></textbox>

            </row>

            <row>
                <cell colspan="3" style="text-align:center">
                    <vlayout>
                        <button label="Save"
                            onClick="@command('Save')" width="100px" height="30px" >
                                <attribute name="onClick">
                                    //contentInclude.setSrc("/component/component_list.zul");
                                </attribute>
                            </button>
                    </vlayout>
                </cell>
            </row>
        </rows>
    </grid>


</div>

</zk>

After clicking on button I see Processing for like 10 seconds. I am running this on a 8 Core processor with 16 GB RAM and 250 GB SSD. It's a solid machine and just running zkoss in tomcat. Before implementing MVVVM I used MVM and performance was decent.

Following screenshot shows the debug output of ZK. I could not upload it here because it requires 100 Karma. ibb dot co / hu4W1v

Thanks, looking for your inputs.

delete flag offensive retag edit

Comments

In your attribute viewmodel, don't put the load and save for a property. You must do that in your textbox self

chillworld ( 2017-09-03 20:49:10 +0800 )edit

you now have enough karma to upload your screenshot

hawk ( 2017-09-04 08:17:35 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-09-04 09:51:02 +0800

hawk gravatar image hawk
2008 1 5
http://hawkphoenix.blogsp... ZK Team

I can't reproduce your issue no matter I click "New" or "Save" button. Since the command method and event listener are quite simple. It might be caused by an abnormal factor.

you can open chrome developer tool to check the timing to know why it spends 10 seconds. But if you can zk "Processing" message, that usually means zk client is waiting for a server response. So there is probably something at the server-side blocking the event execution.

You can read this doc to know how to debug a performance issue with dev tool.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2017-09-03 16:34:47 +0800

Seen: 14 times

Last updated: Sep 04