1

Hi I want to increase the performance of asp.net application when multiple user access my application about 5000 users.

Can we do this

anjum
  • 2,363
  • 6
  • 28
  • 25
  • 1
    The question need a lot of more info, and to be more specific about your problem. – Amr Elgarhy Apr 11 '11 at 07:41
  • A lot more info, agreed... like, what is this application? What's your hardware? How many users can you support currently? –  Apr 11 '11 at 07:49
  • http://stackoverflow.com/questions/1340218/asp-net-website-slow-performance-on-production-server/1340629#1340629 – Muhammad Akhtar Apr 11 '11 at 08:15

2 Answers2

11

Your ASP.NET application performance depends on various things. You can improve your site's performance by doing various stuff. Your questions is very subjective and of course the answer would be some best practices about improving ASP.NET applications' performance.

I have gathered some tips from the net. Unfortunately, I cannot remember where. Search on any item and you will find many resources that can help you implement it:

  • Use Cache:
    • Page output caching.
    • Page fragment caching.
    • Data caching.
  • Avoid frequent trips to database.
  • Use DB-level paging. Don't retrieve unnecessary data that's not going to be shown in the current page.
  • Be careful with Session variables. Usually, you should avoid session variables because each ASP page runs in a different thread and session calls will be serialized one by one. So, this will slow down the application. Instead of session variables you can use the QueryString collection or hidden variables in the form which holds the values.
  • Select the Release mode before making the final Build for your application.
  • Set debug=false under compilation: <compilation default Language="c#" debug="false">
  • Avoid Inline JavaScript and CSS
  • Use Finally Method to kill resources. (But not in the case of using)
  • Avoid Exceptions: Use If condition (if it is check proper condition)
  • Check “Page.IsPostBack”. To avoid repetition code execution.
  • Use single css file instead of multiple css file.
  • Use Client-Side Validation. (but not all the time you have to validate even on the server side).
  • Turn off Tracing unless until required.
  • Turn off Session State, if not required.
  • Disable ViewState when not required.
  • Try to use StringBuilder instead of string.

    It is nice to use Stringbuilder instead of String when string are Amended. Strings occupy different memory location in every time of amended where stringbuilder use single memory location.

  • Never use object value directly; first get object value in local variable and then use. It takes more time then variable reading.
  • Avoid using code like x = x +1; it is always better to use x+=1.
  • Data Access Techniques: DataReaders provide a fast and efficient method of data retrieval. DataReader is much faster than DataSets as far as performance is concerned. But that depends on you deciding to balance between features/performance.
  • Use Repeater control instead of DataGrid , DataList, Because It is efficient, customizable, and programmable.
  • Reduce cookie size.
  • Compress CSS, JavaScript and Images.
  • Use server side compression software such as Port80s
  • Make your page files as light as possible. That is try to avoid unnecessary markups, e.g. use div elements instead of tables.
  • Write static messages in div and make it visible when necessary. This is faster than letting server set Text property of your label or div.
  • Retrieve necessary data from database at once, if possible. Don't add up to database trip as far as possible. For this, combine the datafields from different tables and select them.
Kamyar
  • 18,639
  • 9
  • 97
  • 171
0

Remove blank spaces from your html it will increase your kb. You can use regular expression to remove white spaces. I will post the code for removing white spaces next posts.

For asp.net 2.0 and higher version use master pages. It will increase your performance.

Use ADO.NET asynchronous calls for ado.net methods. asp.net 2.0 or higher version is supporting your performance. If you are using same procedure or command multiple time then use ADO.NET Prepare command it will increase your performance.

Do IIS performance tuning as per your requirement.

Disable view state for your controls if possible. If you are using asp.net 2.0 or higher version then use asp.net control state instead of view state. Store view state in session or database by overriding the default methods for storing view state

Use Ajax for your application wisely. Lots of Ajax calls for a page will also decrease your performance.

Call web service from java script instead of server side. Use asynchronous calls to call a web method from web service.