-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
BugFor errors / faults / flaws / inconsistencies etc.For errors / faults / flaws / inconsistencies etc.Help wantedBeginner friendly issues or issues where we'd highly appreciate community's help and involvement.Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.c: PerformanceFor when we could improve the performance / speed of Matomo.For when we could improve the performance / speed of Matomo.
Milestone
Description
I noticed that Matomo was doing a large amount of disk writes. Looking into it, I found that on every API request, Matomo was recreating index files for a number of directories in tmp/
even though these files already exist. These unnecessarily writes are causing high disk I/O wait when under heavy load.
Expected Behavior
Perform a Live.getVisitorProfile
API call (it might apply to other methods -- I haven't checked).
Current Behavior
On every call:
Piwik\Filechecks::dieIfDirectoriesNotWritable()
is invoked- This calls
Filechecks::mkdir()
with these directories:tmp/
tmp/tcpdf/
tmp/logs/
tmp/cache/
tmp/assets/
Filechecks::createIndexFilesToPreventDirectoryListing()
is invoked on each directory, writing a newindex.htm
andindex.php
each time (even though they already exist)- API operation is actioned
Possible Solution
I think the code should be optimised so that it doesn't perform these unnecessary writes. At the very least, check that these index files don't exist before writing to them.
Steps to Reproduce (for Bugs)
- Get
/?module=API&method=Live.getVisitorProfile&idSite=X&visitorId=XXXXXXXXXXXXXXXX&format=JSON&token_auth=XXX
.
Your Environment
- Matomo Version: 4.4.1
- PHP Version: 7.2.34
- Server Operating System: RHEL
Metadata
Metadata
Assignees
Labels
BugFor errors / faults / flaws / inconsistencies etc.For errors / faults / flaws / inconsistencies etc.Help wantedBeginner friendly issues or issues where we'd highly appreciate community's help and involvement.Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.c: PerformanceFor when we could improve the performance / speed of Matomo.For when we could improve the performance / speed of Matomo.