Saturday 15 August 2015

php - Server unresponsive during long running script -


I have a website on IIS 7. To better understand my problem, I will present it in a simple scenario, suppose I have two web pages, index.php and with report.php With each of the content:

index.php

  & lt ;? Php echo "Hello world"; ? & Gt;   

report.php

  & lt ;? Php sleep (60); // Simulate a long moving script like report generating? & Gt; Say  index.php  is the home page of our ecommerce system where visitors will visit and  report.php  is the page where Whenever people want to report (most likely during the day) in the management view, the problem occurs when the entire server becomes unresponsive, which takes a few minutes to see the reports. Unless the report is ready, visitors looking for  index.php  will not get any response. This is also applicable on ASP.NET. Are there any solutions for this?   

This is the iis6 & amp; 7. In essence, a new thread works with each new incoming request. So for some time a personal page will not have any effect on the processing of other pages when sleeping. I tested it using 2 pages.

page.aspx:

  & lt;% @ page language = "c #"%> & Lt;% = DateTime.Now.ToString ()% & gt;   

index.aspx:

  & lt;% @ page language = "c #"% & gt; & Lt;% = DateTime.Now.ToString ()% & gt; & Lt;% System.Threading.Thread.Sleep (10000); & Gt%;   

After being called Index.aspx, the page. Aspx can be repeatedly called & amp; Returns every request at the present time, while sleeping on request before index.aspx.

If something is requesting to block your server, it may be a shared resource used on your site. In the example above, if index.aspx requests unique access to a resource, then a file or DB is called, many requests of Page. Aspx will have to wait until index.aspx is finished. Resource released.

No comments:

Post a Comment