Performance Test of group UDP

Source: Internet
Author: User
As mentioned in the previous article, the number of requests processed by a single server is nearly 25 thousand (Microsoft's data is up to/second ]. Performance testing of IIS and ASP. NET with requests per second

Another option is UDP. Although it is not reliable, the speed is definitely good.

1. Standard UDP Performance

Use C/C #/Java on Dell 1950/Windows 2003, with a bandwidth of Mbps.
Performance: 60 bytes of data, 10 thousand/second

Use multipleProgramTo run the same result. Does windows have limits on UDP speed?

2. rawsocket + UDP
C # Write, performance up to 40 thousand/second

3. rawsocket + IP
C write, performance up to 80 thousand/second

5. c ++Code:

Some code on the internet is too poorly written. At least there should be no low-level errors. The size calculation of IP/udp headers is incorrect and harmful.
Http://www.experts-exchange.com/Programming/Languages/CPP/Q_20372735.html
1. struct udpheader * udph = (struct udpheader *) (datasync + (4*4); // 4*4 problematic, it should be 20
2. iph-> ip_len = sizeof (struct ipheader) + sizeof (struct udpheader); // htons should be added
3. checksum can be left empty

5. C # code:

String ipstring = "192.168.1.14 ";

Socket S = new socket (addressfamily. InterNetwork, sockettype. Raw, protocoltype. UDP );

IPaddress remoteip = IPaddress. parse (ipstring );

Int I = 0;

// While (true)
{

String MSG = string. Format (format, I ++, datetime. Now );

Byte [] B = encoding. ASCII. getbytes (MSG );

Byte [] newb = new byte [B. Length + 8];

B. copyto (NEWB, 8 );
Int src_prt = 6000;
Int dest_port = 1112;
Int tot_len = newb. length;

NEWB [0] = (byte) (src_prt/256 );

NEWB [1] = (byte) (src_prt % 256 );

NEWB [2] = (byte) (dest_port/256 );

NEWB [3] = (byte) (dest_port % 256 );

NEWB [4] = (byte) (tot_len/256 );

NEWB [5] = (byte) (Fig % 256 );

NEWB [6] = 0;

NEWB [7] = 0;

S. sendto (NEWB, new ipendpoint (remoteip, dest_port ));
}

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.