4 Replies Latest reply on Dec 1, 2015 6:38 PM by Carl Von Stetten

    Slow request processing after upgrade to Java 1.7 on CF9  / calling UDF

    brookd Level 1

      We're running CF9 and recently upgrade to Java 1.7 from 1.6, all of a sudden we're seeing something very strange.  We're returning query results and for each row we're converting it to a struct (to return an array of structs) using a UDF method (the UDF library is loaded in the application scope), queryRowToStruct().  Each call to this method is taking 1000 ms. Previously it was taking 15-30 ms.

       

      The weird thing is, that restarting the CF service brings it back down to 15-30 ms (which we discovered after rolling back to Java 1.6 which also reduced time down to 15+ ms, and then back to 1.7 and it was still at 15-30 ms).  The UDF is pretty simple (it is included below), but the array and string functions appear to be running super slow. What could cause this??

       

      The UDF code:

      function queryRowToStruct(query,row,cols,padyesno){
      
      
              //a var for looping
              var ii = 1;
              //the struct to return
              var stReturn = structnew();
      
              if (arraylen(arguments) lt 3 or not isdefined('cols')){
                  cols = listToArray(query.columnList.toLowerCase());
              }
              if (arraylen(arguments) lt 4 or not isdefined('padyesno')){
                  padyesno=false;
              }
      
              if (row EQ ''){row = 1;}
      
              //if there is a second argument, use that for the row number
              if(arrayLen(arguments) GT 1)
                  row = arguments[2];
              //loop over the cols and build the struct from the query row
              for(ii = 1; ii lte arraylen(cols); ii = ii + 1){
                  if (padyesno){
                   if (not isNumeric(query[cols[ii]][row]) and (query[cols[ii]][row] is 'yes' or query[cols[ii]][row] is 'no')){
                       stReturn[lcase(cols[ii])] = query[cols[ii]][row] & application.gs.jsonEscapeChar;
                         }else{
                       stReturn[lcase(cols[ii])] = query[cols[ii]][row];
                   };
                  }else{
                   stReturn[lcase(cols[ii])] = query[cols[ii]][row];
                  };
              }
              //return the struct
              return stReturn;
          }
      
      

       

       

      The requests are timing out and its always at this chunk of code that is taking forever:

      23-11-2015 10-49-52 AM.png