[ZBX-18573] Performance of zabbix agent while scanning dir much worse than standard dir on Windows Created: 2020 Oct 28 Updated: 2024 Apr 10 Resolved: 2022 Aug 16 |
|
| Status: | Closed |
| Project: | ZABBIX BUGS AND ISSUES |
| Component/s: | Agent (G) |
| Affects Version/s: | 5.0.6rc1 |
| Fix Version/s: | 5.0.27rc1, 6.0.8rc1, 6.2.2rc1, 6.4.0alpha1, 6.4 (plan) |
| Type: | Problem report | Priority: | Critical |
| Reporter: | Andrei Gushchin (Inactive) | Assignee: | Dmitrijs Goloscapovs (Inactive) |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Team: | |||||
| Sprint: | Sprint 69 (Oct 2020), Sprint 70 (Nov 2020), Sprint 71 (Dec 2020), Sprint 72 (Jan 2021), Sprint 73 (Feb 2021), Sprint 74 (Mar 2021), Sprint 75 (Apr 2021), Sprint 76 (May 2021), Sprint 77 (Jun 2021), Sprint 78 (Jul 2021), Sprint 79 (Aug 2021), Sprint 80 (Sep 2021), Sprint 81 (Oct 2021), Sprint 82 (Nov 2021), Sprint 83 (Dec 2021), Sprint 84 (Jan 2022), Sprint 85 (Feb 2022), Sprint 86 (Mar 2022), Sprint 87 (Apr 2022), Sprint 88 (May 2022), Sprint 89 (Jun 2022), Sprint 90 (Jul 2022), Sprint 91 (Aug 2022) | ||||
| Story Points: | 2 | ||||
| Description |
|
Steps to reproduce: Result: .\zabbix_get.exe -s 127.0.0.1 -k 'vfs.dir.count[C:\DATA\tmp,.txt,,file]' ZBX_NOTSUPPORTED: Timeout while waiting for data. Always reached timeout event 30 sec., while dir /s /w return all file list and their count and size with 19-20 sec. or less
C:\DATA\tmp> dir /s /w
.....
test9984.txt test9985.txt test9986.txt test9987.txt test9988.txt test9989.txt test999.txt
test9990.txt test9991.txt test9992.txt test9993.txt test9994.txt test9995.txt test9996.txt
test9997.txt test9998.txt test9999.txt test[1..60000].txt
68064 File(s) 0 bytes
Total Files Listed:
68064 File(s) 0 bytes
2 Dir(s) 31 752 388 608 bytes free
Expected: |
| Comments |
| Comment by Viktors Tjarve [ 2020 Nov 10 ] | ||||||||||||||||||||||||||||||||||
|
There are 4 types of links in Windows platform:
Currently in Zabbix documentation for vfs.dir.count[] it is stated that Pseudo-directories “.” and “..” are never counted. Symbolic links are never followed for directory traversal. On Windows, directory symlinks are skipped and hard links are counted only once. Lets create a directory that contains three of each type links. All six file links point to the same file and all six directory links point to the same directory. How to create a symbolic link on Windows. Observed:
From this it is visible that:
Zabbix agent behaviuor matches what is stated in documentation but it is unclear why file hard links are counted only once for each target file. That is also the cause of the poor performance then a directory with large number of files has to be check with vfs.dir.count[]. Link information has to be extracted for every file that is counted to see if it's not a hard link to a target that already has been counted added to the total count before. Solution: For Windows Zabbix agent add additional type for types_incl parameter. It could be called "fhl" (file hard link). This type would not be included with type "all"(ZBX_FT_ALLMASK). If type "fhl" is used then all file hard links would be counted in as regular files same that is done by MS File Explorer. Now already file symbolic links are counted as regular files by both MS File Explorer and Zabbix agent. | ||||||||||||||||||||||||||||||||||
| Comment by Vladislavs Sokurenko [ 2022 Jul 05 ] | ||||||||||||||||||||||||||||||||||
|
The problem is that there are additional system calls when using Zabbix agent instead of dir, it should be possible to avoid those system calls and to provide same functionality as dir provides. <dgoloscapov> Agent is implemented in a way that vfs.dir.count counts hard links only once. It opens file handle to verify if this is file or hard link. It is the real reason why performance can be hit. WinAPI doesn't seem to have any other way to check if some file is hard link, and how many times inode was linked. | ||||||||||||||||||||||||||||||||||
| Comment by Alex Kalimulin [ 2022 Jul 14 ] | ||||||||||||||||||||||||||||||||||
|
We will remove the obscure feature of counting hard links only once on Windows. Also we should check how vfs.dir.get deals with hard links. | ||||||||||||||||||||||||||||||||||
| Comment by Dmitrijs Goloscapovs (Inactive) [ 2022 Aug 11 ] | ||||||||||||||||||||||||||||||||||
|
Available in versions:
Documentation updated: |