C# Performance Issue - performance

I am facing a very strange situation and don't know how to solve it...Please help me solve the issue...
I am working on a web site where a research page is created to measure the performance of tasks done in the web site. It is one type of report page which checks for different conditions into the database tables, retrieves the information and send an email to the administrator. The page runs in every hour that is 24 times per day.
Now what the issue is: The web site works correctly however when the research page runs the other pages of the web site do not work correctly. That is say for example I am on the Page1 and at the same time the research page start running. Now at this time - when research page is running - if I click on the link of Page2, the Page2 will not get displayed until research page finishes its working. Can anyone tell what could be the issue for this behavior?
Here are some more information regarding the issue:
The web site is in Visual Studio 2008 (C#) and SOL Server 2008 is
used
The SOL query is too complex for research page however, I have made
all the optimization which are possible.
There are two connection strings (with different user for same
database) used in the web site. One for the Research page and second
for all the other pages in the site
Please help me find out the issue... Thanks in advance....

This may be due to mishandling of the Thread within you website. Have you tried it by Threads and Building Asynchronous Handlers in Your Server-Side Web Code
Just check out this might help you with :
http://msdn.microsoft.com/en-us/library/ms741870.aspx
msdn.microsoft.com/en-us/library/ms741870.aspx
http://www.albahari.com/threading/part3.aspx
And also do take care of releasing the necessary resources which might be locks up the Table, even though the Thread function gets over.

Related

Blank page on Azure

I have an application running in Azure (trial account). So far so good, everything has been nice, except for a long deploy times (10-15 minutes).
I've done a deploy recently and got a lot of weird bugs I cannot trace. For example, if I log in and thus a cookie is created (I use FormsAuthentication) all I get from the application is a blank page, as in, absolutely nothing is sent to the browser. The application works fine in the ASP.NET Web Dev Server, IIS Express, even the Azure Emulator!
What could be the issue? Searching the web hasn't been much help, with only a couple of unrelated issues.
I tried logging into the site (if I correctly understood from one if the comments, the url is versulo.com) and I didn't get any blank page with 404 status code.
However, there is another problem I spotted. Your site seems to be implementing caching inappropriately. The main page, the one from which you trigger the login and which is dynamic in nature contains an Expires header set at 5 minutes after the pages first load. That means that each call or redirect to that page within 5 minutes since it was first loaded, will be served from the browser's cache.
Because of that, after I login into your application I am redirected back to the home page which looks like I am not logged in. If I force a F5 refresh on the browser, then the page will indeed show me as logged in.
If instead of a refresh I try to login again (which is what I did in my first trials, since it looked like the login didn't work in the first time), I am getting an error page with the following message:
Sorry, there has been an error on the server.
500
The page looks like an application error page and even if it displays the 500 number, it is actually served with an HTTP 200.
So, while I am not 100% sure if this is also the cause of the problem described by you, you should remove the Expires headers from the dynamic pages your application is serving.
This can be because you're combining Forms Authentication with multiple instances. Are you using multiple instances? If that's the case, could you:
Try to change it to 1 instance. Does this fix the issue?
Try to make the following change to the web.config (configure machineKey): http://msdn.microsoft.com/en-us/library/ff649308.aspx
some partial views are not rendered at all;
Do you mean some pages are working fine, but others are not? It would be better if you can point out a pattern on what’s working and what’s not? For now, please make sure all referenced assemblies (except for default .NET assemblies and Windows Azure runtime) have Copy Local set to true. For example, MVC assemblies are considered as extensions to .NET, so please set Copy Local to true. In addition, you can also try to use Fiddler to monitor the requests to see what’s returned from the server.
Best Regards,
Ming Xu.
Could you provide a link to the application, or perhaps some source code?
When you say 'blank page', what is actually returned, a 404 / 500?
Have you inspected the IIS logs, or added some trace information to your code?
Have you tried accessing the service using it's ip address rather than domain name?

Kohana execution time is fast, but overall response time is slow, why?

I use the Kohana3's Profiler class and its profiler/stats template to time my website. In a very clean page (no AJAX, no jQuery etc, only load a template and show some text message, no database access), it shows the request time is 0.070682 s("Requests" item in the "profiler/stats" template). Then I use two microtime() to time the duration from the first line of the index.php to the last line of index.php, it shows almost very fast result. (0.12622809410095 s). Very nice result.
But if i time the request time from the browser's point of view, it's totally different. I use Firefox + Temper data add-on, it shows the duration of the request is 3.345sec! And I noticed that from the time I click the link to enter the website (firefox starts the animated loading icon), to when the browser finish its work(the icon animation stops), it really takes 3-4 seconds!!
In my another website which is built with WikkaWiki, the time measured by Temper Data is only 2190ms - 2432ms, including several access to mysql database.
I tried a clean installation of kohana, and the default plain hello-world page also loads 3025ms.
All the website i mentioned here are tested in the same "localhost" PC, same setting. Actually they are just hosted in different directories in the same machine. Only Database module is enabled in the bootstrap.php for kohana website.
I'm wondering why the kohana website's overall response is such slow while the php code execution time is just 0.126 second?? Are there anything I should look into?
==Edit for additional information ==
Test result on standard phpinfo() page is 1100-1200ms (Temper data)
Profiler shows you execution time from Kohana initialization to Profiler render call. So, its not a full Kohana time. Some kind of actions (Kohana::shutdown_handler(), Session::_destroy() etc) may take a long time.
Since your post confirms Kohana is finishing in a 1/10th of a second and less, it's probably something else:
Have you tested something else other than Kohana? It sounds like the server is at fault, but you can't be sure unless you compare the response times with something else. Try a HTML and pure PHP page.
The firefox profiler could be taking external media into consideration. So if you have a slow connection and you load Google Analytics, then that could be another problem.
Maybe there is something related with this issue: Firefox and Chrome slow on localhost; known fix doesn't work on Windows 7
Although the issue happens in Windows 7, maybe it can help...

Sporadic page load failure

An issue has started recently, within Chrome and reportedly Firefox, pages would be loading fine and browsing would be as normal and then suddenly then a page would fail to load (continuing to spin as if loading). The page that fails is often not the same.
If I refresh the page or try to goto another page on the domain within the same browser, the browser doesn't even try to resolve the name or make a connection, and is then unable to load the page.
Swapping to another browser and I am back to browsing the domain normally again, while the original browser(in most cases Chrome) will not load the pages until a restart.
This has happened with 3 different people on 3 different machines in both Chrome and Firefox.
The domain that it is running off has allot of ajax calls within certain pages, I am not sure if the server is tripping out due to the number of requests from the one client...I am not sure.
I am not sure if this is a server, client or script functionality issue, as I can not personally reproduce it. I can do little to debug or work out what is causing this or how to fix it...
As you can see I am not sure of allot with this problem :) so I am throwing it out to stack-overflow in the hope that someone may have had similar experiences or have any directions I could look towards.
Cheers,
Brendan
If the page is making many requests in a short time, your firewall (router) may block it. I've noticed this behavior on my own router, and had to set it to a less restrictive level to make things work.

loading dotnetnuke into memory in background

If there were no visits to the dotnetnuke portal for some time, depending on the host, the dotnetnuke is unloaded from server's memory. The first visitor that comes next is then forced to wait about 15+ seconds (depending on server's speed) in order to see the page. Dotnetnuke is a big framework but sometimes ends up serving low traffic sites also and that causes this unpleasant situation.
My idea is to show the static index.html page which holds the html code from the default.aspx dotnetnuke page and execute XMLHttpRequest via javascript onLoad to "get" the default.aspx to start loading.
My first page is a long sales letter and I would like the dotnetnuke to load in background while people read the sales letter and hopefully the page will be loaded when they decide to click a link or a menu item that links to some dotnetnuke page. If they click the link before it loads and are the first to visit the site they will still have to wait, but the ones that are there for the very first time (and are reading the letter) are the ones I don't want to loose over waiting for the site to come up.
So every time when I modify the content on default.aspx I would need to create a new index.html page and overwrite the old one.
I can do that with the same XMLHttpRequest in just a few lines of code.
So, what do you think?
Since I'm not all that in web development or dotnetnuke I want your opinion and/or your advice how people deal with this.
ps. since my host doesn't let me to install dotnetnuke into a root folder I had an index.html page that redirected to /dnn/Default.aspx
This way I can actually have the index.html page with all the content in my root folder and let the search engines take that page instead /dnn/Default.aspx and would not have to preform any automatic redirects.
pps. I am aware of the services that check your site for free every 15 or 30min, but that's not the answer since it messes up my visit statistics.
I think you might be overthinking this.
Sign up for a free web site monitoring service (there are tons out there) that will check your site every 10 or 15 minutes. This will keep the application in memory and give you a bonus of having your uptime monitored.
Ivan,
There are many cheap "ping" solutions that can keep your site alive by making periodic requests to the web server. I would consider this option first, as it won't require any special coding on your behalf.
Just google dnn keep-alive; http://www.google.com/search?q=best+dotnetnuke+keep+alive+solutions&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Caching issue in frameset frame

I have a web application and it is done in VS 2003[C#].
There is a frameset which is divided into 3.
TopFrame
LeftFrame
ContentFrame
LeftFrame loads contents related to each logged in user. The contents are loaded from SQL Server 2000 database.
But there occurs a strange problem when one user logs out and another logs in. The leftframe for the first user is shown to the new user logged in. The code executes normally but the content is not shown properly.
I think this is a caching issue. Right now we have disabled the caching of each page by setting
HttpCacheability.NoCache
But this makes the page loading slower. Is there any alternative way to solve this issue?
Thanks
I hope this article will help you.
http://www.15seconds.com/issue/030528.htm
SUMMARY : Any developer who has had the dubious task of developing a
Web site utilizing frames knows it can
be an uphill battle.
1. Frames are Evil
2. The Devil created Frames
3. If you are having a problem related to the Target, refer to item 1
4. If you are trying to refresh data in a particular frame, refer to 1

Resources