W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2002

RE: post.c too slow due to select() sleeping in event loop - what to do?

From: Fred Covely <fcovely@bcftech.com>
Date: Tue, 12 Mar 2002 10:48:16 -0500 (EST)
To: "Wells, Charles" <cwells@rational.com>, <www-lib@w3.org>
Message-ID: <NDBBIGEEOLAKIPFCDMLNCEMBHLAA.fcovely@bcftech.com>
Here you go:

http://lists.w3.org/Archives/Public/www-lib/1999OctDec/0103.html



Fred Covely
BCF Technology
fcovely@bcftech.com
(B)760-631-8157
(C)760-717-9689

-----Original Message-----
From: www-lib-request@w3.org [mailto:www-lib-request@w3.org]On Behalf Of
Wells, Charles
Sent: Monday, March 11, 2002 10:16 AM
To: 'www-lib@w3.org'
Subject: post.c too slow due to select() sleeping in event loop - what
to do?


The example "post.c" is taking way to long to execute (at least on Unix
anyway).  I sort of know the reason for this, but not the best solution.
The HTEventList_loop function is calling the select function with a time
value, and the system is going to sleep for a second.  The servlet on the
server-side is trying to read from its input stream (i.e. the data sent from
the client), and the read function waits for a second while the client gets
around to waking up and sending the data.

Now, if I just write an HTML file like this:

<html>
<form action="http://thehostname:8080/examples/servlet/TroubleShooter"
method="post">
<input type=submit value="Submit">
<input type=hidden name=thename value="Bunch of junk">
</form>
</html>

and I open that in IE and press the submit button, that same server handles
the post almost instantly.  post.c is similar to this HTML's functionality,
except that it takes too long to execute.

I don't really care about post.c except that I am patterning my own code
after post.c, and that file sufficiently demonstrates this problem.  My
code, however, won't prompt for a filename and it will keep making requests
for the life of the application (i.e. the terminate_handler will not exit
the application after the first request).

What's the best way to make post.c fast?  Should I try synchronous instead
of asynchronous (haven't got that to work yet)?  Do I need to write my own
event loop?  Surely others on the list must have solved this, because this
default behavior is unusably slow (yes, 1 second is unusably slow if you are
trying to do thousands of requests using SOAP or something similar).

Thanks.
Received on Wednesday, 13 March 2002 12:05:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:40 GMT