Thursday, May 30, 2013

SharePoint + Asp.Net Concept - Session State - Catching





Three kinds of session state information: (1) sensitive (2) non-sensitive (3) cached

Several strategies can be used to manage session state data, but each has limitations: in-process state management, synchronized state management, and leveraging the state management possible on the client.

in-process state management that ASP.NET provides. This approach performs well if there is only one server in the farm. However, this issue can be mitigated if the load balance is set for sticky sessions. A sticky session setting keeps users on one server, reducing the probability that a user will transition from one server to another and not have their state information available. The main concern with the approach of keeping the session data in in-process memory is that transitioning to another state management approach is difficult because every other form of session management requires that the object be realizable.

synchronized state management, all session information is stored and retrieved from a centralized
location. This solves the potential problem of having out-of-sync information across servers. There are two approaches to a synchronized, or centralized, state management. The first approach to synchronized state management is to use an in-memory cache, but the problem with it is that at some point the server managing the information must be rebooted. The second approach is to use a database for synchronization, but the database induces delay and its own performance problems.

server-client, you transmit the state back to the client. The challenges with this strategy are that sensitive information must be encrypted (adding overhead), and that the link speed between the server and client is typically the slowest part of the system.

SharePoint and Memory






Every SPSite or SPWeb object is approximately 2MB in size.

SharePoint can implement two key types of in-memory cache: (1) output caching (2) object caching.

Output caching is an ASP.NET feature that can be configured in SharePoint to provide caching of the
output of Web pages. In this process, the page is processed only once and returned so that second user to access a page receives a copy of what executed when the first user came to the page. Output caching is appropriate for anonymous sites but not appropriate when the page has personalized content. In addition to returning the pages to the user more quickly for the second and subsequent requests, output caching reduces the CPU and database load on the farm because the requests aren’t being processed repeatedly.
However, this comes at the expense of a greater amount of memory being required on the server to
support the additional caching.

Object caching operates at a data level and is designed to improve performance of data operations. The object level cache can be a substantial improvement in scalability and performance. However, just like the output cache, the object cache consumes memory—memory that might be necessary for other operations.

From a session state perspective, SharePoint Server creates and configures a shared SQL session state
database, providing for synchronized session state. Because of this, an additional SQL Server load is placed for each object added to the user’s session state. SharePoint Foundation will, by default, not use session state.





SharePoint + Asp.Net Concept - Server Memory

For each application pool loaded into memory, a separate instance of the worker process exists.

To understand individual process behavior, you need to be concerned with two important memory
counters: (1) the private bytes value  (2) the virtual bytes value.
The private bytes value tells you how much memory the process is using in physical RAM, which is an indication of how much pressure the process is putting on the system for memory. This value is the process footprint.
The virtual bytes value is the complete size of the addresses that the process has asked for, including both memory in physical RAM and virtual memory. This value is the key item for 32-bit processes because SharePoint can allocate only 2GB of virtual bytes before it runs out of memory—or more precisely, before it runs out of addresses for memory.

In general, using virtual memory on disk is a bad idea.

The counters that you can get from the Reliability and Performance Monitor are available as a set of
properties on the System.Diagnostics.Process class. These values allow you to monitor the memory usage of a .NET process while it’s running.

The information in Performance Monitor (and Data Collection Sets) is broken into a hierarchy that includes broad groupings called counters, individual metrics called objects, and instances, which represent the individual copies of the counters that capture and display information. A counter is a category such as processor, memory, process, and physical disk.

SharePoint 2010 : User Profile Service Application : Collaboration and Social Computing

Services available in SharePoint, the architecture uses a service model. A farm administrator must grant you permissions before you can access the UPA through Central Administration (CA).

All the information SharePoint stores to track users, tags, ratings, and other social data is stored in the user profi le and social database. This information is managed using UPA and is exposed to you through the Microsoft.Office.Server.UserProfiles namespace.
Use PowerShell to Automate Creating a UPA
$app_UPA = New-SPProfileServiceApplication -Name UPA –PartitionMode -ApplicationPool $appPool

Create a User Profi le Using the Object Model:
public void CreateUserProfile()
{
//We have to get current context of the service application
strUrl = "http://site";
SPSite site = new SPSite(strUrl);
SPServiceContext serviceContext = SPServiceContext.GetContext(site);
//UserProfileManager class contains members for profiles
UserProfileManager upmanager = new UserProfileManager(serviceContext);
//create a new user profile
string strAccount = "domain\\user";
if (!upmanager.UserExists(strAccount))
upmanager.CreateUserProfile(strAccount);
}

The UPA administration screen in CA is divided into four sections.
1.      
     People
1.     Removing the Create Personal Site permission eliminates the My Site link for that user
2.      
S   Synchronization
1.       Configure Synchronization Settings : Create a connection to import user information from Active Directory, IBM Directory, Novell eDirectory, or Sun ONE Directory Server. Imports can also be created using Business Connectivity Service applications.

3.       Organisations
1.       Use this page to add, edit, organize, delete, or map organization profile properties. Organizations are a new feature, managed much like user profiles; however, they allow you to treat organizations you work with as individuals with profiles and social data.

4.       My Site Settings
1.      Configure Personalization Site: This feature is very useful for developers wishing to create role - based dashboards. You can configure links to applications and dashboards and publish based on audience membership.