Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

When connecting to a SQL Server 2008 R2 from a .NET 4 client application on a different server in the same LAN, one can set three different network protocols:

  1. TCP
  2. Named Pipes
  3. Don't set anything in the connection string and use the default

What is best practice? What to choose?

Additional information: Both TCP and Named Pipes are enabled both on the server and on the client. The application is using database mirroring. Client and server communicate over a fast LAN.

We are investigating this because we have rare and spurious connectivity and timeout problems. (But regardless of that I'd like to know the best practice).

There is an article on this subject on MSDN but it is very generic and vague. It does not advise or recommend anything useful.

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

I prefer TCP/IP over Named Pipes, even though in most situations there will be no noticeable difference. You can do this by adjusting the protocols supported by the instance in SQL Server Configuration Manager rather than hard-coding things in your connection string (this makes it easier to make changes or to troubleshoot).

Essentially the routing and other overhead involved with named pipes (unless your apps are on the same machine as SQL Server, in which case there is only a little extra overhead) make it the less efficient option, especially at scale, in a slower network environment (100MB or less), or if your workloads come in bursts.

If your apps are on the same box as SQL Server, you should also keep shared memory in mind - if you have applications on the SQL Server box directly communicating with SQL Server, this is going to be the most efficient option.

You can read about the performance advantages of TCP/IP in more detail.

share|improve this answer
    
Thanks for the elaboration !!!! –  JP Chauhan Sep 12 '12 at 13:48
    
So it basically doesn't matter that much but it is generally preferable to go with TCP because there are no reasons to choose named pipes. Would you agree with that summary? –  usr Sep 12 '12 at 18:18
    
@usr Well, it matters when you scale, or if your network sucks. But yes, in general, there are no real benefits to choosing named pipes in any case, that I know of. –  Aaron Bertrand Sep 12 '12 at 18:30
add comment

Named Pipes protocol are useful for the application that are designed around NetBIOS or other LAN-based protocols.

Named Pipes provides easy access to Remote Procedure Calls (RPC) within a single security domain and thus is advantageous to these applications.

Usually TCP Protocol is good in practice because you don't have to care about all these on the network.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.