Category: System Analysis and Design

Compare two tables record (SQL Server)

By Ashish Khandelwal, July 15, 2011

Sometime we want to compare the records between two database tables. These databases could be on same server or on different servers. Here is some information about how we can compare records between two tables. Hope this will help and give you some information.

The ‘EXCEPT’ operator performs the compare between two tables:

When both databases are on same server:

The following query returns any distinct values from the query to the left of the EXCEPT operand that are not also found on the right query.

SELECT ProductID

FROM Production.Product

EXCEPT

SELECT ProductID

FROM Production.WorkOrder ;

–Result: 266 Rows (products without work orders)

Read more »

Issues with Multithreaded Programming: Part 3

By Ashish Khandelwal, June 23, 2011

In my previous articles “Issues with Multithreaded Programming: Part 1” and “Issues with Multithreaded Programming: Part 2” I have explained about four issues of Multithreading programming 1) Race Condition 2) DeadLock 3) LiveLock and 4) Priority Inversion. Continuing to my previous articles, in this article I have explained about following issues:

Issues with Multithreaded Programming: Part 2

By Ashish Khandelwal, June 22, 2011

In my previous article Issues with Multithreaded Programming : Part 1 I have explained about two most common issues of Multithreading programming 1) Race Condition and 2) DeadLock. Continuing to my previous article, in this article I have explained about following issues:

Issues with Multithreaded Programming: Part 1

By Ashish Khandelwal, June 21, 2011

Multithreaded (Parallel) programming is difficult for many reasons. Developer always has to put extra care to protect the program from issues like race condition, deadlocks, livelocks, priority inversions, two-step dances, and lock convoys. My personal experience says these all issues are tough to identify and then resolve.

It is always better to have understanding on these issues before writing multithreaded application. In this article I have covered the quick overview of following issues associated with multithreaded programming:

  • Race condition
  • DeadLock
  • LiveLock
  • Priority Inversion
  • Two-Step Dances
  • Lock Convoys Read more »

Create Database from Entity Model

By Ashish Khandelwal, June 14, 2011
In my last article LINQ to SQL Vs Entity Framework I discussed about how powerful the ADO.Net Entity Framework compare to LINQ2SQL. In this article I will discuss about how to create Database from Entity Model (Entity Framework).
While designing Database for a project, we normally first finalize the models (entities and the relationships) and then create the physical database in the database server. Entity Framework allows us to follow the same approach where we can create entities, build the relationship between entities, finalize the design of database and could also start coding using entities even if physically database is not exist. Once we are done with database modeling, we can create physical database from Model. So far, one item is missing from entity framework which is data, we still need database server to store the data. Hopefully Microsoft will come with something to provide kind of temporary storage where no database server is required for atleast for debugging purpose. Read more »

LINQ to SQL Vs Entity Framework

By Ashish Khandelwal, June 8, 2011

LINQ to SQL and Entity Framework both are designed for ORM (Object Relational Model) support. They are developed to avoid the difficulties involved in writing Object Oriented code to perform RDMS operations. The OOP and RDMS are conceptually very different. The question arises when to use LINQ2SQL and when to use Entity Framework. What is the different between LINQ to SQL and Entity Framework.

LINQ to SQL and the Entity Framework have a lot in common, but each has features targeting different scenarios. While speaking about similarities or differences, I understand that ADO.NET Entity Framework’s LINQ to Entities can be considered as superset of LINQ to SQL and that, ADO.NET Entity Framework is much more than LINQ to Entities. Read more »

Distributed Caching

By Ashish Khandelwal, June 2, 2011

One of the key techniques used to develop high-performance and scalable application is Distributed Caching.

In this article I will cover:

-          What is Distributed Caching and

-          What is the need of Distributed Caching

Caching is a well-known concept; it is a technique to store the data in-memory so that application is not required to fire a query over the network to communicate with database or service. Communicating over the network always add lots of additional overheads (parsing, validating etc.) – ultimately increase the overall processing time for the request. When using caching, the data is always available in ready to use format within the memory, so that the overhead of network response time and processing time for the request can be reduced – ultimately increase the performance. Read more »

Socket programming vs. WCF

By Ashish Khandelwal, May 31, 2011

A very simple scenario where client sends a request to server to perform certain action. There is no much data transfer between two parties – Probably no more than 50 bytes. We need to decide whether we go with Socket programming or use WCF (request-reply messaging pattern).

The analysis says: Read more »

.Net Framework 4.0: The Background and Foreground GC

By Ashish Khandelwal, May 31, 2011

In my previous article I have explained about concurrent GC for workstation version of the CLR (Differences between Server and Workstation GC (types of garbage collection)). The CLR 4.0 has come with some performance enhancement (called “Background GC”) on the memory management process. This enhancement is majorly done with concurrent GC processing.

The Background GC came in picture because there was some latency issue with concurrent GC. Let me try to explain about the issue:

As you remember, Concurrent GC means the GC thread will run in parallel without blocking the application execution (well, not exactly the parallel – it was just minimize the blocking time). The concurrent GC operation can take some time if the memory allocation is quite large and this prevents short-lived (gen 0 and 1) collections while is running. Read more »

Differences between Server and Workstation GC (types of garbage collection)

By Ashish Khandelwal, May 30, 2011

In my previous article (Garbage Collection – up to .Net Framework 3.5) I explained basic concept of GC. Here I am going deep to explain more about types of GC provided by CLR.

The CLR provides two types of garbage collection 1) Workstation garbage collection and 2) Server garbage collection.

Several times I have heard one common question in the community asking the differences between server and workstation GC, and how Concurrent GC fits in-between. Let me try to explain here:

Server GC: It is only available on multi-proc machines. It creates one GC heap (and thus one GC thread) for each processor, which are collected in parallel. This GC mode maximizes throughput (number of requests per second) and shows good scalability (performance really shines with 4 or more processors). Read more »

Garbage Collection: .Net Framework 3.5

By Ashish Khandelwal, May 29, 2011

Here I am covering some basic information about how GC works in CLR. More detailed informations are covered @

 

 

The garbage collector is an automatic memory manager. It provides the following benefits:

  • Enables us to develop the application without having to free memory.
  • Allocates objects efficiently on the managed heap.
  • Reclaims no longer used objects, clears their memory, and keeps the memory for future allocations.
  • Provides memory safety by making sure that an object cannot use the content of another object. Read more »

Why to migration from .net 1.1 to the latest framework

By Ashish Khandelwal, May 29, 2011

Some days back one of my readers asking me a question about why one should migration from .net 1.1 to the latest framework. Here is the part of discussion:

Reader: Why the product should be migrated from .net Framework 1.1 to later framework if product is working as expected without any issue. What are different advantages (performance and system stability) regarding the upgrade to higher versions of the framework? What can be a good reason for the client to allow us to work on migration?

Me: Migrating existing .Net application developed using older version of .Net framework to the latest version is always worth considering, for many reasons. .Net application should be upgraded from time to time to the latest version of .Net to accrue the maximum benefits from technology advancement. Some of the reason/benefits are as follow: Read more »

How to improve garbage collection performance

By Ashish Khandelwal, March 6, 2011

Introduction
DotNet developers can free themselves from tedious memory management for their application as Microsoft Framework and CLR do it automatically.CLR provides a mechanism called as Garbage Collection which manages your applications memory. In this session we will discuss   how garbage collector works and how it affects the performance of your Applications.

When you create an object using new () operator, the object’s memory is obtained from the managed heap. When the garbage collector decides that sufficient garbage has accumulated, it performs a collection to free some memory. This process is fully automatic, but there are a number of factors that you need to be aware of that can make the process more or less efficient. Read more »

WCF – Authenticate the Client using User Name and Password

By Ashish Khandelwal, February 11, 2011

WCF is a distributed technology, you build the WCF service to serve the functionality to the Client, The Client could be on Intranet or on Internet. It is almost always mandatory for the Service to know its client (Authenticate) before accepting the message or sending the message to the client.

WCF provides various ways to accept the credential from client and authenticate it. The following table shows the possible credential types that you can use when creating an application. You can use these values in either code or configuration files. Read more »

WCF – Security Overview (Fundamental)

By Ashish Khandelwal, February 9, 2011

Windows Communication Foundation – Why security is needed?

Using WCF, we can create applications that function as both services and service clients. One service could be transmitting, creating and processing messages for an unlimited number of other services and clients. In such a distributed application, messages can flow from node to node, through firewalls, onto the Internet, and through numerous SOAP intermediaries. This introduces a variety of message security threats. The following examples illustrate some common threats that WCF security can help mitigate when exchanging messages between entities: Read more »