新闻网站包含不同的部分,如TOP NEWS,BREAKING NEWS,LOCAL NEWS,MOVIE等。所有这些部分都加载了数据 [英] News website which contains different sections like TOP NEWS,BREAKING NEWS, LOCAL NEWS, MOVIE etc. All this sections are loaded with data

查看:85
本文介绍了新闻网站包含不同的部分,如TOP NEWS,BREAKING NEWS,LOCAL NEWS,MOVIE等。所有这些部分都加载了数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新闻网站,其中包含不同的部分,如热门新闻,爆炸性新闻,本地新闻,电影等。所有这些部分都是在页面加载时通过逐个串行执行许多SQL查询来加载数据。每个部分通过执行相应的sql查询从不同的表中获取数据;所以他们都是连续的形式。但是通过使用这种方法,我的网站加载时间非常长,以便完成所有这些查询。是否有任何方法可以并行执行所有这些查询并使用一次并行数据填充网站部分。所以在一个执行周期时间我需要完成整个过程而不是等待所有的串行执行周期。

I have a News website which contains different sections like TOP NEWS,BREAKING NEWS, LOCAL NEWS, MOVIE etc. All this sections are loaded with data at the time of page loading by a serial execution of many sql queries one by one. Each section get data from different tables by executing corresponding sql query; so they all in serial form. But by using this approach my website loading time is very high in order to complete all this queries. Is any way to execute all this queries parallel and fill website section with data parallel at a time. so that by a single execution cycle time I need to complete the process instead to wait all the serial execution cycles.

推荐答案

我建​​议你改变你的方法。而不是为每个页面加载查询所有这些都有一个单独的进程,它定期运行(比如15分钟左右),以便提前准备所有这些并将其保存到ASP应用程序的单独表(或单独的表)中在请求页面时读取。



编辑 - 评论后更详细:

1)构建应用程序(最好是Windows服务)但是可以是一个控制台应用程序来完成所有准备工作:查询新闻表,根据需要安排所有内容并将其保存到单独的表中,这样您的ASP应用程序基本上只需要将这些准备好的表的内容转换为页面上的HTML请求。

2)按照取决于新闻源数据更改频率的间隔运行该表准备。也许每15分钟左右。

3)你的ASP应用程序根本不需要等待页面请求:它只显示准备好的表包含的内容最后准备 - 运行。



因此,除非您目前每15分钟而不是一页请求,否则这应该减少数据库使用情况。在任何情况下,它都会加快ASP应用程序的响应时间。
I recommend to change your approach. Instead of querying all this for each pageload have a separate process which runs in regular intervals (like 15 minutes or so) in order to prepare all this ahead of time and saves it into a separate table (or separate tables) from which your ASP application reads when a page is requested.

Edit - more detailed after comment:
1) Build an application (best would be a Windows Service but could be a console application) that does all the preparational work: Query the news tables, arrange everything as required and save it into separate tables so that your ASP application basically just has to transform the contents of these prepared tables into HTML on a page request.
2) Run that table-preparation in intervals that depend on how often the news source data changes. Maybe every 15 minutes or so.
3) Your ASP application doesn't have to wait at all on a page request: It just displays what the prepared tables contain from the last preparation-run.

So, unless you currently have less than one page-request per 15 minutes, this should reduce database usage. In any case it will speed up the response time of your ASP app.


这篇关于新闻网站包含不同的部分,如TOP NEWS,BREAKING NEWS,LOCAL NEWS,MOVIE等。所有这些部分都加载了数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆