RSS

A Message Board, Guestbook, or Poll hosted for your website.
Iron Speed Technical Forums

Register Login New Posts Chat
 
Iron Speed > Forums > Code Customizations V5.X > Long running Data task example please
 
Username:  
Password:  
 
   
 


Thread Tools Search This Thread 
Reply
 
Author Comment
 
nez
Registered: 04/02/06
Posts: 91

    10/17/07 at 03:45 PMReply with quote#1

Hi, has anyone done a long running, data intensive process with the ISD business layer?

I need to process over 5,000 records & do complex validation, data updates & inserts all at the click of a button.

I have found a few good examples on the web about long running processes in asp.net with various methods for reporting progress. Was just wondering if anyone has any notes on multi threading with database tasks (concurrency, what if the user clicks the back button & then the GO button again?, etc)

Cheers for any input,
Nez

razi
Avatar / Picture

Co-Founder
Registered: 10/14/03
Posts: 694

    10/17/07 at 04:10 PMReply with quote#2

Why not start a separate thread upon button click - and then send a confirmation email when the task is complete.

 

Regardless of whether you use Iron Speed Designer or not, it is always a good idea to do intensive processes in a separate thread asynchronously. Another example of this is importing data - better to do it asynchronously and send a confirmation email when complete.

Thanks,
Razi

 

nez
Registered: 04/02/06
Posts: 91

    10/17/07 at 07:13 PMReply with quote#3

Thanks for the reply razi, yes I plan to use a seperate thread, was just wondering what issues I may run into with multi threading & the datalayer but I have been doing some test & it seems to be working great.

Cheers,
Nez

glenn
Registered: 09/26/07
Posts: 74

    02/29/08 at 11:39 AMReply with quote#4

Another great way to process a large process asynchronously is to create a stored procedure (or CLR managed procedure), deploy to your SQL Server, create a job entry in the SQL Server Agent that points to your work stored procedure.

Create another stored procedure to call:

EXEC msdb.dbo.sp_start_job @job_name = 'yourjobname'

This will execute the stored proc as an asynchronous process within SQL Server.

You can use the sp_help_job in another stored procedure to return the execution status, etc.

This way you drop the workload completely off the client and into the database (potentially more secure) and you can have a background client thread that polls sp_help_job to capture status to provide user feedback.

This is such an easy way to implement asynchronous processes in your application (assuming you are using SQL Server) you will wonder how you ever did stuff without in the past.



__________________
Regards,
Glenn
AltVader
Registered: 05/21/09
Posts: 48

    07/16/09 at 03:22 AMReply with quote#5

Is there a direct way  in IS to create a new thread for a long data process as Razi suggests?  I have a similar task: recalculate 150 fields in a data table x 2500 records. Code works great when I save a single record, but of course times out when I try to update all rows in one shot.

thanks,
da
AltVader
Registered: 05/21/09
Posts: 48

    07/16/09 at 08:04 AMReply with quote#6

Thanks, Brid. You're right of course, call a stored procedure. My problem is I've written it in Iron Speed (using IS objects throughout) and to implement it in a stored procedure would be a lengthy task (unless I'm overlooking something). It took a week to write the existing routine.

To avoid having to write it over, I am seeking a way to simply spawn a thread in IS and execute IS code within it. Any ideas??


Previous Thread | Next Thread
Reply

  Bookmarks  
Digg Diggdel.icio.us del.icio.usStumbleUpon StumbleUponGoogle Google

Download Iron Speed Designer

Privacy Statement