Re: using Sleep() in server-side environment and high CPU utilization
From: Egbert Nierop \(MVP for IIS\) (egbert_nierop_at_nospam.invalid)
Date: 10/16/04
- Next message: lauricat: "output of a sql querying an access database"
- Previous message: Orlando Gondar: "Re: MailEnable on "localhost""
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 16 Oct 2004 14:18:21 +0200
"Jane S" <jane_s_2004@yahoo.com> wrote in message
news:ce39d912.0410150803.780a3f2@posting.google.com...
>I have an ASP application that performs following task:
> User submits data from ASP page, ASP page calls VB6 component that
> creates a file based on user input and then calls external program
> (call it "P1") to send that file to back-end via TCP/sockets.
> Component waits for some time (about 20 sec) and checks whether output
> file was generated by external process "P1". Then component reads the
> output file, generates response for ASP page and displays that result
> to the end-user in the browser.
> While external process "P1" is working, I use Sleep() function in VB
> component to wait for file generation.
Hi,
You should never use sleep. However, sleep does not use CPU cycles, EACH
thread from the threadpool and that is not so much, SHOULD not be 'locked'
because your scalability can become nill.
It's better to use message queue for asynchronuous traffic or simply use
SOAP or use a .ASP postback request (which should included a generated key
that has been sent and should be received) which is bound to a sql server
database table (this last one might be the easiest for the moment for you).
> Webserver is Windows 2000 with IIS 5.
>
> Customer experiences high CPU utilization, system gets slow and
> eventually hangs...
>
> I was suggested that using Sleep() in server-side environment is a bad
> idea. And 20 seconds of Sleep is too long.
>
> Why is using Sleep() such a bad idea? I thought Sleep() actually
> releases CPU time for given thread letting other threads work... What
> is the reasonable time to Sleep? What alternative to Sleep() can I
> use? Remember, I need to keep browser session open to be able to
> display result to the user after output file is generated by external
> process...
There are better tricks. As above. The browser can do a 'refresh' using
jscript which checks if the transaction is complete. During the wait, an
animated gif is shown. But in no case, you should 'lock' a page while you
wait for x seconds.
> I would appreciate any help,
> Thanks a lot.
- Next message: lauricat: "output of a sql querying an access database"
- Previous message: Orlando Gondar: "Re: MailEnable on "localhost""
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|