TCP Offloading again?!

Published Jan 15 2019 12:42 PM 2,859 Views
Microsoft
First published on MSDN on Feb 21, 2010

I have spent probably hundreds of hours on cases involving TCP Offloading and I know most of the signs (intermittent dropped connections, missing traffic in network traces).  However, I have to admit I got burned by it the other day and spent several more hours working an issue than I should have.

I was working on a server-down case for a financial trading company (in other words, large dollars involved every minute they were down) where the customer was experiencing slow connections to SQL Server.  The customer reported only some Linux ODBC clients were impacted.  Based on that description, we started looking at the client side.  However, we soon discovered that, while there was no detectable correlation between the clients, the problem was only visible going to a specific SQL Server instance.  The affected clients had no problem communicating with other instances of SQL Server.  Based on this, we started focusing on the SQL Server machine itself.

From the client application’s perspective, every query was taking roughly five seconds longer than expected.  Therefore, we collected a PSSDiag and looked at the performance of the SQL Server machine as a whole.  The Profiler traces showed that there was no delay inside SQL Server:

So, where were the five seconds coming from?

The next step was to look at a network trace:

Check out the two sets of timestamps circled.  Both of them had a five second delta!  Now we had physical proof of the problem, but we still don’t have a reason…

Then, I noticed something that turned out to be the key – the five second delay was always between the data sent from the client and the server’s response to that data.  That clinched the fact that this was a server-side is 100%.  I couldn’t explain yet why only some clients were impacted, but this was definitely a server-side issue.  The other interesting thing to notice above is that the delay is even visible on the login!  This was completely surprising because this customer was using SQL Authentication.  That is a highly optimized query which should never have performance issues.  This, combined with the fact that the subsequent query wasn’t showing up inside SQL Server as being delayed caused me to start thinking about things outside of SQL Server.

The next thing to check was for filter drivers that might have inserted themselves in the TCP stack – antivirus, firewall, NIC teaming, etc.  Unfortunately, nothing like this was installed so there were no clues there.  We also reconfirmed that TCP Chimney was turned off at the OS level. And then it hit me…NIC level TCP Offloading!!!

We pulled up the Ethernet adapter settings (Network Connections –> LAN XXX –> Properties –> Configure –> Advanced) and saw something that looked like this:

Lo and behold – TCP Offloading was enabled!

We disabled all of the Offloading settings, clicked OK and performance was back to normal.  Connections were fast and query results were returning right after SQL Server generated them.  I should point out that we didn’t take a stepwise approach here because this customer was losing large amounts of money every minute this system was down.  In a less critical issue, it would be worth doing each setting one at a time and testing in between.  In addition, I would also recommend that you go back after the fact and test enabling each setting to see if there is a negative impact.  There are some non-trivial performance benefits to be gained from these settings if everything is working properly.

We never did figure out why only some clients were impacted since all of the clients were using the same driver.  Nor where we able to figure out why only this SQL Server instance was impacted when several other SQL Server machines were configured the same way at the driver level.

The moral of the story?  I need to update my standard steps for capturing network traces to include NIC level TCP Offload settings!

As of this morning, my first four steps for capturing a network trace now look like this:

1a. Turn off TCP Chimney if any of the machines are Windows 2003
Option 1) Bring up a command prompt and execute the following:
Netsh int ip set chimney DISABLED
Option 2) Apply the Scalable Networking Patch -
http://support.microsoft.com/default.aspx?scid=kb;EN-US;936594

1b. Confirm that TCP Chimney is turned off if any of the machines are Windows 2008 (see http://support.microsoft.com/default.aspx/kb/951037 for more details)
a) bring up a command prompt and execute the following:
netsh int tcp show global
b) if it turns out TCP Chimney is on disable it
netsh int tcp set global chimney=disabled

2.  Turn of TCP Offloading/Receive Side-Scaling/TCP Large Send Offload at the NIC driver level

3.  Retry your application.  Don't laugh - many, many problems are resolved by the above changes.

Evan Basalik | Senior Support Escalation Engineer | Microsoft SQL Server Escalation Services

%3CLINGO-SUB%20id%3D%22lingo-sub-315974%22%20slang%3D%22en-US%22%3ETCP%20Offloading%20again%3F!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-315974%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Feb%2021%2C%202010%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EI%20have%20spent%20probably%20hundreds%20of%20hours%20on%20cases%20involving%20TCP%20Offloading%20and%20I%20know%20most%20of%20the%20signs%20(intermittent%20dropped%20connections%2C%20missing%20traffic%20in%20network%20traces).%26nbsp%3B%20However%2C%20I%20have%20to%20admit%20I%20got%20burned%20by%20it%20the%20other%20day%20and%20spent%20several%20more%20hours%20working%20an%20issue%20than%20I%20should%20have.%3C%2FP%3E%0A%20%20%3CP%3EI%20was%20working%20on%20a%20server-down%20case%20for%20a%20financial%20trading%20company%20(in%20other%20words%2C%20large%20dollars%20involved%20every%20minute%20they%20were%20down)%20where%20the%20customer%20was%20experiencing%20slow%20connections%20to%20SQL%20Server.%26nbsp%3B%20The%20customer%20reported%20only%20some%20Linux%20ODBC%20clients%20were%20impacted.%26nbsp%3B%20Based%20on%20that%20description%2C%20we%20started%20looking%20at%20the%20client%20side.%26nbsp%3B%20However%2C%20we%20soon%20discovered%20that%2C%20while%20there%20was%20no%20detectable%20correlation%20between%20the%20clients%2C%20the%20problem%20was%20only%20visible%20going%20to%20a%20specific%20SQL%20Server%20instance.%26nbsp%3B%20The%20affected%20clients%20had%20no%20problem%20communicating%20with%20other%20instances%20of%20SQL%20Server.%26nbsp%3B%20Based%20on%20this%2C%20we%20started%20focusing%20on%20the%20SQL%20Server%20machine%20itself.%3C%2FP%3E%0A%20%20%3CP%3EFrom%20the%20client%20application%E2%80%99s%20perspective%2C%20every%20query%20was%20taking%20roughly%20five%20seconds%20longer%20than%20expected.%26nbsp%3B%20Therefore%2C%20we%20collected%20a%20PSSDiag%20and%20looked%20at%20the%20performance%20of%20the%20SQL%20Server%20machine%20as%20a%20whole.%26nbsp%3B%20The%20Profiler%20traces%20showed%20that%20there%20was%20no%20delay%20inside%20SQL%20Server%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66360i5A01D61F76ED388C%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3ESo%2C%20where%20were%20the%20five%20seconds%20coming%20from%3F%3C%2FP%3E%0A%20%20%3CP%3EThe%20next%20step%20was%20to%20look%20at%20a%20network%20trace%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66361iEE7C1BDAA58BEFF3%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3ECheck%20out%20the%20two%20sets%20of%20timestamps%20circled.%26nbsp%3B%20Both%20of%20them%20had%20a%20five%20second%20delta!%26nbsp%3B%20Now%20we%20had%20physical%20proof%20of%20the%20problem%2C%20but%20we%20still%20don%E2%80%99t%20have%20a%20reason%E2%80%A6%3C%2FP%3E%0A%20%20%3CP%3EThen%2C%20I%20noticed%20something%20that%20turned%20out%20to%20be%20the%20key%20%E2%80%93%20the%20five%20second%20delay%20was%20always%20between%20the%20data%20sent%20from%20the%20client%20and%20the%20server%E2%80%99s%20response%20to%20that%20data.%26nbsp%3B%20That%20clinched%20the%20fact%20that%20this%20was%20a%20server-side%20is%20100%25.%26nbsp%3B%20I%20couldn%E2%80%99t%20explain%20yet%20why%20only%20some%20clients%20were%20impacted%2C%20but%20this%20was%20definitely%20a%20server-side%20issue.%26nbsp%3B%20The%20other%20interesting%20thing%20to%20notice%20above%20is%20that%20the%20delay%20is%20even%20visible%20on%20the%20login!%26nbsp%3B%20This%20was%20completely%20surprising%20because%20this%20customer%20was%20using%20SQL%20Authentication.%26nbsp%3B%20That%20is%20a%20highly%20optimized%20query%20which%20should%20never%20have%20performance%20issues.%26nbsp%3B%20This%2C%20combined%20with%20the%20fact%20that%20the%20subsequent%20query%20wasn%E2%80%99t%20showing%20up%20inside%20SQL%20Server%20as%20being%20delayed%20caused%20me%20to%20start%20thinking%20about%20things%20outside%20of%20SQL%20Server.%3C%2FP%3E%0A%20%20%3CP%3EThe%20next%20thing%20to%20check%20was%20for%20filter%20drivers%20that%20might%20have%20inserted%20themselves%20in%20the%20TCP%20stack%20%E2%80%93%20antivirus%2C%20firewall%2C%20NIC%20teaming%2C%20etc.%26nbsp%3B%20Unfortunately%2C%20nothing%20like%20this%20was%20installed%20so%20there%20were%20no%20clues%20there.%26nbsp%3B%20We%20also%20reconfirmed%20that%20TCP%20Chimney%20was%20turned%20off%20at%20the%20OS%20level.%20And%20then%20it%20hit%20me%E2%80%A6NIC%20level%20TCP%20Offloading!!!%3C%2FP%3E%0A%20%20%3CP%3EWe%20pulled%20up%20the%20Ethernet%20adapter%20settings%20(Network%20Connections%20%E2%80%93%26gt%3B%20LAN%20XXX%20%E2%80%93%26gt%3B%20Properties%20%E2%80%93%26gt%3B%20Configure%20%E2%80%93%26gt%3B%20Advanced)%20and%20saw%20something%20that%20looked%20like%20this%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66362i09BC803F8D851D25%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3ELo%20and%20behold%20%E2%80%93%20TCP%20Offloading%20was%20enabled!%3C%2FP%3E%0A%20%20%3CP%3EWe%20disabled%20all%20of%20the%20Offloading%20settings%2C%20clicked%20OK%20and%20performance%20was%20back%20to%20normal.%26nbsp%3B%20Connections%20were%20fast%20and%20query%20results%20were%20returning%20right%20after%20SQL%20Server%20generated%20them.%26nbsp%3B%20I%20should%20point%20out%20that%20we%20didn%E2%80%99t%20take%20a%20stepwise%20approach%20here%20because%20this%20customer%20was%20losing%20large%20amounts%20of%20money%20every%20minute%20this%20system%20was%20down.%26nbsp%3B%20In%20a%20less%20critical%20issue%2C%20it%20would%20be%20worth%20doing%20each%20setting%20one%20at%20a%20time%20and%20testing%20in%20between.%26nbsp%3B%20In%20addition%2C%20I%20would%20also%20recommend%20that%20you%20go%20back%20after%20the%20fact%20and%20test%20enabling%20each%20setting%20to%20see%20if%20there%20is%20a%20negative%20impact.%26nbsp%3B%20There%20are%20some%20non-trivial%20performance%20benefits%20to%20be%20gained%20from%20these%20settings%20if%20everything%20is%20working%20properly.%3C%2FP%3E%0A%20%20%3CP%3EWe%20never%20did%20figure%20out%20why%20only%20some%20clients%20were%20impacted%20since%20all%20of%20the%20clients%20were%20using%20the%20same%20driver.%26nbsp%3B%20Nor%20where%20we%20able%20to%20figure%20out%20why%20only%20this%20SQL%20Server%20instance%20was%20impacted%20when%20several%20other%20SQL%20Server%20machines%20were%20configured%20the%20same%20way%20at%20the%20driver%20level.%3C%2FP%3E%0A%20%20%3CP%3EThe%20moral%20of%20the%20story%3F%26nbsp%3B%20I%20need%20to%20update%20my%20standard%20steps%20for%20capturing%20network%20traces%20to%20include%20NIC%20level%20TCP%20Offload%20settings!%3C%2FP%3E%0A%20%20%3CP%3EAs%20of%20this%20morning%2C%20my%20first%20four%20steps%20for%20capturing%20a%20network%20trace%20now%20look%20like%20this%3A%3C%2FP%3E%0A%20%20%3CP%3E%3CEM%3E%201a.%20Turn%20off%20TCP%20Chimney%20if%20any%20of%20the%20machines%20are%20Windows%202003%20%3CBR%20%2F%3E%20Option%201)%20Bring%20up%20a%20command%20prompt%20and%20execute%20the%20following%3A%20%3CBR%20%2F%3E%20Netsh%20int%20ip%20set%20chimney%20DISABLED%20%3CBR%20%2F%3E%20Option%202)%20Apply%20the%20Scalable%20Networking%20Patch%20-%20%3C%2FEM%3E%20%3CA%20href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B936594%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20%3CEM%3E%20http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B936594%3C%2FEM%3E%3C%2FA%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CEM%3E%201b.%20Confirm%20that%20TCP%20Chimney%20is%20turned%20off%20if%20any%20of%20the%20machines%20are%20Windows%202008%20(see%20%3C%2FEM%3E%20%3CA%20href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%2Fkb%2F951037%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20%3CEM%3E%20http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%2Fkb%2F951037%20%3C%2FEM%3E%20%3C%2FA%3E%20%3CEM%3E%20for%20more%20details)%20%3CBR%20%2F%3E%20a)%20bring%20up%20a%20command%20prompt%20and%20execute%20the%20following%3A%20%3CBR%20%2F%3E%20netsh%20int%20tcp%20show%20global%20%3CBR%20%2F%3E%20b)%20if%20it%20turns%20out%20TCP%20Chimney%20is%20on%20disable%20it%20%3CBR%20%2F%3E%20netsh%20int%20tcp%20set%20global%20chimney%3Ddisabled%3C%2FEM%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CEM%3E%202.%26nbsp%3B%20Turn%20of%20TCP%20Offloading%2FReceive%20Side-Scaling%2FTCP%20Large%20Send%20Offload%20at%20the%20NIC%20driver%20level%20%3C%2FEM%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CEM%3E%203.%26nbsp%3B%20Retry%20your%20application.%26nbsp%3B%20Don't%20laugh%20-%20many%2C%20many%20problems%20are%20resolved%20by%20the%20above%20changes.%20%3C%2FEM%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CEM%3E%20%3C%2FEM%3E%3C%2FP%3E%0A%20%20%3CP%3EEvan%20Basalik%20%7C%20Senior%20Support%20Escalation%20Engineer%20%7C%20Microsoft%20SQL%20Server%20Escalation%20Services%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-315974%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Feb%2021%2C%202010%20I%20have%20spent%20probably%20hundreds%20of%20hours%20on%20cases%20involving%20TCP%20Offloading%20and%20I%20know%20most%20of%20the%20signs%20(intermittent%20dropped%20connections%2C%20missing%20traffic%20in%20network%20traces).%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-315974%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Econnectivity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 15 2019 12:42 PM
Updated by: