Tim Muller wrote:
On Thursday 14 November 2002 12:53, Ron Arts wrote: Hi,I've written a simple multithreaded server application for inhouse use. This server accepts connections, asks for user and password a la the POP-3 protocol, and accepts an XML data file for upload. (snip) gnet_conn_readline (conn, NULL, 1024, 30000); (snip) case GNET_CONN_STATUS_READ: { readline, save to file.... Everything works fine, but performance is really terrible, even a 256KB file takes a full minute, while CPU load goes to 100%. If I connect an strace to the server I see: read(7, "t", 1) = 1 which means the input is read byte-for-byte from the network. Is this normal behaviour?I think the problem might be that you are using gnet_conn_readline().I would use gnet_conn_readany() with a buffer (not too small!). The drawback is that you have to assemble the pieces you get yourself and check for the end-of-line character yourself, but it should be a lot faster. I've done it this way in some apps of mine, and I haven't noticed any performance problems yet.Disclaimer: I'm not a gnet hacker, I might be totally wrong ;-)
But OTOH, you might be very right, thanks for the help Tim, using readany() solved the problem. Regards, Ron Arts
Hope this helps. Cheers -Tim _______________________________________________ gnet mailing list gnet gnetlibrary org http://www.gnetlibrary.org/mailman/listinfo/gnet
-- Netland Internet Services bedrijfsmatige internetoplossingen http://www.netland.nl Kruislaan 419 1098 VA Amsterdam info: 020-5628282 servicedesk: 020-5628280 fax: 020-5628281 Catalyst (n): an alphabetical list of cats.
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature