I think Application_EndRequest has seriously performance problem.

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
5/19/2008 9:47:49 AM
Gravatar
Total Posts 59

I think Application_EndRequest has seriously performance problem.

Hi, Joe:

Below code in file Global.asax:

///////////////////////////////////////////////////////////////////////////////////////

protected void Application_EndRequest(Object sender, EventArgs e)
{


// update user activity at the end of each request
// but only if the siteUser is already in the HttpContext
// we don't want to lookup the user for little ajax requests
// unless we have to for security checks
if (HttpContext.Current.User == null)
return;

SiteUtils.TrackUserActivity(); // this line lead seriously performance problem.
}

///////////////////////////////////////////////////////////////////////////////////////

e.g:

When I goto http://localhost:61085/home.aspx, will lead below request

//////////////////////////////////////////////////////////////////////////////////

http://localhost:61085/home.aspx
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/style.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/stylelayout.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/stylecolors.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/styleimages.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/styleborders.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/style-gridview.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/styletext.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/styleprinter.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/stylemenu.css
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/IESpecific.css
http://localhost:61085/App_Themes/default/theme.css
http://localhost:61085/WebResource.axd?d=wuHCulEJ7ItpvTZ6fgLBkA2&t=633397472718437500
http://localhost:61085/ClientScript/watermarktextbox.js
http://localhost:61085/ClientScript/CSSFriendly/AdapterUtils.js
http://localhost:61085/ClientScript/CSSFriendly/MenuAdapter.js
http://localhost:61085/ScriptResource.axd?d=sK6q5ioc8mEWjo2q9nKQPtBY4sRtnHpEd7lqG524156uhNaNXMuSHf-VcvraaViV0&t=633454710420000000
http://localhost:61085/ScriptResource.axd?d=sK6q5ioc8mEWjo2q9nKQPtBY4sRtnHpEd7lqG524154DwDegkJTwWZQmbE5ugfOEIQlmsnPv0N-CRTDVzfq3Kg2&t=633454710420000000
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/headerbg.jpg
http://localhost:61085/Data/SiteImages/admin.png
http://localhost:61085/Data/SiteImages/page_add.gif
http://localhost:61085/Data/SiteImages/edit.gif
http://localhost:61085/Data/SiteImages/pencil.gif
http://localhost:61085/Data/SiteImages/addthisbookmarkbutton.gif
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/square_arrow.gif
http://s7.addthis.com/js/152/addthis_widget.js
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/tableft.gif
http://localhost:61085/Data/Sites/1/skins/styleshout-techmania/tabright.gif
http://s7.addthis.com/css/152/addthis_widget.css
http://s7.addthis.com/select/select_load.png
http://s7.addthis.com/services/addthis-mini.gif

/////////////////////////////////////////////////////////////////////////////////

And every request will lead  Application_EndRequest(Object sender, EventArgs e) to be called,  and

lead SiteUtils.TrackUserActivity() to be called, and SiteUtils.TrackUserActivity()  will write my sqlitedb database,

for file database like sqltedb, it is a seriously performance problem.

A obvious result is my hard disk work too hard when i request a page.

Thanks!

 

5/19/2008 10:05:01 AM
Gravatar
Total Posts 18439

Re: I think Application_EndRequest has seriously performance problem.

Hi,

I will look into this and see if I can make it smarter so it does not log for non .aspx requests. One thing to keep in mind is this behavior only happens in the VS Web server not in IIS because in IIS .NET doesn't handle requests for all files (ie .NET doesn't handle requests for images in IIS) whereas in VS Web Server it does. So in a normal installation this is not happening, only requests for .aspx pages are getting site user tracking in a production environment.

Also there is a config setting to disable this entirely:

<add key="TrackAuthenticatedRequests" value="true" />

You could set this to false in user.config in your dev environment.

Best,

Joe

5/19/2008 10:20:46 AM
Gravatar
Total Posts 59

Re: I think Application_EndRequest has seriously performance problem.

Hi, Joe:

   

    I add <add key="TrackAuthenticatedRequests" value="false" /> in user.config or web.config, But it has no effect,  Application_EndRequest will be called too.

    Since this only happen in a production environment. I think it's not a problem then.

 

Thanks!

5/19/2008 10:24:52 AM
Gravatar
Total Posts 18439

Re: I think Application_EndRequest has seriously performance problem.

Application_EndRequest will always be called, but inside the TrackUserActivity method it will not update the db if this setting is false, so it should reduce file contention on your dev environment.

Please note that if you make a change to user.config it will not be noticed by ASP.NET unless you touch the Web.config file also by type a space in it and save.

Hope it helps,

Joe

5/19/2008 8:06:36 PM
Gravatar
Total Posts 59

Re: I think Application_EndRequest has seriously performance problem.

Hi, Joe

   I see.

   And I want ask whether in IIS .NET handle requests for *.css and *.js and *.axd?

   If handle these requests, then it's still a performance problem.

Thanks!

5/19/2008 8:39:47 PM
Gravatar
Total Posts 18439

Re: I think Application_EndRequest has seriously performance problem.

Hi,

In IIS, .NET will not handle requests for images, css or javascript or pdf or most any kind of file except .NET specific files like .aspx, .ashx, .asmx, .config, etc. For all files not specifically handled by .NET, IIS will handle those requests (much more efficiently I would add) and the request never invokes the ASP.NET pipeline. Now things may be changing a bit in IIS 7 as they are adding features I think to make it easy to handle more files types in .NET if you need to, but I think the default would still be not to handle them.  There are some cases where one might wish to be able to handle these requests in .NET. In IIS 5 or 6 it takes third party isapi filters to do it but I think they are making it more easy in IIS 7. Still, in most cases you are better off letting IIS handle requests for these kind of files for best performance.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.