ZK Configuration"

From Documentation
(22 intermediate revisions by 6 users not shown)
Line 2: Line 2:
  
 
=Turn on Serializable UI Factory=
 
=Turn on Serializable UI Factory=
 +
 +
[Required]
 +
 
To use ZK in a clustering environment, you have to use the serializable UI factory. It could be done by specifying the following statement in <tt>WEB-INF/zk.xml</tt>:
 
To use ZK in a clustering environment, you have to use the serializable UI factory. It could be done by specifying the following statement in <tt>WEB-INF/zk.xml</tt>:
  
Line 14: Line 17:
 
<javadoc>org.zkoss.zk.ui.http.SerializableUiFactory</javadoc> is the UI factory that will instantiate serializable sessions such that the sessions, components, pages and desktops will be serialized when a session is about to deactivate.
 
<javadoc>org.zkoss.zk.ui.http.SerializableUiFactory</javadoc> is the UI factory that will instantiate serializable sessions such that the sessions, components, pages and desktops will be serialized when a session is about to deactivate.
  
Also notice that you cannot enable the use of the event thread<ref>The reason is that the event thread might be suspended. Unfortunately, the thread cannot be migrated from one machine to another.</ref>. It is disabled by default. For more information, please refer to the [[ZK Developer's Reference/UI Patterns/Event Threads|Event Threads]] section.
+
=Additional settings for various servers=
 
+
Please refer to the following links for detailed settings.
<blockquote>
+
*[[ZK_Installation_Guide/Setting_up_Servers/Tomcat_Cluster|Tomcat Cluster]]
----
+
*[[ZK_Installation_Guide/Setting_up_Servers/WebLogic_Cluster|WebLogic Cluster]]
<references/>
+
*[[ZK_Installation_Guide/Setting_up_Servers/Google_App_Engine|Google App Engine]]
</blockquote>
+
*[[ZK_Installation_Guide/Setting_up_Servers/JBoss_Cluster|JBoss Cluster]]
  
 
=Turn on Log=
 
=Turn on Log=
Line 32: Line 35:
 
org.zkoss.util.logging.Log.lookup("org.zkoss.io.serializable").setLevel("DEBUG");
 
org.zkoss.util.logging.Log.lookup("org.zkoss.io.serializable").setLevel("DEBUG");
 
</source>
 
</source>
 +
 +
<blockquote>
 +
----
 +
<references/>
 +
</blockquote>
 +
 +
=Disable the Use of zscript=
 +
 +
[Optional]
 +
[since 5.0.8]
 +
 +
The interpreter (BeanShell) does not work well under the clustering environment. Since the serialization is not stable, zscript cannot be used in a clustering environment.
 +
To avoid accidental or unintended use it is recommended to disable zscript in your ZK application with the following configuration (in zk.xml):
 +
 +
<source lang="xml">
 +
<system-config>
 +
<disable-zscript>true</disable-zscript>
 +
</system-config>
 +
</source>
 +
 +
=Configuration Not Allowed=
 +
Here are a list of configuration that can not be used in the clustering environment. They are disabled by default. However, it is worth to double check if any of your members enables it accidentally.
 +
 +
==Event Processing Thread==
 +
Do not enable the event processing thread. The event processing thread might be suspended, while the (suspended) thread cannot be migrated from one machine to another.
 +
 +
It is disabled by default. For more information, please refer to the [[ZK Developer's Reference/UI Patterns/Event Threads|Event Threads]] section.
 +
 +
==Global Desktop Cache==
 +
Do not use <javadoc>org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider</javadoc> (global desktop cache). The global desktop cache is stored in the servlet context, while only the data stored in sessions are migrated when failover takes place.
 +
 +
The desktop desktop cache is ''not'' used by default<ref>Rather, the default is <javadoc>org.zkoss.zk.ui.impl.SessionDesktopCacheProvider</javadoc>.</ref>. Just make sure you don't configure it wrong.
  
 
<blockquote>
 
<blockquote>
Line 46: Line 81:
 
| April 2011
 
| April 2011
 
| The log called <tt>org.zkoss.io.serializable</tt> was introduced.
 
| The log called <tt>org.zkoss.io.serializable</tt> was introduced.
 +
|-
 +
| 5.0.8
 +
| June 2011
 +
| The listener called <tt>org.zkoss.zkplus.cluster.ClusterSessionPatch</tt> was introduced.
 
|}
 
|}
  
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Revision as of 01:58, 11 August 2015


ZK Configuration


Turn on Serializable UI Factory

[Required]

To use ZK in a clustering environment, you have to use the serializable UI factory. It could be done by specifying the following statement in WEB-INF/zk.xml:

<zk>
	<system-config>
		<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class>
	</system-config>
</zk>

SerializableUiFactory is the UI factory that will instantiate serializable sessions such that the sessions, components, pages and desktops will be serialized when a session is about to deactivate.

Additional settings for various servers

Please refer to the following links for detailed settings.

Turn on Log

[Optional]

If an attribute or a listener is not serializable, ZK will skip it, i.e., not to serialize it (similar to how a Servlet container serializes the attributes of sessions). It is sometimes hard to know what are ignored, since it is common for a developer to forget to declare a value or a listener as serializable.

To detect this problem, you could turn on the logger for org.zkoss.io.serializable to the DEBUG level[1]. The logger is the standard logger. You could consult the configuration of the Web server you use. Or, you could run the following statement when your application starts[2].

org.zkoss.util.logging.Log.lookup("org.zkoss.io.serializable").setLevel("DEBUG");

  1. Available in 5.0.7
  2. It can be done by use of theWebAppInit listener. For more information, please refer to the Customization section.

Disable the Use of zscript

[Optional]
[since 5.0.8]

The interpreter (BeanShell) does not work well under the clustering environment. Since the serialization is not stable, zscript cannot be used in a clustering environment. To avoid accidental or unintended use it is recommended to disable zscript in your ZK application with the following configuration (in zk.xml):

<system-config>
	<disable-zscript>true</disable-zscript>
</system-config>

Configuration Not Allowed

Here are a list of configuration that can not be used in the clustering environment. They are disabled by default. However, it is worth to double check if any of your members enables it accidentally.

Event Processing Thread

Do not enable the event processing thread. The event processing thread might be suspended, while the (suspended) thread cannot be migrated from one machine to another.

It is disabled by default. For more information, please refer to the Event Threads section.

Global Desktop Cache

Do not use GlobalDesktopCacheProvider (global desktop cache). The global desktop cache is stored in the servlet context, while only the data stored in sessions are migrated when failover takes place.

The desktop desktop cache is not used by default[1]. Just make sure you don't configure it wrong.


  1. Rather, the default is SessionDesktopCacheProvider.

Version History

Last Update : 2015/08/11


Version Date Content
5.0.7 April 2011 The log called org.zkoss.io.serializable was introduced.
5.0.8 June 2011 The listener called org.zkoss.zkplus.cluster.ClusterSessionPatch was introduced.



Last Update : 2015/08/11

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