Enabling Session Clustering on Live Cluster

Follow

Applies To:

Zend Server Cluster with Session Clustering

Summary

When enabling Zend Session Clustering, you might start getting errors in Zend logs and users will be kicked out of the log-in system.

This is a sample sc.log:

[Mod Cluster 11.11.2014 02:54:31 NOTICE] 00263: [ mod_cluster.cpp : 623 ( ps_read_cluster ) ] failed to read session 6k0odt6jo4f2djk409jl0a3bb29hdhg5
[Mod Cluster 11.11.2014 03:00:02 WARNING] 00160: [ mod_cluster.cpp : 1394 ( getSession ) ] Failed to get session. Reaso…

Technical

Zend Session Clustering uses a different session ID than regular PHP sessions, although the flow / code integration is transparent to PHP and users.

Because of this modified session ID (PHPSESSID cookie by default), all sessions which are still tracked on client side and requested again, will be dropped as invalid, and new sessions with SC ID format would be created instead (so basically, session data is lost, users are logged out if the session has no DB backend etc.).

Session Clustering should be enabled on Zend Server installation when no users are affected, or more clearly, enabled while a server / cluster is out of load balancer and before getting live HTTP requests.

Taking a server / cluster off service to enable Session Clustering also means that expired sessions are anyway being refreshed so less users are affected.

About Zend Server Session ID format, it is as following:

Master_Server-TCP_Port-Backup_Server-TCP_Port-Version-HASH

You might recognize the HASH as unique ID from the standard PHP session IDs.

Conclusion

The real deal here is to identify if there are a few users being kicked out with old session ID (PHP files handler and former session handlers other than PHP and Zend SC), or any use of session is not working (new sessions, without any previous cookies in the browser do not get stored).
If indeed there is a global problem with enabling Zend Session Clustering, you should revert the change (i.e. return session handler to former value, normally "files"), restart all Web Servers and open a support ticket to examine the logs and understand what went wrong so Session Clustering can be re-enabled without breaking the PHP applications.

Reference

 

Have more questions? Submit a request

Comments

Powered by Zendesk