cralexns
cralexns

Reputation: 53

ASP.NET Website Slow Performance on production server

My problem is that my ASP.NET website is running slower on my production server comparatively on my development server.

A page that executes in 120ms in my development environment takes 400ms to execute on the server. I've monitored the SQL server with the profiler and the query being run on the page taking 400ms on the server only takes around 50ms to finish - so I've convinced myself that my problem does not lie with the SQL server.

My development machine is an Intel I7 with 6GB RAM, the production server is a 2x AMD Quad Core with 16GB ram.

Upvotes: 2

Views: 30680

Answers (10)

Yasir Ayaz
Yasir Ayaz

Reputation: 91

If you have already looked into all the possible code optimzation and still facing performance issues this could be the reason:

Check your Web.config and remove the following.

 <system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers></system.codedom>

These can be safely removed from the web.config if you do pre-compilation and only use the compiled assemblies on the webserver.

Upvotes: 0

cralexns
cralexns

Reputation: 53

After banging my head against the wall for a long time concerning the performance difference of my development machine and the production machine, I finally caved in to the feeling I've been having deep down that the processor actually matter a lot more than you'd think.

I changed from an AMD based solution to an Intel based solution (Xeon!), gaining .3GHz and faster disks.

I also gained a performance boost, instead of being x3 as slow as my development machine it's now down to something like x0.75 slower - obviously still not the lightning speeds that my development machine is capable of but it's getting closer.

While debugging this further I noticed that most of the performance hog (which is no surprise really) is coming from LINQ to SQL having to compile queries, what seems odd to me is that once I tried precompiling a LINQ query and running the same thing on both my machines, the development machine turned out to be faster.

Upvotes: 0

Martin
Martin

Reputation: 11041

From reading all the suggestions, and it seemingly like nothing is working, start taking code out of your site, little by little, and see how that affects time. Remove about 10 lines of code or HTML at a time, and see if there is a huge difference.

Otherwise, it probably has to do with IIS, and sorry, I ain't no IIS guru.

Upvotes: 1

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

There are some point you can consider for performance improvment of your website.

  1. Set debug=false
  2. Turn off Tracing unless until required
  3. Turn off Session State, if not required. ASP.NET Manages session state automatically. However, in case you dont require Sessions, disabling it will help in improving the performance
  4. Disable ViewState as and when not required.
  5. Avoid Frequent round trips to the Database
  6. Avoid Throwing Exceptions. Exceptions are a greate way to handle errors that occur in your application logic. However, throwing exceptions is a costly resource and must be avoided. Use specific exceptions and use as minimal as possible to avoid resource overhead
  7. Use Caching to improve the performance of your application.
  8. Use Finally Method to kill resources

Edit: measure your website performance using this website http://www.websiteoptimization.com/services/analyze/
http://www.websitepulse.com/

Upvotes: 17

Magnus Johansson
Magnus Johansson

Reputation: 28325

Have you checked that the debug=false in your web.config?

Is the server 64bit? Try to create a dedicated application pool for your application and set the application pool to run in 32bit classic mode. Makes that any difference?

Is you class pre-compiled or have you set it up to compile at runtime?

Upvotes: 6

Greg
Greg

Reputation: 16690

You need to reduce the variables.

Try eliminating all of the differences between the two environments, then make changes one by one until you figure out what it is.

Make sure that the web.config is the same in both environments.
Make sure both environments point to the same database server on a 3rd box.
Make sure the same version of IIS is in both environments.
Make sure IIS is configured the same in both environments.
Run the same test data on both environments.
etc...

Upvotes: 0

Cyril Gupta
Cyril Gupta

Reputation: 13723

Is this the only website you have on the server? 16 GBs is pretty good memory, but if there are many popular websites on that same server they could be eating up the resources and CPU time.

Other than that I can't think of any reason why your website would be slow on production than in development.

Did you check out the indexes? They're all there on the server?

Upvotes: 0

Stephen Newman
Stephen Newman

Reputation: 1977

Massive viewstate causing transmission delay?

Upvotes: 0

Mike McClelland
Mike McClelland

Reputation: 193

Is your SQL server on another server on production, but local on development?

Upvotes: 2

lingvomir
lingvomir

Reputation: 2584

Set Trace="true" (<%@ Page Trace="true"...) in your page and you will get a lot of useful information at the bottom of the page when it loads in the browser. You will know exactly how much time is needed to process the request on the server. If the time is low enough, then the problem could be in the IIS settings. Compare them to the ones on your dev environment.

Upvotes: 3

Related Questions