修改“Inotify Watches Limit“提高idea性能

官网说明

文档地址
For an intelligent IDE, it is essential to be in the know about any external changes in files it is working with - e.g. changes made by VCS, or build tools, or code generators etc. For that reason, IntelliJ platform spins background process to monitor such changes. The method it uses is platform-specific, and on Linux, it is the Inotify facility.
Inotify requires a “watch handle” to be set for each directory in the project. Unfortunately, the default limit of watch handles may not be enough for reasonably sized projects, and reaching the limit will force IntelliJ platform to fall back to recursive scans of directory trees.
To prevent this situation it is recommended to increase the watches limit (to, say, 512K)
大意就是说idea运行的时候有一个后台进程在不断的扫描项目文件夹里面是否有文件变动,这个技术在Linux系统上是使用 Inotify 特性实现的,但是Linux系统有一个 watch handle limit,简单说就是监视大小限制, 一般来说这个大小限制都比我们的项目所需要的小,所以idea就要经常主动去扫描项目目录,而不能利用系统特性,导致变卡

解决这个问题的办法就是我们修改一下系统配置,提高这个限制的大小。

  1. Add the following line to either /etc/sysctl.conf file or a new *.conf file (e.g. idea.conf) under /etc/sysctl.d/ directory:
    liniux系统下,在etc目录中找到:sysctl.conf文件如果没有可以新建一个不限文件名的 .conf文件将以下代码添加进去

     fs.inotify.max_user_watches = 524288
    
  2. Then run this command to apply the change:
    命令方执行生效:

     sudo sysctl -p --system
    

    重启IDE
    And don’t forget to restart your IDE.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值