I am working on a new function for a ASP.NET MVC website. The execution time is quite long at present so I am considering options.
The function takes an excel spreadsheet, uploads it to the web server. It then needs to select all of the rows and using Entity Framework insert the rows in to a database. Each row matches the required entity model. Currently at only 50000 rows, this process takes a while and I would assume the row count will grow in the future.
I have a few options for processing here and I am wondering if there is a better way to handle it. The two ideas I have just now are
1) Pass the work off to a service, which on completion emails the user. The obvious upside being the user doesn't need to keep that browser window open. 2) Add a progress bar and have the service pass updates back to jquery/javacript to do visual updates.
I will attempt to reduce the time, possibly moving the queries away from relying on Entity Framework. Sometimes stored procedures are a lot faster than Linq To Entities but with that aside, the process may still take more than a few seconds, which I don't really want to burden the user with.
Can anyone think of other/better ways to handle long running processes on a web application? Are there any best practice schools of thought on handling these situations?
LINQ to Excel
to parse it but it takes a bit too long. Considering requesting people save to csv before import, that way I can bulk insert to SQL.BULK INSERT
thought wont work as I am using a remote SQL Server. I do not want to create a dependency on a shared folder for the file to be made available to the server.