Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to deal with time-consuming server operations?

How to deal with time-consuming server operations?

Scheduled Pinned Locked Moved ASP.NET
helpquestionsysadmintutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 1033907
    wrote on last edited by
    #1

    Suppose I have a web application which accepts a small amount of data from the client (so the data transfer is not an issue), then performs some very lengthy operation (minutes or tens of minutes) on the server, and returns the result back to the user. My question is - what is the preferred method of dealing with long requests? If I use regular postback, the browser will wait for the response and time out prematurely. Increasing the timeout is not a solution, because I do not want the browser to get stuck and seem unresponsive for so long. One way I thought of is running the time-consuming operation in another thread. This way the server response is sent immediately, so there is no timeout problem. Then I use periodical page refresh to check if the thread finished its work - it displays either "Please wait" on each negative check or "Finished" with the results. The drawback of this approach is that the time intervals in which I check if the work is done are constant (say 10 secs), so even if the work happened to be very fast (finished immeditely), the user has to wait for at least 10 seconds before the first check requst is sent. Is there any way the server itself can inform when the operation is finished? Any help regarding this matter is appreciated, I suppose this must be a well-known issue so I'll be happy if you just point me the right way. H

    N B I 3 Replies Last reply
    0
    • M Member 1033907

      Suppose I have a web application which accepts a small amount of data from the client (so the data transfer is not an issue), then performs some very lengthy operation (minutes or tens of minutes) on the server, and returns the result back to the user. My question is - what is the preferred method of dealing with long requests? If I use regular postback, the browser will wait for the response and time out prematurely. Increasing the timeout is not a solution, because I do not want the browser to get stuck and seem unresponsive for so long. One way I thought of is running the time-consuming operation in another thread. This way the server response is sent immediately, so there is no timeout problem. Then I use periodical page refresh to check if the thread finished its work - it displays either "Please wait" on each negative check or "Finished" with the results. The drawback of this approach is that the time intervals in which I check if the work is done are constant (say 10 secs), so even if the work happened to be very fast (finished immeditely), the user has to wait for at least 10 seconds before the first check requst is sent. Is there any way the server itself can inform when the operation is finished? Any help regarding this matter is appreciated, I suppose this must be a well-known issue so I'll be happy if you just point me the right way. H

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      This is the type of operation ajax was meant to handle. You can display some type of progress indicator on the page while waiting for the response with no need to continually refresh the page.


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • M Member 1033907

        Suppose I have a web application which accepts a small amount of data from the client (so the data transfer is not an issue), then performs some very lengthy operation (minutes or tens of minutes) on the server, and returns the result back to the user. My question is - what is the preferred method of dealing with long requests? If I use regular postback, the browser will wait for the response and time out prematurely. Increasing the timeout is not a solution, because I do not want the browser to get stuck and seem unresponsive for so long. One way I thought of is running the time-consuming operation in another thread. This way the server response is sent immediately, so there is no timeout problem. Then I use periodical page refresh to check if the thread finished its work - it displays either "Please wait" on each negative check or "Finished" with the results. The drawback of this approach is that the time intervals in which I check if the work is done are constant (say 10 secs), so even if the work happened to be very fast (finished immeditely), the user has to wait for at least 10 seconds before the first check requst is sent. Is there any way the server itself can inform when the operation is finished? Any help regarding this matter is appreciated, I suppose this must be a well-known issue so I'll be happy if you just point me the right way. H

        B Offline
        B Offline
        Brij
        wrote on last edited by
        #3

        One another way apart from Ajax as suggested by Mark, you can use Asp.Net callback to get the better response time.

        Cheers!! Brij

        1 Reply Last reply
        0
        • M Member 1033907

          Suppose I have a web application which accepts a small amount of data from the client (so the data transfer is not an issue), then performs some very lengthy operation (minutes or tens of minutes) on the server, and returns the result back to the user. My question is - what is the preferred method of dealing with long requests? If I use regular postback, the browser will wait for the response and time out prematurely. Increasing the timeout is not a solution, because I do not want the browser to get stuck and seem unresponsive for so long. One way I thought of is running the time-consuming operation in another thread. This way the server response is sent immediately, so there is no timeout problem. Then I use periodical page refresh to check if the thread finished its work - it displays either "Please wait" on each negative check or "Finished" with the results. The drawback of this approach is that the time intervals in which I check if the work is done are constant (say 10 secs), so even if the work happened to be very fast (finished immeditely), the user has to wait for at least 10 seconds before the first check requst is sent. Is there any way the server itself can inform when the operation is finished? Any help regarding this matter is appreciated, I suppose this must be a well-known issue so I'll be happy if you just point me the right way. H

          I Offline
          I Offline
          i gr8
          wrote on last edited by
          #4

          Place a application state value at the end of the process(long execution) check if there is a entry in AppValue, If it is so then the process should be completed. and take the user to corresponding page

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups