如何处理长时间运行的2层应用程序中的数据库访问?
我目前正在开发服务器应用程序,该应用程序必须通过 LAN 中的 TCP 处理合理数量的客户端。服务器必须完成的任务从简单到稍微复杂不等,其中大多数包括某种形式的数据库交互。我想让数据库访问异步,因为并非所有查询都同样复杂。
我的问题是在这种应用程序中处理数据库访问的最佳方法是什么?使用持久层或 DAL(例如 NHibernate、Subsonic)是否明智?我担心潜在的泄漏以及 GC 的最终问题,这些问题都可能对正常运行时间产生负面影响,这些都是长期运行的应用程序中需要考虑的问题。
I am currently working on server application that has to deal with reasonable amount of clients over TCP in LAN. Tasks that server has to accomplish vary from trivial to mildly-complex, and most of them include some form of database interaction. I'd like to make database access asynchronous, since not all queries are equally complex.
The question I have is what is the best way to deal with database access in this kind of application? Is it wise to use persistence layer or DAL (eg. NHibernate, Subsonic)? I am worried about potential leaks, eventual problems with GC that could all have a negative impact on uptime, and which are something to think about in long running apps.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 NHibernate 这样的 O/RM 工具的主要好处本质上是生产力。供应商多年来一直致力于开发此类工具,目前普通 o/RM 工具的复杂程度远远超出了单个人或小团队的能力。
使用 O/RM 工具并不一定会给你额外的休息时间。 O/RM 工具并不完全是一个向导或快速应用程序开发工具。然而,它仍然是一种编程工具,而且也是一种复杂的工具。只要您了解该工具并提供构建良好的域模型,使用 O/RM 工具就可以提高您的工作效率。
我对 Subsonic 并不熟悉,但 NHibernate 是一个成熟的产品,目前已在全球大量企业应用程序中成功使用。如果产品存在泄漏等重大错误或对正常运行时间产生负面影响,那么肯定会进行检查和修复。
The main benefit you get out of using an O/RM tool like NHibernate is essentially productivity. Vendors have been working on such tools for years and the level of sophistication of an average o/RM tool is currently far beyond the capabilities of a single man or a small team.
Using an O/RM tool will not necessarily give you extra days off. And an O/RM tool is not exactly a wizard or rapid application development instrument. It is still a programming tool, however, and a sophisticated one too. Using an O/RM tool can enhance your productivity as long as you know the tool and supply a well-built domain model.
I am not familiar with Subsonic but NHibernate is a mature product that is currently being used successfully in a large number of enterprise applications around the globe. If the product had significant bugs like leaks or a negative impact on uptime this would certainly have been examined and fixed.