Asynchronous Inserts

G

Guest

I need a way to do this insert below asynchronously and I'm pretty much lost
at this point.

Is there some example out there using Enterprise Library 2.0? We don't care
about the return, it's just a call to run a method in my class which performs
the insert and we need to give the call back to the client or something...I
guess this is asynchronous.
I am still a bit foggy on how asynchronous works (I guess you return the
call to the client and then on another thread it calls the method, not sure)
and there seems to be many approaches out there but nothing I found which
really shows me a good way to do it. I want the newest best way to do this
with a large public database with the most minimal effort. We get around 1.5
million hits a day. We're talking around maybe 100,000 inserts per minute
possibly. That's why we need to asynchronously call my method which performs
the insert. Maybe on another thread, maybe through ATLAS, who knows. I am new
to threading totally. Maybe threading isn't the best way, I am up in arms at
this point after searching for an hour on the net.

Is using ADO.NET commands the same as using commands in the Enterprise
Library Data class?

My boss told me in the beginning when I started to create a class to perform
the insert not to use ADO.NET but rather the Enterprise Library which was new
to me. I figured that out, very cool.

So the requirement here is to use the Enterprise Library classes to perform
the asynchronous insert. If there isn't a way to do that, I need help with
another way then.

Any advice, examples, direction here? I have seen using delegates, etc. but
really don't know if that's for us or how to determine if that's for
us...among other ways. I am also looking for other ways in which I have not
come across yet.

Our environment:

..NET 2.0
C# ASP.NET
VS 2005
Testing on our local PCs, we have no test server as of yet
VSS 2005

Here’s my insert statement:

public static void InsertSearchTerm(string SearchTerm)
{
DateTime CreateDate = DateTime.Now;
Int32 ResultCount = 1;

try
{
DatabaseFactory.CreateDatabase().ExecuteNonQuery("mystoredproc", SearchTerm,
ResultCount, CreateDate);
}
catch
{
throw;
}

}
 
S

sloan

You might look at the

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/PAIBlock.asp

It was not pulled forward into the Enterprise Library.

But the build from 2003 is still stable.

This is truly as async method, as the process lives on a windows service
somewhere.

The application blocks lets you specify
ThreadCount
ProcessTimeMax
stuff like that.

and you have a db record if something didn't work. aka, it just doesn't
float out to never never land.

Run the client sample, but comment out all but 1 request. You'll then see
how it works. ("Bank1" i think it was).
 
W

wfairl

Why do these inserts take so long? If you're doing some sort of
validation in the insert routine I would consider just dumping the raw
data in a "temporary" table and having a backend process (windows
service, database job, etc) poll, validate/clean, and insert the
records. The only other scalable and reliable solution would be to use
some sort of message queueing framework.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top