ZK Configuration"
RebeccaLai (talk | contribs) m |
|||
(43 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{ZKDevelopersReferencePageHeader}} | {{ZKDevelopersReferencePageHeader}} | ||
− | 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 < | + | =Turn on Serializable UI Factory= |
+ | |||
+ | {{Notice| text=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 <code>WEB-INF/zk.xml</code>: | ||
<source lang="xml"> | <source lang="xml"> | ||
− | |||
<system-config> | <system-config> | ||
<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class> | <ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class> | ||
</system-config> | </system-config> | ||
− | |||
</source> | </source> | ||
− | + | <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. | |
+ | |||
+ | =Additional settings for various servers= | ||
+ | Please refer to the following links for detailed settings. | ||
+ | *[[ZK_Installation_Guide/Setting_up_Servers/Tomcat_Cluster|Tomcat Cluster]] | ||
+ | *[[ZK_Installation_Guide/Setting_up_Servers/WebLogic_Cluster|WebLogic Cluster]] | ||
+ | *[[ZK_Installation_Guide/Setting_up_Servers/Google_App_Engine|Google App Engine]] | ||
+ | *[[ZK_Installation_Guide/Setting_up_Servers/JBoss_Cluster|JBoss Cluster]] | ||
+ | |||
+ | =Turn on Log= | ||
+ | |||
+ | [Optional] | ||
+ | |||
+ | If an attribute or a listener is not serializable, ZK will skip it, i.e., not serialize it (similar to how a Servlet container serializes the attributes of sessions). It is sometimes hard to know what is ignored since it is common for a developer to forget to declare a value or a listener as serializable. | ||
+ | |||
+ | To detect this problem, you can turn on the logger for <code>org.zkoss.io.serializable</code> to the DEBUG level ({{versionSince| 5.0.7}}). Please read [[ZK%20Developer's%20Reference/Supporting%20Utilities/Logger | Logger]] for details. | ||
+ | <!-- logger name specified manually not from its class name --> | ||
+ | |||
+ | =Disable the Use of zscript= | ||
+ | |||
+ | [Optional] | ||
+ | {{versionSince|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 is a list of configurations that can not be used in the clustering environment. They are disabled by default. However, it is worth to double check that none are enabled accidentally. | ||
+ | |||
+ | ==Event Processing Thread== | ||
+ | Do not enable [[ZK_Developer%27s_Reference/UI_Patterns/Event_Threads| 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 is migrated when failover takes place. | ||
+ | |||
+ | The default is <javadoc>org.zkoss.zk.ui.impl.SessionDesktopCacheProvider</javadoc> instead of desktop-scoped desktop cache. Just make sure you don't configure it wrong. | ||
=Version History= | =Version History= | ||
− | + | ||
− | {| | + | {| class='wikitable' | width="100%" |
! Version !! Date !! Content | ! Version !! Date !! Content | ||
|- | |- | ||
− | | | + | | 5.0.7 |
− | | | + | | April 2011 |
− | | | + | | The log called <code>org.zkoss.io.serializable</code> was introduced. |
+ | |- | ||
+ | | 5.0.8 | ||
+ | | June 2011 | ||
+ | | The listener called <code>org.zkoss.zkplus.cluster.ClusterSessionPatch</code> was introduced. | ||
|} | |} | ||
{{ZKDevelopersReferencePageFooter}} | {{ZKDevelopersReferencePageFooter}} |
Latest revision as of 04:27, 1 February 2024
Turn on Serializable UI Factory
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
:
<system-config>
<ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class>
</system-config>
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 serialize it (similar to how a Servlet container serializes the attributes of sessions). It is sometimes hard to know what is ignored since it is common for a developer to forget to declare a value or a listener as serializable.
To detect this problem, you can turn on the logger for org.zkoss.io.serializable
to the DEBUG level (Since 5.0.7). Please read Logger for details.
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 is a list of configurations that can not be used in the clustering environment. They are disabled by default. However, it is worth to double check that none are enabled 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 is migrated when failover takes place.
The default is SessionDesktopCacheProvider instead of desktop-scoped desktop cache. Just make sure you don't configure it wrong.
Version History
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.
|