解决mac启动springboot项目速度慢问题

打开/etc/hosts文件

原始内容大概如下:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1             localhost
255.255.255.255     broadcasthost
::1                 localhost 

修改内容, 加入'你的机器名.local'

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1             localhost 你的机器名.local
255.255.255.255     broadcasthost
::1                 localhost 你的机器名.local

如何查看机器名

方式一:

屏幕快照 2018-04-20 06.23.24.png

紫色方框内的内容就是: 你的机器名.local

方式二:

打开终端, 输入命令hostname

原先运行一个最简单的springboot项目(helloword), 需要16秒(指定了logback配置文件,不指定的时候大概要11秒), 修改了hosts文件之后, 2s就可以启动了

其它补充说明

Visual VM在mac也会要很久才能加载出左侧的local内容, 解决方案也是修改/etc/hosts文件, 添加127.0.0.1到hostname的映射

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容