大网数据广告活动
服务器运维问答

Does SElinux in enforcing mode cause delays in file access?

· 52CE 我爱测

I have enabled SElinux in enforcing mode on Amazon Linux and see that the time taken for file access (read/write/update) has increased by an average of 2-4 seconds. The source process is Salt and the file access is related to the…

问题原文

原帖链接 · sce · CC BY-SA 4.0

I have enabled SElinux in enforcing mode on Amazon Linux and see that the time taken for file access (read/write/update) has increased by an average of 2-4 seconds. The source process is Salt and the file access is related to the file.managed state of Salt https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.managed There are no corresponding denials in the audit.log file. As a brute-force approach, we tried adding allow rules for all denials in the log using audit2allow but could not improve the time taken to access files.

Is SElinux known to cause a performance hit in filesystem access? Are there known processes on a linux system which affect time to access files?

已采纳解答

原帖链接 · John Mahowald · CC BY-SA 4.0

SELinux is routinely enforcing on systems that do more IOPS than yours. Also, IOs regularly taking multiple seconds is intolerably poor performance, no matter what storage system or additional overhead.

Something else is happening. Use Linux's rich performance tools to reveal it. Some starting ideas:

  • Measure the utilization of all performance resources on the host. CPU, disk bandwith, disk IOPS, memory, and so on.
  • Get a flame graph of what is on CPU when this thing is slow.
  • Use a programming language specific profiler on the problem lines of code. In this case, salt's file functions.
  • Get the block IO latency distribution such as with biolatency.
  • Benchmark raw IOs on this storage system using tools like fio, or just touch

(Some of these require recent kernels for bpf and other features. I don't know how good Amazon Linux's tooling is for all of these.)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-08-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。