Title: [216555] trunk/Source/WebKit2
Revision
216555
Author
commit-qu...@webkit.org
Date
2017-05-09 16:14:33 -0700 (Tue, 09 May 2017)

Log Message

Buffer media in NetworkProcess to reduce IPC overhead
https://bugs.webkit.org/show_bug.cgi?id=171834
<rdar://problem/31485485>

Patch by Alex Christensen <achristen...@webkit.org> on 2017-05-09
Reviewed by Jer Noble.

I have measured a significant CPU usage reduction when buffering media data in the NetworkProcess,
especially on arm64 processors.  Buffering data in the NetworkProcess introduces no additional data
copies after r215686, and it reduces the number of messages sent from the NetworkProcess to the WebProcess,
each of which must also be forwarded to mediaserverd by AVFoundation.  This reduces the number of messages
from thousands per second to a maximum of 20 per second.  This adds 1/20 second additional latency in
media loading, which will probably not be noticed by most users.  This also adds the possibility of large
allocations when decoding IPC messages in the WebProcess, and if that becomes the source of crashes we can
add a maximum buffered amount in addition to a maximum buffered time, but we are likely not to receive
so much data in 1/20 second to have problems allocating the buffer.

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::maximumBufferingTime):
Buffer data in the NetworkProcess for up to 50ms before sending it to the WebProcess in one message.
This value is used in NetworkResourceLoader::didReceiveBuffer to append to m_bufferedData instead of
sending the small chunks immediately.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (216554 => 216555)


--- trunk/Source/WebKit2/ChangeLog	2017-05-09 23:00:10 UTC (rev 216554)
+++ trunk/Source/WebKit2/ChangeLog	2017-05-09 23:14:33 UTC (rev 216555)
@@ -1,3 +1,27 @@
+2017-05-09  Alex Christensen  <achristen...@webkit.org>
+
+        Buffer media in NetworkProcess to reduce IPC overhead
+        https://bugs.webkit.org/show_bug.cgi?id=171834
+        <rdar://problem/31485485>
+
+        Reviewed by Jer Noble.
+
+        I have measured a significant CPU usage reduction when buffering media data in the NetworkProcess,
+        especially on arm64 processors.  Buffering data in the NetworkProcess introduces no additional data
+        copies after r215686, and it reduces the number of messages sent from the NetworkProcess to the WebProcess,
+        each of which must also be forwarded to mediaserverd by AVFoundation.  This reduces the number of messages
+        from thousands per second to a maximum of 20 per second.  This adds 1/20 second additional latency in
+        media loading, which will probably not be noticed by most users.  This also adds the possibility of large
+        allocations when decoding IPC messages in the WebProcess, and if that becomes the source of crashes we can
+        add a maximum buffered amount in addition to a maximum buffered time, but we are likely not to receive
+        so much data in 1/20 second to have problems allocating the buffer.
+
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::maximumBufferingTime):
+        Buffer data in the NetworkProcess for up to 50ms before sending it to the WebProcess in one message.
+        This value is used in NetworkResourceLoader::didReceiveBuffer to append to m_bufferedData instead of
+        sending the small chunks immediately.
+
 2017-05-09  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r216545.

Modified: trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp (216554 => 216555)


--- trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp	2017-05-09 23:00:10 UTC (rev 216554)
+++ trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp	2017-05-09 23:14:33 UTC (rev 216555)
@@ -115,6 +115,7 @@
     case CachedResource::ImageResource:
         return 500_ms;
     case CachedResource::MediaResource:
+        return 50_ms;
     case CachedResource::MainResource:
     case CachedResource::RawResource:
     case CachedResource::SVGDocumentResource:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to