You must Sign In to post a response.
  • Category: ASP.NET

    Performance Issues when Multiple Users access website


    I have created website in (C#), and use sessions to store some information for each users, that creates at least 14 sessions for each users and total users would b around 58, but it slow down my website performance.

    Then I created xml files for each users and store information in it, and call that file on each page where ever I wana to use values stored in xml files, by this way I reduce no. of sessions from 14 to 3., thou, it shows much better performance, but still I am not satisfy with it, because every time user need to call his/her xml file, read it and close xml object.

    Now, I would like to have your expert suggest, to what should I do, to maximize website performance. Should I stick with XML strategy or should I use Dictionary to store xml data once as user login and store dictionary object in a session to access at all pages or any better solution.

    Note: each user have different values and secondly as sessions utilizes memory so it might effect when 58 users hit at a time (rare situation), and I also notice that sometimes users get the sessions values of different users.

    Looking forward to your kind response and thanking you in advance.
  • #766036
    There are some point you can consider for performance improvement 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 don't require Sessions, disabling it will help in improving the performance
    4. Disable View State as and when not required.
    5. Avoid Frequent round trips to the Database
    6. Avoid Throwing Exceptions. Exceptions are a grate 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
    9. Use SqlDataReader Instead of Data set wherever it is possible
    10. Avoid Inefficient queries
    11. Avoid Too many open connections

  • #766039

    First off all thanks to explain your requirement clearly, coming to your query as per my point of view for each login you are creating different session id, rather than creating different session id destroy the existing session id and and create new session id for new user with comma separator by existing user. Simple way what I suggested is use StringBuilder to concatenate all the users and store that StringBuilder in Session object.

    I hope this will improve your application performance.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #766045
    Hai M.A.Bamboat,
    First of all keeping more information or heavy information in the sessions is not preferable. Also it will always be the drawback when there are many number of sessions for each user. It will eat lot of memory for the individual user's browser and will slowdown the performance of the overall application.
    So do not keep more information in sessions and try to reduce the number of sessions for the user.
    The other way around is using Cookie instead of session will give you better performance because cookie is client specific so it will be created and stayed at the client machine.
    Also cookie is very light weight so it will not use much resources for the current system. Also when there is no needed e.g. you can clear the cookies once the user is logged-out or keep it in the system so it can be used later.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #766053
    Why can not you use this complex session management in the SQL Server(Database level). If you want to store lot of data or some complex level data. you can move you session management in database level. In the session store simple value and store the complex/more data in sqlserver. you can get the user related data by doing simple SQL server DB call. It will improve you performance.

    You can also handle the session directly in the SQL Server. Following is the link to know more about to store the session in the SQL server level.

    By Nathan
    Direction is important than speed

  • #766070
    Why you use more session variable, if you just want to transfer values from one page to another you can use querystring which is client side state management technique and it is light weight than session.
    session can be used in following conditions
    In either case you can keep load on sql server too. you can insert variable values in database and then fetch them back whenever you want.
    There are many ways to improve application performance
    you can check them in below link

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #766083

    Usually to imporve performance of website we keep below things in mind.
    Improve page response times.
    Design scalable Web applications.
    Use server controls efficiently.
    Use efficient caching strategies.
    Analyze and apply appropriate state management techniques.
    Minimize view state impact.
    Improve performance without impacting security.
    Minimize COM interop scalability issues.

    As per your problem statement because of large number of session,your application is crashing.I would suggest you to go for client side state management like cookies.

  • Sign In to post your comments