Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Excessive CPU usage caused by com.isomorphic.io.file.ISCClassPathFile

    ​Hi Smartgwt team,

    During performance measurements of our application we noticed that Smartgwt (Version 13.0-p20220625) needs by far the most CPU time in the com.isomorphic.io.file.ISCClassPathFile area when accessing the server.

    Click image for larger version

Name:	Bildschirmfoto 2022-07-01 um 11.03.27.png
Views:	81
Size:	136.6 KB
ID:	268265

    On closer analysis, I noticed that a class com.isomorphic.store.DataStructCache.XMLOrJSFile(java.lang.String) is called here, which implements a simple cache.
    After activating the appropriate log level, I saw that a lot of the following output is logged on each cache access - every time!

    Click image for larger version  Name:	2.png Views:	0 Size:	372.6 KB ID:	268263
    When analyzing the code line in the profiler / Intellij debugging, I noticed the following here.

    If a searched file is not found in the DataStructCache, then this is noted in a HashSet called failSet, but a new access triggers again several read accesses to the file system which leads to the corresponding CPU load per datasource access.

    Click image for larger version  Name:	3.png Views:	0 Size:	192.3 KB ID:	268262

    According to my understanding an optimization would be conceivable here that if a search word is already contained in the failSet HashSet is not searched again since it is to be assumed that with the subsequent call also no success is to be expected.

    Could you please check if my conclusion here is correct and if so I would ask for a corresponding fix.

    Best Regards
    Helmut
    Last edited by helmut; 1 Jul 2022, 01:04.

    #2
    And a second performance bottleneck is com.isomorphic.xml.XML.getUnchangedTransformer() method, where every time a new TransformerFactory instance is created .

    Click image for larger version

Name:	Bildschirmfoto 2022-07-01 um 11.56.44.png
Views:	86
Size:	193.3 KB
ID:	268267

    TransformerFactory tf = TransformerFactory.newInstance();

    The TransformerFactory.newInstance() is a very expensive call, so as a result the cpu consumption is very high in this area.


    As i can see, the getUnchangedTransformer() method is called in a loop from XML.toSimpleValue which ist called from BasicDataSource so for every element in the datasource a new expensive TransformerFactory is created. So for every server call, a lot of time is wasted in this area.

    So if you can extend your logic, that you can reuse the created TransformerFactory within the thread the performance should be much better.
    Last edited by helmut; 1 Jul 2022, 01:57. Reason: Attachment added

    Comment


      #3
      OK, thanks for the report. A developer is assigned to take a look at this next week

      Comment

      Working...
      X