Windows 上的 MySQL 命名管道——更快的最佳实践,还是坏主意?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/832714/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySQL named pipes on Windows--faster best practice, or bad idea?
提问by Garen
Lately I've been favoring using named pipes (option --enable-named-pipes) in MySQL running on windows, and connect via the .NET connector driver. It's often recommended for security purposes, but one thing it allows me to do is connect with "." as the connection string and develop on my PC and deploy to the server without having to change the connection string (to point to the server host instead of my own copy of the DB).
最近,我一直喜欢在 Windows 上运行的 MySQL 中使用命名管道(选项 --enable-named-pipes),并通过 .NET 连接器驱动程序进行连接。出于安全目的,通常建议使用它,但它允许我做的一件事是连接“。” 作为连接字符串并在我的 PC 上开发并部署到服务器,而无需更改连接字符串(指向服务器主机而不是我自己的数据库副本)。
More than that, in my experience there is some speedup I've attributed to a latency advantage over TCP. Some references I've found online echo that:
更重要的是,根据我的经验,我将一些加速归因于 TCP 的延迟优势。我在网上找到的一些参考资料回应说:
We were testing successfuly MySQL 5.0 using named pipe, and what an increase in speed! 50% in the case of this big project First it may be a good idea to use the latest JConnector driver from MySQL
http://www.waltercedric.com/component/content/article/1217.html
我们使用命名管道成功地测试了 MySQL 5.0,速度提高了!在这个大项目的情况下 50% 首先使用 MySQL 的最新 JConnector 驱动程序可能是个好主意
http://www.waltercedric.com/component/content/article/1217.html
In simple performance tests, it appears that named pipe access is between 30%-50% faster than the standard TCP/IP access. However, this varies per system, and named pipes are slower than TCP/IP in many Windows configurations.
http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html
在简单的性能测试中,命名管道访问似乎比标准 TCP/IP 访问快 30%-50%。但是,这因系统而异,并且命名管道在许多 Windows 配置中比 TCP/IP 慢。
http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html
But in what "configurations" is it slower? Anyway, I've been proceeding on the assumption that it's faster for localhost access vs TCP, however, I haven't been able to find anything definitive. Perhaps it's more specific to the particular driver being used too.
但是在什么“配置”中它更慢?无论如何,我一直在假设 localhost 访问比 TCP 更快,但是,我一直找不到任何确定的东西。也许它也更特定于正在使用的特定驱动程序。
采纳答案by Elan Hasson
Try looking at http://msdn.microsoft.com/en-us/library/aa178138(SQL.80).aspx
尝试查看http://msdn.microsoft.com/en-us/library/aa178138(SQL.80).aspx
Even though it speaks about MS SQL Server, the Local named pipes running in kernel mode shouldstill apply
即使它谈到MS SQL Server中,在内核模式下运行的本地命名管道应仍适用
From the aforementioned link:
从上述链接:
It is also important to clarify if you are talking about local pipes or network pipes. If the server application is running locally on the computer running an instance of Microsoft? SQL Server? 2000, the local Named Pipes protocol is an option. Local named pipes runs in kernel mode and is extremely fast.
澄清您是在谈论本地管道还是网络管道也很重要。如果服务器应用程序在运行 Microsoft 实例的计算机上本地运行?SQL服务器?2000 年,本地命名管道协议是一个选项。本地命名管道在内核模式下运行并且速度非常快。
回答by Elan Hasson
I did a quick test - dumping a db to a file and reimporting it on my XP dev machine. No difference showed - results remained the same.
我做了一个快速测试 - 将一个 db 转储到一个文件中,然后在我的 XP 开发机器上重新导入它。没有显示出差异 - 结果保持不变。
What would influence named pipes to be slower or faster?
什么会影响命名管道变慢或变快?
Thanks
谢谢