Thursday, October 15, 2009

High CPU in ASP.NET - Finding Large DataTables with the Public SOS

This is yet another one strictly for the dump analysis crowd – what can I say, it’s been a long week! Last episode, we highlighted the lack of support for many useful windbg commands. Well, chief among these was the DumpDataTables command that provides a nice summary of the largest tables and their column counts, typically a nice starting point for high-memory/high-CPU issues in traditional application. So how do we fend for ourselves and reproduce this with the SOS that we have?

Some very helpful support engineers that I’ve been working with over the last few weeks offered the following as a potential substitute:

   1: $$ Run as $><C:\Extensions\DumpLargeTables.txt
   3: .printf "\n===== Printing Large datatables with 1000+ rows with their column names =====\n\n"
   5: .foreach(m_table {!dumpheap -type System.Data.DataTable -short})
   6: {
   7:     .foreach (m_Count {!dumpfield -field nextRowID m_table})
   8:     {
   9:          $$ Change the value of row count here
  10:         .if( ${m_Count} > 1000)
  11:         {
  12:             .printf "Table Name : "; .printf /D "<?dml?><exec cmd=\"!do ${m_table}\">${m_table}</exec> - "
  13:             !dumpfield -field tableName -string ${m_table} 
  14:             .printf " Row Count : ${m_Count}"
  15:             .printf "\t|---Columns\n";
  17:             .foreach(m_col {!dumpheap -type System.Data.DataColumn -short})
  18:             {
  19:                 r @$t2 = poi(${m_col}+0x3c)
  20:                 .if(@$t2 == ${m_table})
  21:                 {
  22:                     .printf /D "\t\t|-- <?dml?><exec cmd=\"!do ${m_col}\">${m_col}</exec> - ";
  23:                     !dumpfield -field _columnName -string m_col
  24:                 }
  25:             }
  26:             .printf "\n";
  27:         }
  28:     }
  29: }

Unfortunately, this too relies on a command (!dumpfield) that is also not available in the public SOS.

Through some collaborative trial-and-error, we then came up with the following work-around for accessing the nextRowID field using its offset, in a manor supported by the public SOS:

   1: .foreach (DT {!dumpheap -mt 65242d0c -short}){.echo ${DT};?poi(${DT}+0xd0)}

…which gives you something to work with if you drop it in excel and sort it (original addresses removed):

   1: Evaluate expression: 14 = 0000000e
   2: Evaluate expression: 3 = 00000003
   3: Evaluate expression: 20 = 00000014
   4: Evaluate expression: 29 = 0000001d
   5: Evaluate expression: 11 = 0000000b
   6: Evaluate expression: 28 = 0000001c
   7: Evaluate expression: 1 = 00000001
   8: Evaluate expression: 1 = 00000001

To be version/Method-Table agnostic, I tried the following, which should be comparable to the one above:

   1: .foreach (DT {!dumpheap –type System.Data.DataTable -short}){?poi(${DT}+0xd0)}

…but I see some strange results with the latter, so find your method tables and work from there.

How to read this (we’re simply using the POI function to read the address + offset for nextRowId - d0):

   1: 0:026> !do 0x02c671cc 
   2: Name: System.Data.DataTable
   3: MethodTable: 65242d0c
   4: EEClass: 6515da18
   5: Size: 296(0x128) bytes
   6: GC Generation: 2
   7: (C:\WINDOWS\assembly\GAC_32\System.Data\\System.Data.dll)
   8: Fields:
   9:       MT    Field   Offset                 Type VT     Attr    Value Name
  10: 7a5d2a58  40009a3        4 ...ponentModel.ISite  0 instance 00000000 site
  11: 7a5ecd2c  40009a4        8 ....EventHandlerList  0 instance 00000000 events
  12: 7933061c  40009a2      1e4        System.Object  0   shared   static EventDisposed
  13: 65244194  40007a5        c  System.Data.DataSet  0 instance 00000000 dataSet
  14: 6524534c  40007a6       10 System.Data.DataView  0 instance 02c682d0 defaultView
  15: 79332c4c  40007a7       d0         System.Int32  1 instance        3 nextRowID
  16: 65245798  40007a8       14 ...DataRowCollection  0 instance 02c674d8 rowCollection
  17: 652456b8  40007a9       18 ...aColumnCollection  0 instance 02c67388 columnCollection
  18: 65245728  40007aa       1c ...straintCollection  0 instance 02c674a0 constraintCollection
  19: 79332c4c  40007ab       d4         System.Int32  1 instance        2 elementColumnCount
  20: 65244b08  40007ac       20 ...elationCollection  0 instance 02c6845c parentRelationsCollection
  21: 65244b08  40007ad       24 ...elationCollection  0 instance 02c683f8 childRelationsCollection


[1] –

[2] –

[3] –


journalism dissertation samples said...

I would like to express gratitude you for the attempts you have made in writing this blog post Finding Large DataTables with the Public SOS. I am hoping the same most outstanding work from you in the future as well.

kevin styris said...

Are you surf riding getting some reasonably bills that will can’t wait till your current following day enhance arrives? Unit of activity you embedded through associate unforeseen automobile deal with? For by any suggests that out of the payday loans blue imperative state of affairs you’re experiencing, associate advance day loan will enable you to induce the funds you may be wanting swiftly! typically, the whole work typically takes merely 10 minutes or perhaps manner less.

Patti E. Shuff said...

Absent higher delinquency, the extra credit ranking score from payday enhance advances economical loan lenders does not fit our definition of aggressive." The caveat to this is that with an expression of under 1 1 month there are no payments, and the lender is more than willing to shift the cost-effective economical payday loans direct lender loan over at the end of the interval upon deal of another fee.

Erica Sally said...

911 Cash Mortgage loan company evaluation concentrates on that they are not a loan company. They are a relevant assistance that can help you find out a loan company from amongst the record of lending alternatives that auto title loans fresno belongs to their network of lenders.

Patti E. Shuff said...

It would be sensible to analyze out the contract before deciding upon up or else repent at leisure. Lenders according to law must reveal this details to you so that you will not be staying out in the dark. Full disclosure It would be sensible to analyze out the contract before deciding upon up or else repent at leisure. Lenders according to law must reveal this details to you so that you will not be staying out in the dark. Full bad credit payday loans disclosure gives you the complete right as client. gives you the complete right as client.

title loan mobile said...

. A typical debate among the personal sector is actually in which, these kinds of lending options eat up the particular property of individuals with lower income, by means of asking for higher rates.

car title loans huntsville said...

You oblige a credit in a blaze, yet are so unassuming it would be immense ask relatives or partners, and are frightened of the examination material included in a bank advance. Shed every one of your tensions, for help is a mouse click away as payday credits

jhon romeo said...

the estimation of the vehicle is to an incredible degree basic and an evaluation will be done by advance master gave appraiser. The vehicle title advance moneylender will require your vehicle on the premises in order to process the application.Cash Advance San-diego

Check Cashing said...

However, that should be noted that will for you to retrieve a worthwhile deal is an art alone that will an individual can learn and reap the benefits of acquiring the proper foreclosed residence after increasing the data around the right options to search for this foreclosed residence of course. said...

Once you get the pay, the mortgage might be given back. If you cann't pay the mortgage sum furthermore lender's expenses with regard to cash advance on your pay day, you'll be able to rollover the mortgage sum by paying out additional charges towards the loan provider furthermore you must pay out the eye in conjunction with with the rollover time period.

Sagheni Sagheni said...

vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax vimax

Sagheni Sagheni said...

vimax asli
vimax canada
pembesar penis
obat pembesar penis
obat perangsang wanita
obat sipilis
obat perangsang wanita

adrita nirmitishonga said...

The overall bit of payday credits are open on the web, so there is no deferral with faxing or posting of reports. The application system is energetic and easy to wrap up. You will be asked for your name, area, experiences about your month to month pay and occupation, when your next payday is, nearby the whole you wish to secure and your record purposes of diversion. title loan huntsville

sojib hossain said...

That method is to a surprising degree direct; however the likelihood of getting a colossal measure of trade in for spendable dough a section second is staggeringly low. The likelihood of getting moment money at your touching vehicles advance association is to an extraordinary degree high. Check Cashing San-diego

Ayon Khan said...

The utilization of "Expressed Income" (no assessment forms and no pay confirmation) business advances is a discriminating procedure to maintain a strategic distance from a few business land credit issues. A few illustrations of the most major issues are given in this article. Not very many conventional banks utilization Stated Income for a business advance, so this vital business contract methodology will be discovered essentially at non-customary business loan specialists. car title loans chicago

JON said...

You ought to offer your at initially saw at this very moment. Payday advances may have every one of the stores of being striking in the short run and you may get minute fulfillment and even a surge when you comprehend that exchange or see it in for nippy hard cash your money related change however over the whole game plan it is a race that distinctive can't win. said...

A couple of affiliations will keep trying and aggregate from you in spite of this so I have another proposal if this happens. In the event that you get arranged social gathering hollers toward you have taught them about your commitment mix you have to fax and/or send them an unfilled it letter. Cash Advance San-diego

sojib hossain said...

One thing that I did was to change into a segment for payday advance affiliations so that I could get paid from particular people getting payday credits. A few people are just going to get them so there is no inspiration driving why you shouldn't get paid from the technique that made you pay to such a degree.
auto title loans

peninggi badan said...

cream ajaib
cream kuda hitam
suplemen herbal

adrita nirmitishonga said...

Not just could your vehicle be repossessed on the off chance that you were not organized to reimburse the credit, yet you moreover may not be met all essentials for impact that the moneylender made on the offer of your vehicle Payday Loans San-diego