Just a word of warning for plugin developers moving to 4.x. The Java APIs in 4.x are highly cache dependent. This is great for server performance in the long term. However in the immediate context of a critical business process, it is problematic.
This cache dependence makes deterministic business logic algorithms nearly impossible.
For example, if I create a new “Apple” object and save it, I expect to be able to load that “Apple” object, modify it (maybe taking a bite out of it), and save it again. Unfortunately when you go to load your newly saved “Apple”, you get a null pointer exception or some other “not found” error thrown. This is because in 4.x all the APIs hit the cache, and the cache update is so slow that your code is trying to load it before the cache is updated.
The most recent example of this we encountered is using the userAPI to create a new user. A little later in the code we try to load the newly created user via the userAPI and get a null pointer exception, even though if we look in the database, the new user has in fact been created!
This issue can bite you for anything that is cached. We’ve seen it in content, relationships, and users to name a few. Content does have an isIndexed check, but it only applies to the contentlet itself, not anything related to it, i.e. relationships, permissions etc. So even that check is not reliable in the holistic sense of “Is this thing entirely cached?”
This asynchronous “eventually available” philosophy for cache is unreliable for deterministic business processes. Hack-ish solutions include adding a Java sleep to delay your program in the hopes that the cache will catch up by the time you try to load your data, or risking an infinite loop of “is it here yet?” checks. Obviously neither is ideal.
It would be nice if there was a “no-cache” API option available so we could reliably load newly created records during critical business logic blocks. Data accuracy and immediate accessibility is of utmost importance in these cases. I can afford to take a slight performance hit to check the DB. And honestly it would probably be less of a performance hit than waiting for the cache to update.
We did not have these issues in 3.x.
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/c637e1364965480080ea2f147ef92847%40exch13b.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.
APILocator.getUserAPI().loadUserById(userId)
No, I am getting it via the APILocator higher up in the code.
I’ll continue with this on the support ticket.
However, like I said, typically this goes away by adding a java sleep for enough milliseconds…
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
--
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to
dot...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/c637e1364965480080ea2f147ef92847%40exch13b.ms.gettysburg.edu.
For more options, visit
https://groups.google.com/d/optout.
--
--
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAPL0VyGGDVbXoBp8OOyYV__f9O-Qc_dRBBATdUaUmD%2BXH5e2og%40mail.gmail.com.
I’ve been dealing with and researching this issue for several weeks now on two different 4.1.1 instances we have. I am very sure it’s a cache delay issue.
This does look promising: REINDEX_ON_SAVE_IN_SEPARATE_THREAD=false
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/e889adbfb07047de80634b693ef26a93%40exch13b.ms.gettysburg.edu.
--
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/c637e1364965480080ea2f147ef92847%40exch13b.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.
--
--
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAPL0VyGGDVbXoBp8OOyYV__f9O-Qc_dRBBATdUaUmD%2BXH5e2og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/e889adbfb07047de80634b693ef26a93%40exch13b.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/5f4dcd1ae1db45c9ab378ec7189d7b7a%40exch13b.ms.gettysburg.edu.
Ok, I added a snippet to the ticket. The fact remains that this code worked 100% in 3.5.1, so it seems to point to an issue with 4.1.1. The delta is there.
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
From: dot...@googlegroups.com [mailto:dot...@googlegroups.com]
On Behalf Of Will Ezell
Sent: Thursday, January 04, 2018 1:28 PM
To: dot...@googlegroups.com
Subject: Re: [dotcms] [4.1.1] 4.x Cache headaches.
Please give us a code snippet so we can try to reproduce and write a unit test against. If it is a code issue, we will get it fixed.
On Thu, Jan 4, 2018 at 12:51 PM, Nathan Keiter <nke...@gettysburg.edu> wrote:
I’ve been dealing with and researching this issue for several weeks now on two different 4.1.1 instances we have. I am very sure it’s a cache delay issue.
This does look promising: REINDEX_ON_SAVE_IN_SEPARATE_THREAD=false
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box
2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone:
717.337.6993
From:
dot...@googlegroups.com [mailto:dot...@googlegroups.com]
On Behalf Of Nathan Keiter
Sent: Thursday, January 04, 2018 12:30 PM
To: dot...@googlegroups.com
Subject: RE: [dotcms] [4.1.1] 4.x Cache headaches.
No, I am getting it via the APILocator higher up in the code.
I’ll continue with this on the support ticket.
However, like I said, typically this goes away by adding a java sleep for enough milliseconds…
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box
2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone:
717.337.6993
--
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to
dot...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/c637e1364965480080ea2f147ef92847%40exch13b.ms.gettysburg.edu.
For more options, visit
https://groups.google.com/d/optout.
--
--
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to
dot...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/CAPL0VyGGDVbXoBp8OOyYV__f9O-Qc_dRBBATdUaUmD%2BXH5e2og%40mail.gmail.com.
For more options, visit
https://groups.google.com/d/optout.
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to
dot...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/e889adbfb07047de80634b693ef26a93%40exch13b.ms.gettysburg.edu.
For more options, visit
https://groups.google.com/d/optout.
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to
dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/5f4dcd1ae1db45c9ab378ec7189d7b7a%40exch13b.ms.gettysburg.edu.
For more options, visit
https://groups.google.com/d/optout.
--
--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAPL0VyFVpP%2BFfHvKKOGCv3C%2Br45xaBrUPu8bhKscUovvr_xZ%2BA%40mail.gmail.com.