zoukankan      html  css  js  c++  java
  • Speeding up Homestead on Windows Using NFS

    Speeding up Homestead on Windows Using NFS

    Sep 07 2015

    Homestead Laravel

    EDIT: I have another article on using Homestead with sFTP and Sublime which may be a better option for some.

    I recently took the plunge into getting a Homestead vagrant box setup locally for development. I followed the instructions on the Laravel docs page and all went well. It took me only about ten minutes to get everything working within Homestead, awesome!

    But wait, why is everything so slow? I started searching Google and it seems it's a common problem for Windows. It seems the trick is to enable nfs support for windows and boot your folders using the nfs file system.

    It took a bit of searching and tinkering so thought I would share the few simple steps it takes to enable nfs for vagrant on Windows.

    Install NFS Plugin

    Just run this install for the plugin from anywhere.

    vagrant plugin install vagrant-winnfsd
    

    Update homestead.rb

    There is some weird bug here, not sure why it hasn't been pushed into the main repo yet, but you will need to replace some code here (if not already live).

    homestead/scripts/homestead.rb

    Replace the following:

    if settings.include? 'folders'
      settings["folders"].each do |folder|
        mount_opts = []
    
        if (folder["type"] == "nfs")
          mount_opts = folder["mount_opts"] ? folder["mount_opts"] : ['actimeo=1']
        end
    
        config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, mount_options: mount_opts
      end
    end
    

    With this:

    if settings.include? 'folders'
      settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length }
    
      settings["folders"].each do |folder|
        config.vm.synced_folder folder["map"], folder["to"], 
        id: folder["map"],
        :nfs => true,
        :mount_options => ['nolock,vers=3,udp,noatime']
      end
    end
    

    Update Homestead.yaml

    We can now use nfs in the folders section of the homestead config file.

    folders:
        - map: ~projects
          to: /home/vagrant/Code
          type: nfs
    

    Rebooting

    You may also need a reboot at this point especially if you've been playing around to try and get this working.

    First make sure you remove any vm in your VirtualBox and also check the ~VritualBox VMs folder to make sure everything is deleted.

    After a reboot try vagrant up again and it should spin up a new box. I found when I added folders I had to go through this each time. Fortunately that doesn't happen often at all.

    Disable Sendfile

    This is on a bit of a side note, but it's also recommended that sendfile for Nginx be disabled.

    > sudo vi /etc/nginx/nginx.conf
    

    And change sendfile from on to off.

  • 相关阅读:
    Jmeter 断言 之 响应断言
    Jmeter 配置元件 之 HTTP信息头管理器 使用
    Jmeter 请求元件 之 察看结果树
    Jmeter 请求元件 之 HTTP请求默认值
    Jmeter 之 参数类型 分为三种:参数(parameters)类型、消息体数据(bodydata)类型、文件上传(Files Upload)类型
    Jmeter 请求元件之 Jmeter request 发送 get 、post 请求
    Jmeter 之 HTTP 请求常见状态码
    Jmeter 请求之 http 请求之请求头、响应头
    性能测试流程
    jmeter 性能分析从哪几个方面
  • 原文地址:https://www.cnblogs.com/mouseleo/p/9511817.html
Copyright © 2011-2022 走看看