Changeset 185452 in webkit
- Timestamp:
- Jun 11, 2015, 5:05:25 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm (modified) (3 diffs)
-
NetworkProcess/cache/NetworkCacheStorage.cpp (modified) (6 diffs)
-
NetworkProcess/cache/NetworkCacheStorage.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r185448 r185452 1 2015-06-11 Antti Koivisto <antti@apple.com> 2 3 3% cold PLT regression from network cache on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=145694 5 rdar://problem/21158245 6 7 Reviewed by Chris Dumez. 8 9 Cache does not help in cold page loads but it shouldn't' be hurting either. Write I/O needs to be toned down a bit. 10 11 * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm: 12 (WebKit::NetworkCache::IOChannel::IOChannel): 13 (WebKit::NetworkCache::IOChannel::open): 14 15 Dispatch channels inherit their I/O priority from the target queue. Use background queue for write I/O. 16 17 * NetworkProcess/cache/NetworkCacheStorage.cpp: 18 (WebKit::NetworkCache::Storage::Storage): 19 (WebKit::NetworkCache::Storage::dispatchPendingReadOperations): 20 (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations): 21 22 Only write one file at a time instead of maximum of three. 23 24 (WebKit::NetworkCache::Storage::retrieve): 25 26 For consistency with store prepend new entries here too. 27 28 (WebKit::NetworkCache::Storage::store): 29 30 Delay start of the first write operation by 1s. 31 Prepend instead of append to the pending write deque so retrieveFromMemory lookup finds newest entries first in case of duplicates 32 33 (WebKit::NetworkCache::Storage::traverse): 34 * NetworkProcess/cache/NetworkCacheStorage.h: 35 1 36 2015-06-10 Yongjun Zhang <yongjun_zhang@apple.com> 2 37 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm
r185412 r185452 47 47 int oflag; 48 48 mode_t mode; 49 bool useLowIOPriority = false; 49 50 50 51 switch (m_type) { … … 54 55 oflag = O_RDWR | O_CREAT | O_NONBLOCK; 55 56 mode = S_IRUSR | S_IWUSR; 57 useLowIOPriority = true; 56 58 break; 57 59 case Type::Write: 58 60 oflag = O_WRONLY | O_NONBLOCK; 59 61 mode = S_IRUSR | S_IWUSR; 62 useLowIOPriority = true; 60 63 break; 61 64 case Type::Read: … … 71 74 })); 72 75 ASSERT(m_dispatchIO.get()); 76 73 77 // This makes the channel read/write all data before invoking the handlers. 74 78 dispatch_io_set_low_water(m_dispatchIO.get(), std::numeric_limits<size_t>::max()); 79 80 if (useLowIOPriority) { 81 // The target queue of a dispatch I/O channel specifies the priority of the global queue where its I/O operations are executed. 82 dispatch_set_target_queue(m_dispatchIO.get(), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)); 83 } 75 84 } 76 85 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp
r185412 r185452 127 127 : m_basePath(baseDirectoryPath) 128 128 , m_recordsPath(makeRecordsDirectoryPath(baseDirectoryPath)) 129 , m_writeOperationDispatchTimer(*this, &Storage::dispatchPendingWriteOperations) 129 130 , m_ioQueue(WorkQueue::create("com.apple.WebKit.Cache.Storage", WorkQueue::Type::Concurrent)) 130 131 , m_backgroundIOQueue(WorkQueue::create("com.apple.WebKit.Cache.Storage.background", WorkQueue::Type::Concurrent, WorkQueue::QOS::Background)) … … 544 545 if (pendingRetrieveQueue.isEmpty()) 545 546 continue; 546 auto readOperation = pendingRetrieveQueue.take First();547 auto readOperation = pendingRetrieveQueue.takeLast(); 547 548 auto& read = *readOperation; 548 549 m_activeReadOperations.add(WTF::move(readOperation)); … … 570 571 ASSERT(RunLoop::isMain()); 571 572 572 const int maximumActiveWriteOperationCount { 3};573 const int maximumActiveWriteOperationCount { 1 }; 573 574 574 575 while (!m_pendingWriteOperations.isEmpty()) { … … 577 578 return; 578 579 } 579 auto writeOperation = m_pendingWriteOperations.take First();580 auto writeOperation = m_pendingWriteOperations.takeLast(); 580 581 auto& write = *writeOperation; 581 582 m_activeWriteOperations.add(WTF::move(writeOperation)); … … 660 661 return; 661 662 662 m_pendingReadOperationsByPriority[priority]. append(new ReadOperation { key, WTF::move(completionHandler) } );663 m_pendingReadOperationsByPriority[priority].prepend(new ReadOperation { key, WTF::move(completionHandler) } ); 663 664 dispatchPendingReadOperations(); 664 665 } … … 672 673 return; 673 674 674 m_pendingWriteOperations. append(new WriteOperation { record, WTF::move(mappedBodyHandler) });675 m_pendingWriteOperations.prepend(new WriteOperation { record, WTF::move(mappedBodyHandler) }); 675 676 676 677 // Add key to the filter already here as we do lookups from the pending operations too. 677 678 addToRecordFilter(record.key); 678 679 679 dispatchPendingWriteOperations(); 680 bool isInitialWrite = m_pendingWriteOperations.size() == 1; 681 if (!isInitialWrite) 682 return; 683 684 // Delay the start of writes a bit to avoid affecting early page load. 685 // Completing writes will dispatch more writes without delay. 686 static const auto initialWriteDelay = 1_s; 687 m_writeOperationDispatchTimer.startOneShot(initialWriteDelay); 680 688 } 681 689 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h
r185412 r185452 32 32 #include "NetworkCacheData.h" 33 33 #include "NetworkCacheKey.h" 34 #include <WebCore/Timer.h> 34 35 #include <wtf/BloomFilter.h> 35 36 #include <wtf/Deque.h> … … 151 152 Deque<std::unique_ptr<WriteOperation>> m_pendingWriteOperations; 152 153 HashSet<std::unique_ptr<WriteOperation>> m_activeWriteOperations; 154 WebCore::Timer m_writeOperationDispatchTimer; 153 155 154 156 Ref<WorkQueue> m_ioQueue;
Note:
See TracChangeset
for help on using the changeset viewer.