磁盘缓存和媒体缓存
…posted by davidjmedlock:
…由 davidjmedlock 发布 :
I happened to notice this on Macromedia’s ColdFusion Developer Center today. I think the article has been out for a little while but I thought I’d post the link here for any who are interested.
我今天在Macromedia的ColdFusion开发人员中心碰巧注意到了这一点。 我认为该文章已经发布了一段时间,但我想将链接发布给任何有兴趣的人。
Caching Queries to Disk or Memory With ColdFusion
使用ColdFusion将查询缓存到磁盘或内存
This author also provides a custom tag to do all the dirty work for you. I was thinking about query caching in terms of a few things:
该作者还提供了一个自定义标签来为您完成所有肮脏的工作。 我在考虑以下方面的查询缓存:
Let’s say you have 1,000 clients or users and you build a complex, dynamic report so that user 1 logs in and views the report. In there it has something like (WHERE UserID = #UserID#) to pull the report for that user.
假设您有1,000个客户或用户,并且您构建了一个复杂的动态报告,以便用户1登录并查看该报告。 在那里,有类似(WHERE UserID =#UserID#)的内容可以为该用户提取报告。
Well, you can begin to see the problem: 1,000 users = 1,000 complex reports. If you cache those reports using cachedWithin then you’re going to murder your server quickly.
好了,您可以开始看到问题了:1,000个用户= 1,000个复杂报告。 如果您使用cachedWithin缓存这些报告,那么您将很快杀死服务器。
The disk based approach might work better, but first of all, you still have to run every query at least once. If your data changes frequently, then you’ll need to run it once every x hours, depending on how quickly your clients/users want or need the information.
基于磁盘的方法可能会更好,但是首先,您仍然必须至少运行一次每个查询。 如果您的数据经常更改,则需要每隔x个小时运行一次数据,具体取决于客户/用户希望或需要这些信息的速度。
At any rate, I’ve been dealing with a massive report at the office that pulls from all of our largest tables (some tables with a couple of million rows and growing rapidly by the second). This report causes quite a bit of strain on the system, so we’ve moved it to the backup server so that it doesn’t kill us on the live server. This works out okay because the backup server is updated every night.
无论如何,我一直在办公室处理一份庞大的报告,该报告从我们所有最大的表中提取(有些表有几百万行,而第二个表Swift增长)。 该报告对系统造成很大的压力,因此我们将其移至备份服务器,以免在实时服务器上使我们丧命。 可以这样做,因为备份服务器每晚都更新。
Well, this is all well and fine except that the report is still a monster. So, in this situation I’m taking an approach that has worked well before: build a report into a single table overnight. Then all I have to do is query one table and dump the results out on screen. It can be tedious to build the report overnight. It’ll take a good knowledge of the DBMS you’re using and the structure of your database, but it can alleviate a lot of server load during the day when you’re busiest.
好吧,除了报告仍然是一个庞然大物之外,一切都很好。 因此,在这种情况下,我将采用一种效果很好的方法:一夜之间将报告构建到一个表中。 然后,我要做的就是查询一张表并将结果转储到屏幕上。 一夜之间生成报告可能很乏味。 它将充分了解您正在使用的DBMS和数据库的结构,但是它可以在您最忙的那一天减轻很多服务器负载。
Anyway, enough of my blabber. I just thought I’d share that with you. It may make your job much easier, for those of you who deal with extremely large systems and amounts of data on a regular basis.
无论如何,我的笨拙足够了。 我只是想和你分享。 对于那些定期处理超大型系统和大量数据的人员来说,这可能使您的工作变得容易得多。
翻译自: https://www.sitepoint.com/disk-based-query-caching/
磁盘缓存和媒体缓存
相关资源:jdk-8u281-windows-x64.exe