KB-Watch Out For The SPVirtualPathProvider

公司的Sharepoint Portal(現在應該叫MOSS,但我老覺得會跟摩斯漢堡搞混)上線後,效能一直不太理想。

在Portal中,我們有另外開發了一些Web Application程式,有ASP也有ASPX,掛在SPS的網站下建成Virtual Directory。結果一到尖峰時間,偶爾會發生所有的ASP/ASPX網頁就會傳回"Out of Memory"錯誤的狀況,但實際上w3wp.exe的記憶體用量大約在800M左右,整台機器的記憶體也還有剩,不像是記憶體真的耗盡,這些錯誤會在IISRESET後恢復正常,然後又可以再撐個一兩天。

由於沒有明確的Capacity數據可以參照,我們不確定是機器不夠力還是系統沒調好,只好且戰且走... 直到有一天在Event Log中看到一個怪異的ASP.NET 2.0 Error。

Event code: 3008
Event message: A configuration error has occurred.
Event time: 8/23/2007 12:53:03 PM
Event time (UTC): 8/23/2007 4:53:03 AM
Event ID: 19a6172d33a84ca299e93af831c8fe0b
Event sequence: 240346
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1481090595/ROOT/NEWOA-1-128322900009164404
Trust level: Full
Application Virtual Path: /Blah
Application Path: D:\WWW\Blah\Boo\
Machine name: MOSSWEB1
Process information:
Process ID: 6000
Process name: w3wp.exe
Account name: MyDomain\SPSAccount
Exception information:
Exception type: ConfigurationErrorsException
Exception message: Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'The parameter is incorrect.
' (c:\spsweb\protal\web.config line 122)
Request information:
Request URL: http  : //mossweb1.corp.com.tw/Blah/Images/Brown80.jpg
Request path: /Blah/Images/Brown80.jpg
User host address: 192.168.1.160
User:
Is authenticated: False
Authentication Type:
Thread account name: MyDomain\SPSAccount
Thread information:
Thread ID: 67
Thread account name: MyDomain\SPSAccount
Is impersonating: False
Stack trace: at System.Web.Configuration.IdentitySection.InitializeToken()
at System.Web.Configuration.IdentitySection.get_ImpersonateToken()
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean isThreadStateInitialized, Boolean setImpersonationContext)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
Custom event details:

啥? 只不過是JPG檔,怎麼也跟ASP.NET 2.0扯上關係?

後來,同事小熊子找到一個關鍵設定,原來WSS 3.0有個新設計,叫做SPVirtualPathProvider,它可以由WSS資料庫讀出檔案,有點URLRewrite的味道。但是他做了一個討厭的設定:

如上圖,所有掛在Sharepoint網站下的Virtual Dirctory都會繼承這個設定,Wildcard Application Maps意味著對任何檔案(包含htm, jpg, png, zip, ...)都要先透過ASP.NET檢查,這似乎就解釋了上面看到的那筆詭異JPG + ASP.NET 2.0 Error Event。

連jpg, css都需要經過ASP.NET來跑,會不會比較耗效能呢? 於是我用ACT(Application Center Test)做了多Thread連續讀取同一JPG檔的壓力測試,其中藍線為設定Wildcard Application Maps的情況,紫線是移除後的結果。實驗證明,關閉Wildcard Application Mapping後速度上升了約兩倍。

這個Wildcard Application Maps的效能殺傷力真有這麼恐怖? 我沒有足夠的證據/理論可以做此判決,至少,在關閉Sharepoint下這些自訂Web Application的該設定後,已經好久沒有看到Out of Memory Error囉!

Published 04 September 2007 01:19 AM 由 Jeffrey
Filed under: ,


意見

# Heidi said on 03 October, 2007 08:37 AM

I used Google to translate your article and it seems like we have a similar problem with the same error message and out of memory exceptions.

But I don't really understand the google translation of how you fixed the problem.

Can anyone explain this for me in English or Swedish?

Thank you!

# Jeffrey said on 03 October, 2007 10:56 AM

To Heidi,

We met a serious performance problem where our MOSS site go live as a portal site for thousands-users.  The asp/aspx throw out of memory excpetion in peak time even when the memory is still adequate.  

Someday when I found that a jpeg request throw ASP.NET 2.0 exception in IIS log, I knew something wrong and I understood that MOSS always set a wildcard app maps for Sharepont enabled web site and the setting force every request (html, jpeg, gif, css, js, asp...) to be processed by ASP.NET 2.0 framework and cause a very poor performance.

After I removed the wildcard app maps setting from IIS, I got a 2.5 times speed up and the out-of-memory exception is gone.

Hope these explaination can help you to understand the issue I met and how I solved it.

Jeffrey

# Heidi said on 03 October, 2007 11:51 AM

Thank you Jeffrey!

Now I understand. This is great information!

This is the only site google had that refered to this error message - thanks so much for helping me.

/heidi

# Heidi said on 03 October, 2007 12:05 PM

Are you using any Sharepoint caching?

I just wonder why it is automatically configured on a sharepoint enabled site. Could there be a benefit to this configuration - perhaps for caching or perhaps for something else.

regards,

Heidi

# Heidi said on 03 October, 2007 12:37 PM

Are you using Sharepoint Caching?

I am just wondering why the Wild Card Application Map is configured automatically for sharepoint enabled sites. Could it have a benefit? Maybe for caching?

# Heidi said on 03 October, 2007 12:57 PM

(sorry about the double post! I couldn't see it there when I checked - I hope you can delete the extras...)

# Jeffrey said on 03 October, 2007 07:14 PM

To Heidi, I am not a Sharepoint guy, so here is just my guess...

Sharepoint forces every request be processed by ASP.NET framework so it can add some logic and play some tricks, just like store the file content in database and retrieve them like they are in the physical folder(some kind of UrlRewrite...), maybe it's a good way to handle versionging.

# 宗 said on 11 October, 2007 01:49 AM

請問關閉是把

Wildcard Application Maps裡的.net移除掉就好了嗎

我現在碰到上傳多張圖片常常傳不上去的問題

而且圖片檔案也很小

不知道是不是這個問題所造成的

謝謝^^

# Jeffrey said on 14 October, 2007 10:38 AM

to 宗, 關閉方法是將那條設定移除沒錯,但它影響的是jpg, gif等非ASPX程式是否要經過ASP.NET framework處理?  你所說的圖檔上傳應該也還是POST給ASPX程式接收,看起來不像是這個問題造成的。

# Bel said on 23 June, 2008 08:01 PM

I have had lots of problems with sharepoint services. There are known bug with it that don't have solutions (yet).

你的看法呢?

(必要的) 
(必要的) 
(選擇性的)
(必要的) 

請輸入以上的數字:

【請注意】意見送出後可能需要幾分鐘才會出現在網頁上,請耐心等候。

搜尋

Go

<September 2007>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
 
RSS
最新回應


BlogLook Score and Rank

Syndication