Advertisement

04.18.2008 at 01:47PM PDT, ID: 23335529 | Points: 500
[x]
Attachment Details

Bypassing Winsock

Tags: Microsoft, Windows, Server Standard 2k3 x64, Intel, network card, Pro 1000 MT, c#, .net 2.0
I've conducted some basic multicast sending on different platforms, different languages, etc.
C#, C++, and C on Windows, using built in .NET sockets and socket.Send(), as well as using DLLImports of the winsock library, it takes the Send() function about 15-20 microseconds to return.

C#(mono), C++ on Linux takes 1-3 microseconds to return.

This means that something inside of Windows (presumably winsock) is taking roughly 10 times as long as the same type of send method in Linux.  

How do I bypass the winsock slowness and achieve similar speeds to linux inside of windows?

I've already attempted NDIS driver and kernel calls for writefile API to write bytes to the drive but that's slower than the much simpler .Net method.

Any ideas would be very helpful.  Thank you!
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: DefyFate05
Question Asked On: 04.18.2008
Participating Experts: 2
Points: 500
Views: 0
Translate:
Loading Advertisement...
04.21.2008 at 11:18AM PDT, ID: 21404525

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 04:40PM PDT, ID: 21407078

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 04:59PM PDT, ID: 21407188

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.21.2008 at 05:07PM PDT, ID: 21407230

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 04:58AM PDT, ID: 21410034

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 06:20AM PDT, ID: 21410800

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.23.2008 at 07:07AM PDT, ID: 21420805

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 12:10PM PDT, ID: 21558267

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 05:25PM PDT, ID: 21611347

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.20.2008 at 06:08PM PDT, ID: 21611494

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
04.21.2008 at 11:18AM PDT, ID: 21404525
I just tested multicast sending on server 2008 and in terms of latency on back to back UDP sends, Server 2008 performs precisely the same as Server 2003.
 
04.21.2008 at 04:40PM PDT, ID: 21407078

Rank: Guru

Have you tried varous values for the "flags" parameter in the send() function?  
Have you tried varying the options when you create the socket?
Is it possible that you are comparing synchronous timing vs. asynchonous (non-blocking) timing?

    Asynchronous Client Socket Example
    http://msdn2.microsoft.com/en-us/library/bew39x2a(VS.71).aspx

   Winsock -- Get Closer to the Wire with High-Performance Sockets in .NET
   http://msdn2.microsoft.com/en-us/magazine/cc300760.aspx
 
04.21.2008 at 04:59PM PDT, ID: 21407188
I've tried all the flags I could find on their own an reran the tests to no performance increase avail.

I tried creating the sockets in all of the ways I could.

I am not comparing the blocking/non-blocking calls.  I am doing only synchronous calls; Fast I/O with buffered sends should result faster than Asynchronous could hope to perform.  I did build a similar UDP asynchronous sender and it was scales slower than the buffered sends.

I'll check out the "Get Closer to the Wire" article and see if it gives me any insight I didn't have previously.

Thank you.
 
04.21.2008 at 05:07PM PDT, ID: 21407230
The "Get Closer to the Wire" in unfortunately lacking in any real content.  The whole async threading pool thing they advocate comes at great costs when you're doing straight UDP to one endpoint and you do not care about receiving any data.
 
04.22.2008 at 04:58AM PDT, ID: 21410034

Rank: Guru

I've tried googling for performance comparisons between Winsock and linux without much success.  It seems to me that if Winsock was 5- to 20-times slower, then the Linux community would be laughing quite loudly.  

One thing worth trying is to run the client and server on the same box.  That would rule out a whole host of issues.  Basically the entire result would be the overhead/latency of setting up the socket (the send itself would take virtually no time).

It occurs to me that your testing techinque might be important.  If you are timing thousands of instances of sending small packets, then some underlying logic, such as the use of Nagel's Algorythm, might be at issue.
 
04.22.2008 at 06:20AM PDT, ID: 21410800
I don't have a client; Don't need one for testing.  I just have a pcap going on.

The packets are > 100 bytes so that they don't get caught in any particular register in the NIC or switch, and I'm definitely not doing any Nageling.

The setting up of the socket happens outside of the timing.

I essentially do:
{
socket creation
for(;;)
socket.send(packet)
}

So the only 'timing' is of the sending, not of any socket creation, etc.  

The hardware is precisely the same on both the linux platform and the various windows platforms I've tried.
 
04.23.2008 at 07:07AM PDT, ID: 21420805
Also, I believe the Linux community *is* laughing quite loudly.
 
05.13.2008 at 12:10PM PDT, ID: 21558267
Nobody? Anybody? Somebody?
 
05.20.2008 at 05:25PM PDT, ID: 21611347
One suggestion is to look at the LSPs installed on your system.  LSP is "layered service provider", and they are often installed as part of anti-virus and anti-spam software.  Some LSPs are poorly written and very slow.  

AFAIK, Linux does not have a counterpart to LSPs, so you might not be comparing apples to apples.

Maybe you have one of the poorly written LSPs.  Try a program like LSP-Fix (see http://www.cexx.org/lspfix.htm ) to view the installed LSPs.  Unistall them one by one, until you have a true apples-to-apples comparison.
 
05.20.2008 at 06:08PM PDT, ID: 21611494
I have nothing installed on top of windows, no AV, no nothing. The executable says "no problems found"
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628