服务器2008新版本的服务器消息块协议的方式之一提高了SMB的原始版本的性能,是通过称为“机会主义锁定”的东西或“opllocks”。该想法是访问共享文件的客户端可以缓存文件的数据以进行重用,而无需多次传播网络链路 - 经典缓存技术。客户端可以确保尚未更改缓存文件数据的唯一方法是如果数据从其他客户端锁定。因此,假设SMB服务器批准请求,因此客户端将“机会主义锁定”放在文件上 - 例如,如果没有其他人对写入打开文件。如果另一个用户随后想要写入文件,则SMB服务器必须打破锁,然后原始客户端将丢失本地缓存数据的速度效益。使用SMB版本1,如果您愿意(这是一个注册表HACK),您可以禁用Oplocks。有些情况,它们可以创建性能和/或稳健性的净降级,具体取决于您可能正在运行的数据库软件类型。(Client/server databases might run faster and more happily with oplocks, but ISAM databases might run into data corruption issues.) However, you can’t turn oplocks off in SMB version 2. (Among other things, it would break the “offline files” feature if you did.) Remember, you’re only going to be using SMB 2.x if you’re running Longhorn machines on both ends. However, you can disable SMB 2.x entirely, which will allow the Registry setting disabling oplocks to work. With SMB version 2.1, running on Server 2008 R2 and Windows 7, Microsoft has tuned the oplocks feature so that it works better in situations where a single application might generate multiple opens to the same file, which apparently happens more often than one might suspect. Microsoft claims a performance benefit from this tweak, providing yet another argument for giving serious thought to R2 and Windows 7.
SMB和机会主义的锁定
使用幕后缓存改进文件访问性能
版权所有©2010.Raybet2