Official forum to discuss the performance of Networkcomms V3, first record

Source: Internet
Author: User

Www.networkcomms.net Official forum to discuss the performance of Networkcomms V3, first record

I replaced the Streamtool.write implementation with a simple synchronous version:

  Public Static DoubleWrite (Stream InputStream,LongInputstart,LongInputlength, Stream Destinationstream,intWritebuffersize,DoubleTimeoutmsperkbwrite,intMintimeoutms) {            if(InputStream = =NULL)Throw NewArgumentNullException ("Source"); if(Destinationstream = =NULL)Throw NewArgumentNullException ("Destination"); //Make sure we startInputstream.seek (Inputstart, Seekorigin.begin); intBytesRemaining = (int) Inputlength; intBufSize = Math.min ((int) inputlength, writebuffersize); byte[] buf =New byte[BufSize];  while(BytesRemaining >0)            {                intcount; if(BytesRemaining <buf. Length) Count= (int) bytesremaining; ElseCount=buf.                 Length; Inputstream.read (BUF,0, Count); Destinationstream.write (BUF,0, Count); BytesRemaining-=count; }             return 0; } 

Now the performance is fine!
First I thought the allocation of the various buffers and objects in your implmenentation are the reason, but now I suppose It ' s due to the overhead of thread/context switching from the asynchronous stream begin/end methods.
Tested it with a slightly modified version of your Examplesconsole Advandedsend example which runs now five times faster.
Send calls per second increased from the 25000 on localhost and the CPU load dropped to one third.

Official forum to discuss the performance of Networkcomms V3, first record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.