Click here to Skip to main content
15,884,640 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am building an asp.net web application that that has many users working at the same time
(about 500 users) each page has many steps and each step must get data from database and then store all data from all steps into database
What is the best practice to build the application

What I have tried:

I have tried to load all data int the DOM and draw each step with JavaScript but the page was slow and also i have some troubles when send all page data once again to the database
Posted
Updated 16-Mar-20 11:23am

1 solution

Quote:
asp.net web application that that has many users working at the same time
(about 500 users)
That should not be a problem in an average ASP.NET web application. Your application should work just fine.
Quote:
each page has many steps and each step must get data from database
Once again, this is also fine. Just query a database table and render the data on the page. If you are worried about performance, then try caching the data if you feel the data can be valid for 10 - 15 minutes. But due to the next part of your question, I doubt this.
Quote:
then store all data from all steps into database
For this step, you would need to use a TRANSACTION object in the SQL. Since multiple users (500, as per your question) are making a change at the same time, a TRANSACTION should only execute if all the changes (in every table) have been made. If any change invalidates the data consistency, then it should fail.

Transactions (Transact-SQL) - SQL Server | Microsoft Docs[^]

Apart from TRANSACTIONs, you should look into stored procedures, there is not much difference when it comes to running the query by hand or calling a stored procedure with a query — some caching benefits for the query engine.

Stored Procedures (Database Engine) - SQL Server | Microsoft Docs[^]
Quote:
I have tried to load all data int the DOM and draw each step with JavaScript
Use a front-end framework for this approach, and load the data in parts. React framework can be implemented with each page as a separate component that loads a fresh copy of data for the UI state.
Quote:
but the page was slow
Perhaps the browser was not good enough, maybe the machine was slow or the resources were low. Just because your page was slow does not mean the code was incorrect — a general suggestion is to never load all the data on the web page &madsh; you should look into the browser tools to check how the page is working.
Quote:
also i have some troubles when send all page data once again to the database
Then do not push the data at once, upload the data in chunks. Perhaps run one query at a time.

Are you sure your machine is powerful enough to support a database engine, a web server and a debugging session on a browser?
 
Share this answer
 
Comments
ziad imad 16-Mar-20 17:41pm    
yes the machine was very good i even used server for iis and another for database
but the problem with javascript because iam doing alot of processing on the DOM
MadMyche 16-Mar-20 18:42pm    
So you know the problem is with the JS on the page; yet you tag all of this as if the problems are in ASP.NET and SQL?
Afzaal Ahmad Zeeshan 17-Mar-20 7:02am    
As I said, try using a front-end framework and distribute the work among different components that load the data as needed and discard it (or save it in localStorage APIs) as needed.

Loading the full batch of data in a single instance of DOM is not good. By this I mean rendering the data in the DOM, just downloading and keeping the batch in memory is a different story.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900