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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>219689</bug_id>
          
          <creation_ts>2020-12-09 08:34:27 -0800</creation_ts>
          <short_desc>[WPE][GTK] Should enable WebProcessCache</short_desc>
          <delta_ts>2020-12-14 04:28:25 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aperez</cc>
    
    <cc>berto</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cdumez</cc>
    
    <cc>cgarcia</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>gustavo</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1713162</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-12-09 08:34:27 -0800</bug_when>
    <thetext>It looks like WPE and GTK do not enable the WebProcessCache feature added in r241556:

&quot;&quot;&quot;
Introduce a WebContent Process cache to reduce the number of process launches when
process swap on navigation is enabled, and to reduce the power cost of the feature.

If a WebProcess loaded pages from a single registrable domain then it is eligible
for the cache. When process-swapping on navigation to a new registrable domain, we
now attempt to retrieve a process from the cache for the domain in question instead
of always launching a new one.

The WebProcess cache currently has the following attributes:

It may contains 4 processes per GB of RAM the machine has, up to 30 processes.
WebProcesses automatically get evicted from the cache after 30 minutes.
If the application is no longer the active app, then the cache will get cleared after 5 minutes.
WebProcesses that are in the cache are reported as &quot;(Cached)&quot; in Activity Monitor.
The WebProcess cache is currently disabled by default and can by enabled by the
client via SPI.
&quot;&quot;&quot;

We probably want to have that enabled, or at least make it possible to enable it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713164</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-12-09 08:36:16 -0800</bug_when>
    <thetext>If you have Process-Swap-On-Navigation (PSON) enabled, then I think you&apos;d definitely want the process cache too. Note that Apple only enables the process-cache on desktop (not mobile) due to memory constraints.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713168</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-12-09 08:39:03 -0800</bug_when>
    <thetext>Yeah of course we have PSON. That has been enabled for ages now.

I think nobody realized that the process cache had to be enabled separately.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713170</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-12-09 08:42:22 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #1)
&gt; If you have Process-Swap-On-Navigation (PSON) enabled, then I think you&apos;d
&gt; definitely want the process cache too. Note that Apple only enables the
&gt; process-cache on desktop (not mobile) due to memory constraints.

Currently we have a chassis type check that could be used for this, but it doesn&apos;t work reliably due to bug #218122, and is currently only used to set a mobile user agent header.

It would probably make more sense to enable or disable the cache based on total available RAM, rather than checking form factor, since there&apos;s not really any difference between a mobile phone with 3 GB RAM (Librem 5) and a desktop with 3 GB RAM. The performance hit if you run out of RAM is going to be bad either way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713171</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-12-09 08:44:34 -0800</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #3)
&gt; (In reply to Chris Dumez from comment #1)
&gt; &gt; If you have Process-Swap-On-Navigation (PSON) enabled, then I think you&apos;d
&gt; &gt; definitely want the process cache too. Note that Apple only enables the
&gt; &gt; process-cache on desktop (not mobile) due to memory constraints.
&gt; 
&gt; Currently we have a chassis type check that could be used for this, but it
&gt; doesn&apos;t work reliably due to bug #218122, and is currently only used to set
&gt; a mobile user agent header.
&gt; 
&gt; It would probably make more sense to enable or disable the cache based on
&gt; total available RAM, rather than checking form factor, since there&apos;s not
&gt; really any difference between a mobile phone with 3 GB RAM (Librem 5) and a
&gt; desktop with 3 GB RAM. The performance hit if you run out of RAM is going to
&gt; be bad either way.

Yes, Apple port listen to memory pressure warnings and kill those cached processes as necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713500</commentid>
    <comment_count>5</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-12-10 05:22:33 -0800</bug_when>
    <thetext>I thought it was enabled. I&apos;ll submit a patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713501</commentid>
    <comment_count>6</comment_count>
      <attachid>415860</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-12-10 05:23:25 -0800</bug_when>
    <thetext>Created attachment 415860
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713502</commentid>
    <comment_count>7</comment_count>
    <who name="EWS Watchlist">ews-watchlist</who>
    <bug_when>2020-12-10 05:24:15 -0800</bug_when>
    <thetext>Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713524</commentid>
    <comment_count>8</comment_count>
      <attachid>415860</attachid>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2020-12-10 06:28:46 -0800</bug_when>
    <thetext>Comment on attachment 415860
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=415860&amp;action=review

&gt; Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:394
&gt; +    configuration.setUsesWebProcessCache(true);

I think it&apos;s fine to land this as-is, but depending on things go we
might need to either add some smarts to choose a sensible default
for this and/or add API to WebKitWebContext to toggle it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713530</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-12-10 06:56:39 -0800</bug_when>
    <thetext>The GTK API EWS is red. Score +1 for whoever set up that EWS bot. That is nice to have....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1714412</commentid>
    <comment_count>10</comment_count>
      <attachid>416146</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-12-14 03:01:00 -0800</bug_when>
    <thetext>Created attachment 416146
Patch for landing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1714421</commentid>
    <comment_count>11</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2020-12-14 04:28:25 -0800</bug_when>
    <thetext>Committed r270767: &lt;https://trac.webkit.org/changeset/270767&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>415860</attachid>
            <date>2020-12-10 05:23:25 -0800</date>
            <delta_ts>2020-12-14 03:01:00 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>wk2-process-cache.diff</filename>
            <type>text/plain</type>
            <size>1278</size>
            <attacher name="Carlos Garcia Campos">cgarcia</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nIGIvU291cmNlL1dlYktpdC9DaGFu
Z2VMb2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Nz
L0FQSS9nbGliL1dlYktpdFdlYkNvbnRleHQuY3BwCkBAIC0zOTEsNiArMzkxLDcgQEAgc3RhdGlj
IHZvaWQgd2Via2l0V2ViQ29udGV4dENvbnN0cnVjdGVkKEdPYmplY3QqIG9iamVjdCkKIAogICAg
IEFQSTo6UHJvY2Vzc1Bvb2xDb25maWd1cmF0aW9uIGNvbmZpZ3VyYXRpb247CiAgICAgY29uZmln
dXJhdGlvbi5zZXRJbmplY3RlZEJ1bmRsZVBhdGgoRmlsZVN5c3RlbTo6c3RyaW5nRnJvbUZpbGVT
eXN0ZW1SZXByZXNlbnRhdGlvbihidW5kbGVGaWxlbmFtZS5nZXQoKSkpOworICAgIGNvbmZpZ3Vy
YXRpb24uc2V0VXNlc1dlYlByb2Nlc3NDYWNoZSh0cnVlKTsKICNpZiBQTEFURk9STShHVEspCiAg
ICAgY29uZmlndXJhdGlvbi5zZXRQcm9jZXNzU3dhcHNPbk5hdmlnYXRpb24ocHJpdi0+cHNvbkVu
YWJsZWQpOwogI2lmICFVU0UoR1RLNCkK
</data>
<flag name="review"
          id="433180"
          type_id="1"
          status="+"
          setter="aperez"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>416146</attachid>
            <date>2020-12-14 03:01:00 -0800</date>
            <delta_ts>2020-12-14 03:01:00 -0800</delta_ts>
            <desc>Patch for landing</desc>
            <filename>wk-process-cache.diff</filename>
            <type>text/plain</type>
            <size>1295</size>
            <attacher name="Carlos Garcia Campos">cgarcia</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nIGIvU291cmNlL1dlYktpdC9DaGFu
Z2VMb2cKaW5kZXggMzAzMjhjZjZlODQ1Li5jODNmNTY1OGE2ZmIgMTAwNjQ0Ci0tLSBhL1NvdXJj
ZS9XZWJLaXQvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG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