|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 4:15 AM
Points: 2,069,
Visits: 2,040
|
|
Last thing (can't believe I didn't mention this before):
If it is VAS pressure/fragmentation (it almost always is, especially if you can last for 3 weeks before a reboot), use the VASummary view in this awesome article by Slava Oks.
I used to use it on our old 32-bit servers - I recorded the results every five minutes and knocked up a very quick SSRS report on the log table.
This is a great way to show total VAS space and the largest available contiguous VAS fragment over time. The shape of the graph can help you isolate the cause, or at least predict when the next reboot would be required.
In one case, it turned out to be the CLR being loaded (though disabled!) because we were calling sp_browsereplcmds which calls a system CLR function. The 100MB VAS required by CLR killed a production server more than once...
The quality of the answers is directly proportional to the quality of the question.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, November 16, 2009 3:25 PM
Points: 1,148,
Visits: 1,973
|
|
Paul's last post stirred up my memory too! 
Here is some code (probably similar to the one Paul just posted) that returns all VAS fragments (sorted by size, at bottom are the largest ones).
Taken from http://social.msdn.microsoft.com/forums/en-US/sqlnetfx/thread/cc1b3e43-0db8-4e75-b5ab-bc2a4c93b12b/
-- from http://social.msdn.microsoft.com/forums/en-US/sqlnetfx/thread/cc1b3e43-0db8-4e75-b5ab-bc2a4c93b12b/ -- MemToLeave values for instance of SQL Server: -- [Total avail mem, KB] : total memory assigned to MemToLeave -- [Max free size, KB] : free memory available to MemToLeave ;WITH VAS_Summary AS ( SELECT [Size] = VAS_Dump.Size, Reserved = SUM(CASE(CONVERT(INT, VAS_Dump.Base)^0) WHEN 0 THEN 0 ELSE 1 END), Free = SUM(CASE(CONVERT(INT, VAS_Dump.Base)^0) WHEN 0 THEN 1 ELSE 0 END) FROM ( SELECT CONVERT(VARBINARY, SUM(region_size_in_bytes)) [Size], region_allocation_base_address [Base] FROM sys.dm_os_virtual_address_dump WHERE region_allocation_base_address <> 0x0 GROUP BY region_allocation_base_address
UNION
SELECT CONVERT(VARBINARY, region_size_in_bytes) [Size], region_allocation_base_address [Base] FROM sys.dm_os_virtual_address_dump WHERE region_allocation_base_address = 0x0 ) AS VAS_Dump GROUP BY [Size] ) --Get size of all free mem. areas --http://www.sqlservercentral.com/Forums/Topic624152-386-2.aspx?Update=1 -- SELECT CAST(Size AS BIGINT)/1024 AS [Free size, KB] FROM VAS_Summary WHERE Free <> 0;
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 4:15 AM
Points: 2,069,
Visits: 2,040
|
|
Yep. Same code. It's very popular
The quality of the answers is directly proportional to the quality of the question.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, November 13, 2009 11:25 AM
Points: 16,
Visits: 86
|
|
I agree. I have been running that code. The issue just happened again. During this issue the results of the above query was
Total avail mem, KB Max free size, KB 51716 8704
We were forced to restart our sql server service. After the restart the values were:
Total avail mem, KB Max free size, KB 154256 45632
We are now functional again. It took 11 days for the error to reappear. This is a type of memory fragmentation , yes?
Also during this issue I was not able to run a simple function that calls the C# assembly. It errored with the following error:
Msg 10314, Level 16, State 11, Line 1 An error occurred in the Microsoft .NET Framework while trying to load assembly id 65537. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: System.IO.FileNotFoundException: Could not load file or assembly 'colleague, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString)
It seems that 8074KB should be plenty of memory to run a simple function...
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, November 16, 2009 3:25 PM
Points: 1,148,
Visits: 1,973
|
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 4:15 AM
Points: 2,069,
Visits: 2,040
|
|
That is *extreme and soon to be fatal* fragmentation. I used to consider a reboot when we got down below 50MB contiguous.
8MB is not a big block - and who's to say how long it lasted? Remember that SQL Server itself uses the multi-page allocator too.
In addition, if the function required workspace or dependent classes needed to be loaded...well.
Anyway, can we just agree that 8MB contiguous in the entire 2GB user address space is not very much?
If you were on 64-bit, you would have 8TB (7TB on Itanium) of VAS.
Paul
The quality of the answers is directly proportional to the quality of the question.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, November 13, 2009 11:25 AM
Points: 16,
Visits: 86
|
|
I think we can agree. But as you can see from my query, we are starting at less then 50MB of Max free space, KB. So my only option other then 64 bit servers is to try using the -g switch... say -g512? Will this switch increase the Max free space, KB value?
Daniel
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 4:15 PM
Points: 18,300,
Visits: 12,321
|
|
Jeff Moden (9/8/2009) I can't help on the problem you're having, Daniel, but I am curious... what does the CLR do?
Heh... you can avoid all this memory problem stuff by avoiding the CLR to begin with. So, let me ask again... "What does the CLR do?"
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 4:15 AM
Points: 2,069,
Visits: 2,040
|
|
danielmanke (9/11/2009) I think we can agree. But as you can see from my query, we are starting at less then 50MB of Max free space, KB. So my only option other then 64 bit servers is to try using the -g switch... say -g512? Will this switch increase the Max free space, KB value? Daniel Hey Daniel, yes it will (but 512 is a lot - consider -g384 first). Being lazy by not reading back, but I am assuming you have AWE enabled? AWE will let SQL Server manage the buffer pool in a very VAS-efficient way, making higher values for -g more practical.
The quality of the answers is directly proportional to the quality of the question.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, November 13, 2009 11:25 AM
Points: 16,
Visits: 86
|
|
Yes, AWE is enabled... with about 20GB max server memory
Daniel
|
|
|
|