About Me

I am a Software Engineer presently working in Microsoft as vendor.The main aim of this blog is to Share my knowledge in Sharepoint,AZURE and Silverlight.

Monday 23 June 2008

How to Increase Performance of Sharepoint in all levels.

Tune your Sharepoint with following tips.Here are the tips given by me to our project Artcore.
Today i m going to blog how to increase the performance of our sharepoint portal in all the levels.
Performance of an application using MOSS framework can be increased by enhancing in either one or in all of the following areas.
1.0 Infrastructure.
2.0 IIS.
3.0 SharePoint portal.
4.0 Application.
5.0 Code Level

1.0 Infrastructure
SharePoint is an application that works best when it gets lots of memory and CPU resources. SharePoint’s Web role uses stateless connections. Using this as advantage, if we install the Web role on several servers, it is possible to divide the client load between them. However, for this we need to consider and solve two challenges first. One is to make sure all web servers have access to the same information which is done by using a common back-end database for all of them. The second thing to solve is that all of these web servers must look like one single SharePoint server which is done by using (NLB). SharePoint supports up to eight servers running the web service role.
1.1 Index server
Different activities in SharePoint require different extent of resources; for example, displaying a project Site normally generates a very light load on the server, whereas indexing the database generates much higher load.

The Index service including the crawling activity is very resource intensive regarding CPU and disk access. By separating this service from the Web, many more users will be supported in the SharePoint environment. The indexing activity can be split between up to four different SharePoint servers.
Note: Only one Index server can crawl on a given content source. If one index server goes down, no other server will take over the indexing crawling that server is configured to do.

With below topology we can double the performance, availability….,

Picture to be placed here.

1.2 Calculating the Number of Operations per Second (OPS) required
For computation of the load or the OPS, on the SharePoint server, the following formula is used

(http://blogs.technet.com/wbaer/archive/2007/07/06/requests-per-second-required-for-sharepoint-products-and-technologies.aspx)


A*B*C*D /360,000*E= OPS
Where,
❑ A = The number of users.
❑ B = The percentage of active users on a typical day.
❑ C = The number of operations per active user per day.(1-10)
❑ D = The peak factor.(1-10)
❑ E = The number of working hours per day.

For ArtCore

A= ~ 1000
B= ~ 100
C=~10
D= ~10
E= 12

1000*100*10*10/360,000*12=10000000/4320000 = 2.31 OPS.

By Redesign we can manage up to 20,000-40,000 of users.

1.3 Requests per second
The general rule is to plan for 1 Rps. While a small server farm serves about 60 RPS for 1000 users, a medium farm with 2 WFE servers can serve about 120 Rps.

1.4 Disk Space Needed
When planning for the required disk space, there is no need to worry about the SPS binary files, because they are small compared to other files. More important are the index and database files. Regardless of the database type, you still need to follow this important rule:

You must always have at least 50 percent free space on your database disk!
The reason for this is that some database troubleshooting utilities need to make a copy of the database to perform their tasks. If you don’t have the required space, you may get into a situation where you cannot fix a problem.



2.0 IIS
2.1


When creating a Web Application (and associated site collection) that the default is that a unique IIS application pool be used for each. This can have several benefits – should some unexpected error in a site cause a problem it will be localized to that site collection, additionally the worker process will be caching content related to those specific sites. Worker process sizes between 250-300MB on X86 WFE servers, and between 400-500MB on X64 WFE servers. There are also other application pools and related IIS processes to support Central Administration, SSP, and so on, on the various WFE servers. The best-practice approach will be to consider which Web Applications should share an application pool, and which should be unique. Using multiple application pools can be beneficial, but it is easy to over-do by always taking the default settings (use new pool). Each related process has to load an instance of the .NET runtime in memory, so un-needed (excessive) application pools can waste memory.

2.2
IIS Compression

HTTP Compression is a wonderful technology that accomplishes a lot of different things. It allows faster page serving to clients and lower server costs due to lowered bandwidth (these two being enough for me to implement).

HTTP Compression is when a Web server receives a request for a file and instead of just serving the file to the client, it checks to see if the client browser (or application) is "Compression Enabled". If so, the Web server does a check on what type of file is being requested (this is determined by the file’s extension). If the file is marked as a static file, such as an HTML file, IIS will check the Compression Cache Temporary Directory.

If a compressed version isn’t found, IIS will send an uncompressed version of the file to the client and a compressed version is placed in the temporary directory (IIS will only serve to the client from the temp directory). If the compressed version is found, IIS will send the file directly to the requesting client. If the requested file is a dynamic file, such as an ASP.NET Web form, then the response is dynamically compressed and sent to the requesting client (no temp directory access is ever done).

By running the below scripts we can achieve compression
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx" "ashx"
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx"
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel "9"
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel "9"

(http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d52ff289-94d3-4085-bc4e-24eb4f312e0e.mspx?mfr=true)
3. 0 SharePoint level
3.1 Caching
SharePoint provides two types of caching.

3.1.1 Page output caching

3.1.2 Disk caching

Disk-based cache scheme can be enabled on a per-site basis, and should be set consistently on each WFE server. In a typical site there are likely several references to image files (BMP, JPG, and so on) or to CSS style sheets or JS script files. These can be cached to avoid repeated database access for what are essentially static objects, and thus improve page response times. The cache is disabled by default, and is enabled by editing a line in the site WEB.CONFIG file found in the IIS Inetpub folder structure related to the site on the server’s system disk. Edit the file and search for the second instance of “BLOB” to get to the right line, which looks like:

<(BlobCache location="E:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="100" max-age="86400" enabled="false" )/>

Currently in production it is set to “false”.
The maxSize parameter is the maximum size of the disk cache in GB.
4.0 Application level
Our Project’s Key strength is InfoPath forms.
InfoPath Forms Services uses session state to store the large amount of transient data generated while filling out a form. As a result, front-end Web servers can remain stateless between round trips, and each post back is not burdened with carrying large amounts of session state information over narrow bandwidth pipes.

So if you are using infopath forms use formview state rather than session state.

5.0 Code Level
Many times we will delete or update list items in the lists by using Object oreiented code if these operations or doing on lists having bulk items then use
"ProcessBatchData" we can increase performance very much.

http://msdn.microsoft.com/en-us/library/cc404818.aspx

Advantages:
1) Performance
2) High availability(WFE & DB)
3) High Throughput
4) Scalability
5) No downtime

Saturday 14 June 2008

How to Integrate Silverlight in Smartpart.

can we integrate our smartpart with silverlight.(I say YES.)

People who are working with smartpart is in dilemma. how to use silverlight in smartparts then here is the solution jump and give a try.

This Post is continuation of my previous post so go through my previous post for creating silverlight webpart.

People who worked in asp.net feels uncomfort in sharepoint as we have to develop custom webpart from the scratch for them smart part is a good webpart which takes usercontrol and renders our usercontrol to webpart.
you will found the smart part in the below link.
http://www.codeplex.com/smartpart/Release/ProjectReleases.aspx?ReleaseId=10697

The latest release for smart part is v1.3. it is a good webpart developed by inheriting sharepoint webpart.This supports ajax also.

Now the Question is can we integrate our smartpart with silverlight.

I tried in multiple ways but i got succeded in Following way. (as usercontrol is .net controls we have to render our controls on top of the silverlight content)

To integrate Smart part and silverlight the procedure we have to follow is:
1) Create a web part with silverlight rendering.(silverlight web part)
2) Overlap Smart part on the silverlight web part.


Open the User Control and place your code in the div tag.

<-div style="position:absolute; width: 600px; height: 100px; z-index: 1; left: 24px; top: 95px" id="layer1">
This makes the control to Render at our required position. We can adjust the properties as per our requirement.

My user control looks like below in design mode.(Just adding two numbers)



Output of the user control after rendering on silverlight web part in my SharePoint site.
Output in the IE Browser.(As this differs very little in mozilla).



Cheers it worked for me i have some more options
1)rendering directly silverlight content in usercontrol it worked for me if it is .net application but it is not working for sharepoint i may miss some thing ill try soon and update.
2)inheriting the smartpart webpart and adding our code in Onprerendermethod and override rendermethod.(didnt gave a try.)

now you can give a try with this. :)

How to Create a Silverlight Webpart.

Most of the people ask me how to integrate silverlight in sharepoint. In my previous post I explained about rendering silverlight content in a sharepoint page.

This time i'll explain you how we can render silverlight content in a sharepoint webpart where we can display individual silverlight content in a webpart rather than rendering silverlight for total Sharepointpage.

Here are the Steps for creating silverlight web part.
1) Open visual studio and create a new project by selecting web part template. As shown in the below figure.


2) Add the Silverlight files Scene.js, Scene.xaml, Silverlight.js to the project as shown below.

After adding the silverlight files to the project set the “Build Action” property of each file to “Embedded Resource”.


3) We added silverlight files in to the assembly by making the property to “embedded resource”. To expose the file to a web request we need to add the following code in .cs file .These entries expose the embedded resource to the “ Client Script Manager” can get the file and know what kind of file it is.
[assembly: WebResource("Otherswebpart.Silverlight.js", "text/javascript")]
[assembly: WebResource("Otherswebpart.Scene.js", "text/javascript")]
[assembly: WebResource("Otherswebpart.Scene.xaml", "text/xml")]
The code in my .cs file. I took Otherswebpart as my name space. We have to add assembly level information just above the name space as shown in the figure.

4) We said to the assembly by the above lines now we have to register the script files to the page before the files are used. So we need to add the following lines of code in the method called “OnPreRender”.
My method in the .cs file has the following code.
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);


this.Page.ClientScript.RegisterClientScriptResource(GetType(), "Otherswebpart.Silverlight.js");
this.Page.ClientScript.RegisterClientScriptResource(GetType(), "Otherswebpart.Scene.js");

}

The above code explains registering of my script files to the page before rendering.

5) Finally we have to render the Silverlight content. So I added the code which we found in the default.html.js file. The reason I wrote the every line of default.html.js file instead of calling “CreateSilverlight()” method is we require the source of the ” page.xaml” which is embedded in the assembly.

So my render method looks like the following.




A) The text which is in yellow colour describes the source of our “Scene.xaml” file.
B) The property isWindowless:’True’ allows us to overlap our .net controls on to the silverlight content. (Add this property it doesn’t come by default.)

6) Finally we have to build and run the project.
Before that we have to set one more property. Go to the project properties and select the debug tab and set the property “start browser with URL” to your SharePoint site as shown in the below figure.


By doing this we should be able to see the output of the web part in our SharePoint site.
Check the Output in my site which is having “Otherswebpart webpart” which is having silverlight content and with one silverlight button.



Cheers Now Give a try with this. in my next post i'll explain how to integrate silverlight webpart with smartpart.

Thursday 12 June 2008

How to Generate a WSP (solution package)

Hi ,

Today i m going to blog How to generate a WSP when we have individual Dll's to be deployed in to gac other than features,files to layout folder etc..,

Creation of WSP.

WSP is a SharePoint solution Package.
The WSPBuilder is a console application that creates SharePoint Solutions files
based on a folder structure. WSPBuilder will automatically traverse a "12" folder structure
and creates a SharePoint solution manifest.xml and the WSP file based on the files it finds.
Therefore you do not need the knowledge of how to create a solution manifest.xml
and WSP file any more.
Steps for Create WSP.
Step1: Create a Class Library Project.
Step2: Create a “12” folder Structure and paste the folder in to your project. The “12” folder Structure should contain all the required files to be deployed.
For example the entire feature files to be deployed in to Features folder. Custom files to be deployed to Layouts folder. Etc...


Step3: Make a strong name key. (Sign the Assembly)
This can be done by clicking on the properties of the project and select the “Signing”.
Check the check box “Sign the Assembly”.
Select “New” in the Choose a Strong name Key file section and give the name for strong name key.
Step4: Build the Project in Release Mode.
Step5:
Open the folder of your current project from file system. It looks like below.

Step6: Copy the files (WSPBuilder.exe, Cablib.dll, and makecab.exe) in to the folder. It should look like below
WSPBuilder.exe: Download the WSP builder.exe from the below link.
http://www.codeplex.com/wspbuilder/Release/ProjectReleases.aspx?ReleaseId=11603
makecab.exe: Copy the file from C:\WINNT\System32
Cablib.dll: you will found this in WSP tools folder which you downloaded


We have two Scenarios from here
1) No DLL’s
2) Are we having any DLL’s to be dropped in GAC?

If we are not Deploying any DLL’s into GAC just click on the WSPBuilder.exe.
This Generates 2 files.
1) solutionid.txt
2) WSP file (EX: ArtCoreFeatures.wsp)


If we are having DLL’s to be deployed in to GAC in part of WSP.
a) Drop the Dll’s in to the Release folder of the Project.
b) We have to write a manifest file.
This says what are the dll’s to be deployed into the GAC.
The manifest file contains SolutionID attribute which specifies the unique GUID assigned to the solution.
The manifest file is an xml file. Looks like the below.(Remove the - in the tags)
<-Solution SolutionId="63DD8533-9BAF-4ca8-8EFE-0846F0CD3CC1" xmlns="http://schemas.microsoft.com/sharepoint/">
<-FeatureManifests>
<-FeatureManifest Location="CreateProjectWorkSpace\feature.xml" />
<-/FeatureManifests>
<-TemplateFiles>
<-/TemplateFiles>
<-Assemblies>
<-Assembly DeploymentTarget="GlobalAssemblyCache" Location="ArtCoreFeatures.dll" />
<-Assembly DeploymentTarget="GlobalAssemblyCache" Location="Microsoft.EDD.ArtCore.GenericWorkflowWF.dll" />
<-Assembly DeploymentTarget="GlobalAssemblyCache" Location="CreateProjectWorkSpace.dll" />
<-/Assemblies>
<-/Assemblies>
<-/Solution>
After making necessary modifications place this manifest file in the Step6 folder structure. And click on WSPBuilder.exe.
This packs the Dll’s .

Steps for Service Account Change in Moss

The steps to change the service account is as follows,
1. Change the service account for all “Windows Service” and “Web application pool” through the Central Administrations->Operations Tab->Service Accounts link
2. stsadm –o updatefarmcredentials –userlogin -password
3. You must run IISReset /noforce to complete the action.
4. Wait for the "Administration Application Pool Credential Deployment" job definition to go away on the Timer Job Definitions central admin page
5. stsadm -o updateaccountpassword -userlogin -password –noadmin
6. stsadm -o spsearch -farmserviceaccount -farmservicepassword
7. stsadm -o editssp -title -ssplogin -ssppassword
8. stsadm -o osearch -farmserviceaccount -farmservicepassword