gpt4 book ai didi

.net - 如何异步运行 NHibenate 查询?

转载 作者:行者123 更新时间:2023-12-03 12:09:06 25 4
gpt4 key购买 nike

提高服务器应用程序可扩展性的一种方法是异步运行 IO 绑定(bind)操作(读取文件、套接字、Web 请求、数据库请求等)。这并不意味着在 ThreadPool 中运行它们,这只会在执行操作时阻塞线程。正确的方法是使用异步 API(BeginRead、BeginGetResponse、BeginExecuteReader 等)。 CLR vi C# 中很好地描述了这个问题。书。

这是一些关于 asynchronous queries in Linq to SQL 的文章.

有什么方法可以异步执行 Nhibernate 查询吗? Linq 到 NHibernate 怎么样?

谢谢,
安德烈

最佳答案

请注意,异步数据库调用本身并不意味着更好的整体可伸缩性。推荐阅读文章“Should my database calls be Asynchronous?”进行深入分析。这是那篇文章的引述:

One respected DB/Web architect went so far as to say:
For database applications using async operations to reduce the number of blocked threads on the web server is almost always a complete waste of time. A small web server can easily handle way more simultaneous blocking requests than your database back-end can process concurrently. Instead make sure your service calls are cheap at the database, and limit the number of concurrently executing requests to a number that you have tested to work correctly and maximize overall transaction throughput.

关于.net - 如何异步运行 NHibenate 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2485960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com