Clustering compatibility best practices

Hi everyone,

I propose to add a new section in https://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices#HBack-endDevelopmentPractices for Clustering compatibility development.
I noticed while fixing some bugs for having Like working in a cluster environment, that there’s some best practices to know for having a module or an extension works with Clustering (XWiki.org).

So I propose to add in this new section those 2 rules:

  • ensure to have the events that needs to be used in cluster environment implements Serializable
  • ensure to have the cache invalidation mechanism relies on listener of Events that are serializable to perform their invalidation

I propose to add them because it’s not obvious to implement Serializable for an event, and I noticed again the issue on Discussion extension. I’m sure that’s something we want to check more systematically.

Note that AFAIK we don’t want to modify the Event interface to add Serializable, since I’m not sure we want all the events to be propagated to cluster.

WDYT?

So yes the best would be to fix the issue at the design level so that it cannot happen.

Barring that, I’m fine to add the best practice in the doc. But with some examples to show how it’s done (that would make it more clear).

Thanks for raising this.

Yes it’s certain we don’t want to share all events, that would be way too expensive and most of the events don’t make any sense for another instance.