cancel
Showing results for 
Search instead for 
Did you mean: 

Problem starting Template Rendering Listener and fetching documents

Victor_Sánchez
Confirmed Champ
Confirmed Champ

Hi team,

I have detected a problem starting Nuxeo. With a 100M documents instance, the deployment is very slow, and looking for the problem, I found this source code into https://github.com/nuxeo/nuxeo/blob/master/addons/nuxeo-template-rendering/nuxeo-template-rendering-...

It runs after TemplateInitListener.java listening for aboutToCreate event.

@Override
public void run() {
   StringBuilder sb = new StringBuilder("select * from Document where ");
   sb.append(TemplateSourceDocumentAdapterImpl.TEMPLATE_FORCED_TYPES_ITEM_PROP);
   sb.append(" <> 'none'");
   DocumentModelList docs = session.query(sb.toString());
   for (DocumentModel doc : docs) {
      TemplateSourceDocument tmpl = doc.getAdapter(TemplateSourceDocument.class);
      if (tmpl != null) {
         for (String type : tmpl.getForcedTypes()) {
             if (mapping.containsKey(type)) {
              ...

This NXQL against MongoDB has a serious problem, even having indexes:

select * from Document where tmpl:forcedTypes/* <> 'none'

Regards, VS!

2 REPLIES 2

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

Performances are really related to the architecture you've set up. I encourage you to watch https://university.nuxeo.com/learn/course/external/view/elearning/201/NuxeoReferenceArchitecture to check your Nuxeo infrastructure, and in particuly:

  • Tune your MongoDB DB
  • Dedicate some workers and/or Nuxeo Stream to handle bulk rendering

Regards

Victor_Sánchez
Confirmed Champ
Confirmed Champ

Hi Gregory,

thanks for your answer, but it is not the problem. Still MongoDB is tuned, the query:

select * from Document where tmpl:forcedTypes/* <> 'none'

return all documents because it is not transformed fine by MongoDBQueryBuilder. After query execution, you can find the "bucle" for all returned docs. This is the problem. The best solution for that is change the query to:

select * from Document where tmpl:forcedTypes is not null and tmpl:forcedTypes/* <> 'none'

Regards, VS!