亚音速,支持缓存
制定一个具有以下要求的项目。
- 数据读取密集型应用程序。
- 一次最大并发用户数为 100。 应用程序具有非常高的流量
- 虽然数据很大,但每天只修改一次
决定使用亚音速,因为易于开发并且有在高流量环境中工作的潜力。
虽然还没有找到/解决一些问题来与 SubSonic 3 一起使用,但是
- 哪种类型的层可以使用 Active Records、Repository、Linq To SQL
- 来处理分页/排序存储过程(因为在显示 10000 时,它们会比内置分页机制提供更好的性能) + 行分页和排序对吗?)
- 缓存,根据项目需求,很明显,需要大量使用缓存。 但找不到适合亚音速的解决方案。 我是否必须为其创建单独的层,如果是,一个简短的示例会有所帮助。
Having a project with following requirements in mind.
- data reading intensive application.
- 100 max concurrent users a times. Application have very high traffic
- Though data is huge it is getting modified only once a day
Decided to use subsonic cause of ease of development and potential to work in high traffic environment.
Though few things are not yet found/solved to work with SubSonic 3
- Which type of layer to use Active Records, Repository, Linq To SQL
- working with paging / sorting stored procedures (cause they will give better performance over inbuilt paging mechanism, when displaying 10000+ rows with paging and sorting. right?? )
- Caching, with project requirement it is quite clear, heavy use of caching is required. But could not find suitable solution, which will work with subsonic.
do I have to create separate layer for it and if yes, a short example would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我为 subsonic 2.x ActiveRecord 编写了一个 CacheUtil 类。 它基于某人在旧亚音速论坛上发布的一些代码。 (这是来自在删除最后一个论坛之前删除的论坛。这就是软件论坛应该是永久的原因。)以下是缓存查找方法的示例。 您可以将其调整为 ss3。 还有inserts、fetchall、delete、clear等。Rob Connery当时说缓存有问题,故意被排除在ss2之外。 通过使用 HttpRuntime.Cache,我同时在 Web 应用程序和服务之间共享缓存。 我相信我可以做到这一点,因为它是一个小型应用程序,始终位于单个服务器上。
I wrote a CacheUtil class for subsonic 2.x ActiveRecord. It's based on some code someone posted on the old subsonic forums. (This is from a forum that was deleted before the last forum was removed. This is why software forums should be permanent.) Here is an example of a cache Find method. You could adapt it to ss3. There are also inserts, fetchall, delete, clear, etc. Rob Connery said at the time that caching was problematic, and it was left out of ss2 on purpose. By using HttpRuntime.Cache I share the cache between a web application and service simultaneously. I believe I can do this since it's a small application, always on a single server.
我写了一篇关于我如何在 SubSonic 2.x 中使用缓存。 它与 3.x 并非 100% 兼容,但概念是相同的。
I wrote a post about how I used caching with SubSonic 2.x. It isn't 100% compatible with 3.x but the concepts are the same.
我在这里回答了类似的问题 .NET 的线程安全缓存库。 基本上,您需要一个 CollectionCacheManager - 然后我在每种类型的顶部添加一个层,并通过这个单独的缓存控制器汇集所有请求,而这些控制器又使用 1 个 collectioncachecontroller。 在外层,我混合了纯亚音速、linq 等当时符合要求的声音。 SubSonic 的美妙之处在于它不会妨碍您。 至于存储过程的性能,我会参考 Jeff Atwoods 在 CodingHorror 上的文章,并重新评估您的节省。 硬件非常便宜,内存也非常便宜,但数据库则不然。 就我个人而言,我保持数据库超级简单和轻量级,并且更喜欢让我的网络服务器将所有内容缓存在内存中。 数据库服务器只需做很少的工作,这正是我喜欢的方式。 添加一些额外的负载平衡 Web 服务器并不像增加数据库吞吐量、集群或数据库分片那么重要。 SQL& 存储过程的编写和维护也非常困难。 拿出你本来会花在这件事上的时间预算,然后加强你的硬件……记住硬件非常便宜,而优秀的开发人员则不然。 祝你好运!
I answered this similarly over here Thread-safe cache libraries for .NET. Basically you need a CollectionCacheManager - I then add a layer on top for each type and funnel all requests through this individual cache controllers, which in turn are using the 1 collectioncachecontroller. At the outer layer I mix pure subsonic, linq, whatever fits the bill at the time. That's the beauty of SubSonic is that it should not get in your way. As far as stored proc performance I would point to Jeff Atwoods articles over at CodingHorror and reevaulaute your savings. Hardware is dirt cheap, as is memory, databases are not. Personally I keep the database super simple and lightweight, and prefer to let my webserver cache everything in memory. The database server gets to do very little work which is the way I like it. Adding a few extra load balanced web servers isn't nearly as big of a deal as increasing database throughput, clustering, or sharding a a DB. SQL & Stored Procs can also be ridiculously difficult to write, and maintain. Take that budget that you would have spent on your time doing that, and instead beef up your hardware... Remember hardware is dirt cheap, good developers are not. Good luck!