| 1 |
[This doc is probably outdated. It will be updated and moved to the Nuxeo Book |
|---|
| 2 |
someday.] |
|---|
| 3 |
|
|---|
| 4 |
1. How to enable cache in Nuxeo 5 |
|---|
| 5 |
- as a latest easy way to deploy nuxeo with cache enabled is |
|---|
| 6 |
to execute task 'deploy-with-cache' in Nuxeo/build.xml |
|---|
| 7 |
|
|---|
| 8 |
2. Differences from normal deployment |
|---|
| 9 |
2.1. Added/changed files |
|---|
| 10 |
[] Files needed to setup the JBossCache as a jboss MBean service |
|---|
| 11 |
; being copied by NXJBossCache/build.xml |
|---|
| 12 |
- replSync-service.xml -> into [jboss server]/deploy/nuxeo.ear/ |
|---|
| 13 |
- jgroups.jar -> into [jboss server]/lib |
|---|
| 14 |
- jboss-cache-jdk50.jar -> into [jboss server]/lib ; this might be already in jboss 4.0.5 |
|---|
| 15 |
|
|---|
| 16 |
[] Interceptors setup. The jboss-specific setup for ejb client side interceptors |
|---|
| 17 |
is in [jboss server]/deploy/ejb3-interceptors-aop.xml file. Our interceptor is |
|---|
| 18 |
being added to this file through xsl transformation task in NXClientCache/build.xml |
|---|
| 19 |
|
|---|
| 20 |
2.2. Nuxeo ear |
|---|
| 21 |
The nuxeo.ear will include a different JNDILocations.properties that contains |
|---|
| 22 |
> DocumentManager=NXServerCache/CacheableDocumentManagerBean/remote |
|---|
| 23 |
so the cache enabled proxy of the DocumentManager ejb will be used by client |
|---|
| 24 |
code in Nuxeo |
|---|
| 25 |
|
|---|
| 26 |
2.3. NXServerCache ear |
|---|
| 27 |
Unless the cache is enabled this file is not required to be deployed. Thought |
|---|
| 28 |
it shouldn't affect the behaviour of a non-enabled application |
|---|
| 29 |
|
|---|
| 30 |
3. How cache affects the application at runtime |
|---|
| 31 |
3.1. Process description: |
|---|
| 32 |
- document objects [DocumentModel instances] are being retrieved from the |
|---|
| 33 |
server and stored in a client cache. The subsequent calls that require |
|---|
| 34 |
availability of the same document will check first in the local (client) |
|---|
| 35 |
cache and get it from there. |
|---|
| 36 |
That unless the document has been deleted from repository (in this cache it |
|---|
| 37 |
should be removed from the cache in the same transaction). |
|---|
| 38 |
|
|---|
| 39 |
3.2. Differences in application behaviour: |
|---|
| 40 |
3.2.1. Automatic user sessions updates |
|---|
| 41 |
There are a couple of constructs kept on user (Seam) session contexts. |
|---|
| 42 |
Some lists that keep references to documents cannot be dinamically updated |
|---|
| 43 |
(that is without reloading them from the server) without cache notifications |
|---|
| 44 |
|
|---|
| 45 |
Use Case: |
|---|
| 46 |
To check this, open 2 user sessions (on 2 browser instances - not just windows) |
|---|
| 47 |
and load the same content view of document folder which contains children docs. |
|---|
| 48 |
Remove a doc from one side and click the [Content] tab again from the |
|---|
| 49 |
other window. The list should have been updated. |
|---|
| 50 |
If the cache hasn't been enabled the second list wouldn't have been updated |
|---|
| 51 |
unless the user clicks on the tree or breadcrumb item. |
|---|
| 52 |
|
|---|
| 53 |
3.2.2. Document objects update (short term benefit - should be fixed) |
|---|
| 54 |
ex: change the document metadata |
|---|
| 55 |
- without cache the last change date remains the same |
|---|
| 56 |
- with cache the date is updated |
|---|
| 57 |
|
|---|
| 58 |
3.3. Application response times |
|---|
| 59 |
This issue is subjective to deployment environment. |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
4. Developer userguide |
|---|
| 63 |
|
|---|
| 64 |
Features like notifications can be used in client code to update specific |
|---|
| 65 |
structures like trees or tables. |
|---|
| 66 |
Though the cache notifier (in the Nuxeo proj) can automatically update |
|---|
| 67 |
common structures (like List<DocumentModel>) found on the session context (Seam), |
|---|
| 68 |
for special constructs the developer have to register a CacheListener and |
|---|
| 69 |
perform specific operations (delete,update etc) when an event is received. |
|---|
| 70 |
|
|---|
| 71 |
This is the case for [DocModelTableModel] actual implementation and for the |
|---|
| 72 |
[TreeManagerBean]. |
|---|
| 73 |
|
|---|
| 74 |
5. Issues |
|---|
| 75 |
On Linux if you have ipv6 - then you need to specify jvm params at startup |
|---|
| 76 |
to use only ipv4 otherwise jgroup (needed by jbosscache) won't work. |
|---|
| 77 |
|
|---|
| 78 |
=> JVM option to add: -Djava.net.preferIPv4Stack=true |
|---|
| 79 |
|
|---|
| 80 |
Wiki page about an IPV6 problem with jgroups on Linux. |
|---|
| 81 |
http://wiki.jboss.org/wiki/Wiki.jsp?page=IPv6 |
|---|