Monday, January 25, 2010
Friday, January 22, 2010
10 ASP.NET Performance and Scalability Secrets
10 ASP.NET Performance and Scalability Secrets should implement for sites that require improved performance.
For additional information on improving ASP.NET Performance click here.
For additional information on improving ASP.NET Performance click here.
Thursday, January 21, 2010
JavaScript Closures
Javascript closures can cause memory leaks and should be used with care. Click here to learn more.
The pattern of public, private, and privileged members is possible because JavaScript has closures. What this means is that an inner function always has access to the vars and parameters of its outer function, even after the outer function has returned. There is no book currently available on JavaScript programming that shows how to exploit it.
For a good Javascript book click here.
Javascript closures:
The pattern of public, private, and privileged members is possible because JavaScript has closures. What this means is that an inner function always has access to the vars and parameters of its outer function, even after the outer function has returned. There is no book currently available on JavaScript programming that shows how to exploit it.
For a good Javascript book click here.
Javascript closures:
Managed Threading Best Practices
".NET Framework Developer's Guide" has important threading concepts for .NET development.
Managed Threading Best Practices can be found here.
Click Event-based Asynchronous Pattern Overview to read about even based asynchronous pattern and its implementation.
Additional threading info below:
Threads and Threading
The Managed Thread Pool
Exceptions in Managed Threads
Managed Threading Best Practices can be found here.
Click Event-based Asynchronous Pattern Overview to read about even based asynchronous pattern and its implementation.
Additional threading info below:
Threads and Threading
The Managed Thread Pool
Exceptions in Managed Threads
Wednesday, January 20, 2010
WPF Threads
Learn about how WPF handles threads. WPF now offers two UI threads. Click on WPF Threads
and WPF Threading Model to learn more....
and WPF Threading Model to learn more....
Memory Leaks with Delegates
When adding delegate (+=), you should remove it (-=) in order to release the delegate object and allow the GC to collect it. If a delegate maintains a reference to an externally declared object, and is not removed (-=), you will have a memory leak. For more details, click this article.
Monday, January 18, 2010
Inversion of Control Containers and the Dependency Injection pattern
Click on Inversion of Control Containers and the Dependency Injection pattern to learn more about Dependency Injection patterns.
Also, check out Create Elegant Code With Anonymous Methods, Iterators, And Partial Classes to learn elegant C# coding tips.
Also, check out Create Elegant Code With Anonymous Methods, Iterators, And Partial Classes to learn elegant C# coding tips.
Thursday, January 7, 2010
Improve Garbage Collector Performance using Finalize/Dispose pattern
After reading an article that demonstrated how to improve GC performance (i.e., maximize size of Gen 0, minimize Gen 1 and Gen 2), I will refer to the Dispose pattern documentation on Microsoft site. The GC article is a good starting point and can be complemented by reading the Garbage Collection chapter in the "CLR via C#" book (i.e., where you will learn that large objects get placed directly on Gen 2 and more details not mentioned in this GC article).
It is very important to understand and implement the Dispose pattern correctly. If you do not, your application may do mysterious things, and it will not be the GC fault.
For details about Garbage Collector internals and more, read CLR via C# book (note in Feb 2010, Third edition of this book will be released).
For improving performance of your .NET applications check out the Microsoft Patterns and Practices.
It is very important to understand and implement the Dispose pattern correctly. If you do not, your application may do mysterious things, and it will not be the GC fault.
For details about Garbage Collector internals and more, read CLR via C# book (note in Feb 2010, Third edition of this book will be released).
For improving performance of your .NET applications check out the Microsoft Patterns and Practices.
Monday, January 4, 2010
SQL Server 2005 - Performance optimization with DMV
After reading a very interesting article on SQL Server 2005 optimization with DMVs, I want to share a sql script to identify the indexes (in a specific database used) that are very logically fragmented (i.e., require rebuild or reorganization to improve performance of sql queries). See details below:
-----------------------------------------------------------------------
/*
------------------------------------------------------
Purpose: Identifying Most Logically Fragmented Indexes
------------------------------------------------------
Details:
------------------------------------------------------
Logical index fragmentation indicates the percentage
of entries in the index that are out of order.
This is not the same as the page-fullness type of fragmentation.
Logical fragmentation has an impact on any order scans
that use an index. When possible, this fragmentation should be removed.
This can be achieved with a rebuild or reorganization of the index.
You can identify the most logically fragmented indexes using
the sys.dm_db_index_physical_stats DMV, which
lets you view details about the size and fragmentation of indexes.
This is joined to the sys.indexes DMV,
which contains details used in the creation of the index.
This script identifies the most logically fragmented indexes.
The results, which are sorted by the percent of fragmentation,
show the most logically fragmented indexes, and the database/table.
------------------------------------------------------
*/
DECLARE @dbid int;
select @dbid = db_id();
SELECT
DatabaseName = DB_NAME()
,TableName = OBJECT_NAME(s.[object_id])
,IndexName = i.name
,[Fragmentation %] = ROUND(avg_fragmentation_in_percent,2)
INTO #TempFragmentation
FROM sys.dm_db_index_physical_stats(@dbid,null, null, null,'DETAILED') s
INNER JOIN sys.indexes i ON s.[object_id] = i.[object_id]
AND s.index_id = i.index_id
WHERE s.database_id = @dbid
AND i.name IS NOT NULL -- Ignore HEAP indexes.
AND OBJECTPROPERTY(s.[object_id], 'IsMsShipped') = 0
AND avg_fragmentation_in_percent > 1
ORDER BY [Fragmentation %] DESC;
SELECT *
INTO Admin.dbo.[Most Logically Fragmented Indexes]
FROM #TempFragmentation
ORDER BY [Fragmentation %] DESC;
DROP TABLE #TempFragmentation;
---------------------------------------------------------------------------
For more information, check out the white paper on Performance Tuning Waits Queues.doc
---------------------------------------------------------------------------
For SQL Server 2008 DMV views click here
-----------------------------------------------------------------------
/*
------------------------------------------------------
Purpose: Identifying Most Logically Fragmented Indexes
------------------------------------------------------
Details:
------------------------------------------------------
Logical index fragmentation indicates the percentage
of entries in the index that are out of order.
This is not the same as the page-fullness type of fragmentation.
Logical fragmentation has an impact on any order scans
that use an index. When possible, this fragmentation should be removed.
This can be achieved with a rebuild or reorganization of the index.
You can identify the most logically fragmented indexes using
the sys.dm_db_index_physical_stats DMV, which
lets you view details about the size and fragmentation of indexes.
This is joined to the sys.indexes DMV,
which contains details used in the creation of the index.
This script identifies the most logically fragmented indexes.
The results, which are sorted by the percent of fragmentation,
show the most logically fragmented indexes, and the database/table.
------------------------------------------------------
*/
select @dbid = db_id();
SELECT
DatabaseName = DB_NAME()
,TableName = OBJECT_NAME(s.[object_id])
,IndexName = i.name
,[Fragmentation %] = ROUND(avg_fragmentation_in_percent,2)
INTO #TempFragmentation
FROM sys.dm_db_index_physical_stats(@dbid,null, null, null,'DETAILED') s
INNER JOIN sys.indexes i ON s.[object_id] = i.[object_id]
AND s.index_id = i.index_id
WHERE s.database_id = @dbid
AND i.name IS NOT NULL -- Ignore HEAP indexes.
AND OBJECTPROPERTY(s.[object_id], 'IsMsShipped') = 0
AND avg_fragmentation_in_percent > 1
ORDER BY [Fragmentation %] DESC;
SELECT *
INTO Admin.dbo.[Most Logically Fragmented Indexes]
FROM #TempFragmentation
ORDER BY [Fragmentation %] DESC;
DROP TABLE #TempFragmentation;
---------------------------------------------------------------------------
For more information, check out the white paper on Performance Tuning Waits Queues.doc
---------------------------------------------------------------------------
For SQL Server 2008 DMV views click here
Subscribe to:
Posts (Atom)