15 .NET Advanced Concepts Everyone Should Know

Once when you have gained the basic knowledge of .NET, you must know about these .NET advanced concepts.

1. Private Assembly

If you want to create isolated applications, you will need ‘private assembly‘. In private assemblies, the scope of the application is limited to the application. It can’t be referred outside its directory by other applications. Read more about private assemblies.

2. Shared Assembly

A ‘shared assembly’ is available to multiple applications for use. These assemblies can be shared side-by-side by different applications running at the same time. In .NET, these assemblies are contained in Global Assembly Cache (GAC). Read more about shared assemblies.

3. Probing

The ‘probing’ is a process to specify assembly for a class. CLR will look for the assembly in Global Assembly Cache (GAC), if the assembly is not found in GAC, it will start searching the assembly in specified path that is described under the tag in the config file. Read more about probing.

4. Garbage Collection

‘Garbage Collection’ is a mechanism to remove the objects from the memory if the object is not accessible. Garbage Collection is carried out when the physical memory is low or when the memory occupied by managed heap surpass the acceptable threshold. Read more about garbage collection.

Garbage Collection .net
.NET Garbage Collection

Server vs. Client Garbage Collection

Server: In the case of server Garbage Collection is carried out for multiple CPUs. Concurrent Garbage Collection can cause scalability issues. Non-concurrent Garbage Collection can improve performance by less context switching. Replication of processes on CPU is the product of the ‘total number of CPUs’ and ‘total number of processes‘.

Client: On client’s machine the Garbage Collection is carried out for single CPU. There is a smaller number of long run processes, and the Garbage Collection can work concurrently with all the other threads.

5. Large Object Heap (LOH)

As the name of the heap, it is a heap that contains the object with size more than 85000 bytes. When the object is created, and its size is greater than 85000 bytes, then it is placed in the special heap known as ‘Large Object Heap (LOH)‘. Another heap is there named as ‘Smaller Object Heap’ that contains only objects with size lesser than 85000 bytes. Garbage Collector does not perform any compaction on ‘Large Object Heap’ as it takes more resources and more CPU cycles.

6. Code Access Security

‘Code access security’ is the mechanism to keep the accessibility of code in limits. The purpose of Code Access Security is to protect the resources. With Code Access Security you can restrict the functionality of the code, and you can also apply restrictions to other code for calling your code. Read more about Code Access Security.

7. Memory Leak

Memory Leak‘ is when an application acquires the memory from the OS but fails to release it. Memory Leak occurs in the case of Missing Code or when any exception occurs before the destructor is called. The worst case of memory leak is when the memory is limited, or the OS does not release memory. For example in the case of AmigaOS.

8. Application Pool

Application Pooling‘ is the separation of web applications/websites worker processes into groups as the failure of each website does not harm another worker process because they are separated by Operating System process boundaries. The main purpose of the application pool is to maintain security, reliability, and performance of the application. Read more about Application Pools.

9. Worker Process

Worker Process‘ is responsible for ASP.NET request and response cycle. Each application has its separate unique worker process or processes. All the functionality of the application runs within the scope of this process. Read more about Worker Process.

10. Web Farm and Web Garden

Web Farm‘ is when there are multiple hosts to serve an application whereas ‘Web Garden‘ is an application with multiple worker threads. According to MSDN, “A Web farm allows you to expand a Web Site across multiple servers. A Web garden allows you to expand a Web Site across multiple CPUs within a single server”.

11. Processor Affinity

Processor Affinity‘ is the ability to direct the process to use some specific core. By default, the processes use all the available cores. With the help of Processor Affinity, the application can utilize cache memory in a much better way. Read more about Processor Affinity.

12. Security in IIS

IIS server security includes authentication, access control, encryption, certification, and auditing.

  • Authenticate the identity of the users who are attempting to connect the server to restrict the content.
  • Access Control by controlling the access to resources for the users.
  • Encryption with the help of Secure Socket Layer (SSL) certificates to ensure privacy and protection of the data.
  • Certification i.e. SSL certificates can establish secure connections.
  • Auditing by monitoring security activities to prevent tampering and unauthorized access.

13. Load Balancer

Load Balancer‘ distribute the workload across multiple computers. It is usually provided by dedicated systems. For example, Multiple Switch or Domain Name Servers DNS. Scheduling Algorithms and Round Robin DNS use Load Balancer. Read more about Load Balancing.

14. AppDomain

‘AppDomain’ is the light weight process that acts as logical containers for other processes. It allows multiple assemblies to run within a single process thereby you can share .NET runtime libraries. Read more about Application Domains and AppDomain class.

15. Recycling

When IIS identifies that the server is not healthy then it ‘recycles‘ the process to ensure that memory leak or any bad code do not cause any problem.

.NET recycling

 

Stay Tuned! Stay Blessed!