<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13539</bug_id>
          
          <creation_ts>2019-09-19 11:29:25 +0000</creation_ts>
          <short_desc>eSDK: performance issues when assembling sstate for full SDK</short_desc>
          <delta_ts>2020-01-16 16:26:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>eSDK</product>
          <component>eSDK</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>3.1 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>alex.kanavin</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
          
          <qa_contact name="Francisco Pedraza">francisco.j.pedraza.gonzalez</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>85008</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2019-09-19 11:29:25 +0000</bug_when>
    <thetext>When generating the sstate-cache for the eSDK (which is implemented in scripts/gen-lockedsig-cache) we are using glob to find the files matching each signature since we don&apos;t have the context to generate the full filename for each sstate archive; this is extremely expensive and starting to be problematic on the autobuilder, especially with the size of the local sstate-cache dirs there. We could at least try rewriting this to generate an in-memory mapping of hash to filename and that should be a big improvement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85030</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-09-19 20:35:45 +0000</bug_when>
    <thetext>As the sstate cache on the autobuilder grows this is costing significant time on non-minimal esdk builds. The sstate cache is over NFS and directory listings are extremely slow (see the qa-extras step4b).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85035</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-09-20 16:26:36 +0000</bug_when>
    <thetext>Somewhat bad example on the AB last night:

https://autobuilder.yoctoproject.org/typhoon/#/builders/69/builds/1066/steps/8/logs/stdio

Step 5/7: Running bitbake core-image-sato core-image-sato:do_populate_sdk_ext (1568993016.3: 45086.1)

That&apos;s twelve and a half hours.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85106</commentid>
    <comment_count>3</comment_count>
    <who name="Konrad Scherer">konrad.scherer</who>
    <bug_when>2019-09-26 15:49:16 +0000</bug_when>
    <thetext>I am trying to reproduce the problem locally but it will take time. Why not disable sstate for these builds as a workaround? Looks like building from scratch will be faster and will not block the release.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85122</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-09-27 12:58:00 +0000</bug_when>
    <thetext>We build the esdk in many different places on the autobuilder, e.g. for each qemu machine, during selftest and so on. It looks like this performance issue affects minimal eSDK builds as well as non-minimal ones to some extent, the non-minimal ones are just much more badly affected. Bottom line is that we can&apos;t easily disable it just for those pieces. It would also leave our release artefacts incomplete.

What we may have to do is empty the sstate cache to speed things back up again...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85124</commentid>
    <comment_count>5</comment_count>
    <who name="Konrad Scherer">konrad.scherer</who>
    <bug_when>2019-09-27 18:59:02 +0000</bug_when>
    <thetext>I have sent a patch that replaces the glob with a hash to filename lookup. Unfortunately I was not able to reproduce the performance issues locally, but I was able to verify that file list produced was identical. I also added a basic time counter and logging so it would be easier to capture performance data in the future. Please review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85291</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-10-10 14:32:40 +0000</bug_when>
    <thetext>To update this bug, we did update the script to perform better (Thanks Konrad!). Unfortunately this wasn&apos;t enough with long timeouts on the autobuilder. We therefore also cleaned out the sstate cache which has improved the timing.

There is another way we could improve performance which is not to involve listing the directories at all but calculating the filenames directly. To quote me from elsewhere:

&quot;&quot;&quot;
Just to elaborate on what teaching the code would entail, as well as
using the &apos;hashfn&apos; data as part of the hash validate function in from
runqueue.py:

sq_data[&apos;hashfn&apos;][tid] = self.rqdata.dataCaches[mc].hashfn[taskfn]

we could inject that data into BB_TASKDEPDATA. If we did that, the
oecore code could probably create the full sstate tasknames for the
tasks it needs using logic extracted out of sstate_checkhashes() from
sstate.bbclass.

This would mean the script wouldn&apos;t have to guess at filenames, it
could access them directly.
&quot;&quot;&quot;

I suggest we retarget this bug for 3.1 as an enhancement for doing this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86054</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-01-16 16:26:35 +0000</bug_when>
    <thetext>As a final piece, we split up the contexts of the sstate directories tom mitigate the performance issues:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=4cb1b4b409c4067c669fedef4a02be27689e3d26</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>