Re: Unmatched speed of socket sending and receiving
- From: Willem <willem@xxxxxxxx>
- Date: Fri, 28 Sep 2007 13:27:01 +0000 (UTC)
Yao wrote:
) We write java program to send some data out by socket, and write C
) program receive these data from socket. The java program is
) multithreaded, and send a lot of number of data by socket, while C
) program is single-threaded.
)
) Every time, C program reads data from socket, unpack them, and insert
) these data into some lists to maintain them. The speed of receiver (C
) program) is not matched to Java program, so the C program slows down the
) execution of Java program, because C program could NOT read the data
) from socket as soon as possible.
)
) The local buffer has been used in Java program. Before send data by
) socket, they are saved in local buffer at first, and send them together
) when buffer is full.
)
) How could I improve the performance of C program here? Does it help if
) I write this C program in a multhreaded way? Thanks for your advice.
Assuming that the C code in itself is reasonably near optimal, then the
only place to improve performance would be when the C program is waiting
for something (writes to disk, for example, or reading from sockets).
If the C program is burning 100% CPU, then the only way to improve would
be to improve the processing speed itself.
This can be easily checked by looking at the C program's CPU usage.
By the way, if the two are running on the same processor, then of course
you have the problem that they are contending for the same CPU resource,
which makes for a lot more issues.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.
- Prev by Date: Re: Unmatched speed of socket sending and receiving
- Next by Date: Free E-BOOKS!!
- Previous by thread: Re: Unmatched speed of socket sending and receiving
- Next by thread: Free E-BOOKS!!
- Index(es):
Relevant Pages
|