0

ZK+Spring performance

asked 2010-06-24 15:42:35 +0800

bsvSoft gravatar image bsvSoft
48 1

Hi All!
I'm using ZK+Spring in my project.
Can anybody tell me which approach is better in performance impact:
1. Using ZK controllers as Spring beans(using org.zkoss.zkplus.spring.DelegatingVariableResolver) with autowired DAOs or
2. Using ZK controllers(extended GenericForwardComposer)+SpringUtil.getBean to load spring beans only when necessary?

Should be p.1 ZK controllers declared as spring session scoped beans if p.1 approach is better?
Thanks

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2010-06-25 03:26:05 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-06-25 03:27:01 +0800

Hi bsvSoft,

there is point 3. missing.


We have realized a performance boost by using ZK controllers as Spring beans (extend GenericForwardComposer; zul's using DelegatingVariableResolver ) with autowired DAOs.

to point 2.: with SpringUtil.getBean(): This is not Spring-managed. Do you see the difference.


best
Stephan

link publish delete flag offensive edit

answered 2010-06-25 03:45:45 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi bsvSoft,
I second Stephan here. Approach 1 should be more elegant and efficient.

>>Should be p.1 ZK controllers declared as spring session scoped beans if p.1 approach is better?
Not too sure what you mean by above statement but wouldn't recommend controllers in session scope unless you make sure they do not hold any state

link publish delete flag offensive edit

answered 2010-06-25 07:11:51 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Yes, we too.

For the controllers we have a spring 'scope=prototype'.

	<bean id="customerListCtrl" class="de.forsthaus.webui.customer.CustomerListCtrl"
		parent="basisListCtrl" scope="prototype">
		<property name="customerService" ref="customerService" />
		<property name="tenantService" ref="tenantService" />
	</bean>

link publish delete flag offensive edit

answered 2010-06-25 08:41:04 +0800

bsvSoft gravatar image bsvSoft
48 1

Hi all,
Thanks for your answers. I understand that SpringUtil.getBean approach is not Spring managed. But can it be faster than zk controllers as spring beans? If bean scope is prototype, then it means, that every time new bean instance will be created, won't it? And every event handler in controller will cause creating new zk controller instance with injecting all necessary dependencies. Am I right?
If so, I think, that it's better to keep zk controllers out of spring context, and get spring bean instances only when necessary using SpringUtil.getBean method. BTW, I checked OpenEntityManagerInView pattern and it works even if zk controller is out from spring context. So, there are no constraints to use SpringUtil.getBean.
Thanks

link publish delete flag offensive edit

answered 2010-06-26 03:58:17 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-06-26 04:04:22 +0800

Seems Spring pre allocate the beans by startUp from the configurationContext file, so it would be faster created.
Our approach is the security and scalability. In a multi user business app use must be sure that no users data are attached from an other user so we load the bean with scope=prototype.
We have spend many hours in debugging Spring and Multi-Threaded Zk app. So our commendation is by using spring and zk let Spring manage all.

Stephan

link publish delete flag offensive edit

answered 2010-06-27 19:35:47 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi bsvsoft,
>>And every event handler in controller will cause creating new zk controller instance with injecting all necessary dependencies.
I believe this is not true. Can you clarify more about this if you have seen this behavior and/or any sample code that exibits this?

link publish delete flag offensive edit

answered 2010-07-13 06:40:22 +0800

drajasuman gravatar image drajasuman
342 1

Hi, Iam new to ZK.. I need an example or some design - for the option 1 - How to use ZK COntrollers as Spring beans...Small example...Dont need entire thing..

For example: My view has a TextBox - username and a btn .
Controller -- Iam intrested in this Part --- when user clicks on btn what happens....
MOdel --> Iam having a Spring IOC + HIbernate..

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2010-06-24 15:42:35 +0800

Seen: 1,165 times

Last updated: Jul 13 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More