best use of vb.net and multithreading

B

boo73uk

Hi All,
I'm going to rewrite a VB6 app to VB.net and I need some pointers.
Basically this app spawns simultaneous,multiple, independant
ActiveX.exe 'workers' which query a SQL Server database and BCP a load
of data out.
Now, what is the best way to approach this in .Net? Can .Net give me a
better way of utilising the resources of the server? We're also getting
some new hardware, 2 CPU Xeon rig with HT (hyper threading). Are there
any techniques which I need to investigate? Any pointers or links to
web articles will be greatly appreciated.

Many thanks,
Pete
Newbie .Net Developer - Peterboro, UK
 
C

Cor Ligthert [MVP]

Boo,

It seems that every new user from Net want to use multithreading. The best
approach trying to avoid it.

It is usefull in situations of slow multi serving dataproviders by instance
if you have *more* databaseservers in one application or *more* different
data giving webservices in one application. For by instance a disk it should
theoratical give more rumble of the diskheads.

Some people want to use it to keep the close button alive. Nobody has missed
that until now in my opinion, but you can use for that the backgroundworker
in version 2005.

Be aware that multithreading cost forever more processing time. You can win
with multithreading throughput time but be aware that it is not a kind of
optimistic multiprocessing. You have yourself to be sure, that you by
instance do not make it posssible, that a user starts working with the data,
while he has only the half what he needs to start.

(It has nothing to do with your processors by the way, there are enough
threads running in a modern windows OS to benefit from that). By instance a
ASPNET application is going already for every client in a seperate thread.

Some can have others ideas, this are mine.

I hope this gives you some ideas as well.

Cor
 
P

Patrice

My first move would be to look as how efficient loading is (SqlBulkCopy for
2.0, SqlXml for 1.1) that was really fast when I gave it a try.

Keep in mind that multithreading is a double edge sword i.e. if you are
willing to improve performance you have to think where real parallelism
could occur.
 
H

Herfried K. Wagner [MVP]

I'm going to rewrite a VB6 app to VB.net and I need some pointers.
Basically this app spawns simultaneous,multiple, independant
ActiveX.exe 'workers' which query a SQL Server database and BCP a load
of data out.
Now, what is the best way to approach this in .Net? Can .Net give me a
better way of utilising the resources of the server? We're also getting
some new hardware, 2 CPU Xeon rig with HT (hyper threading). Are there
any techniques which I need to investigate? Any pointers or links to
web articles will be greatly appreciated.

Basically you can use the classes in the 'System.Threading' namespace such
as 'Thread' to spawn operations in separate threads. The 'Monitor' class
and the 'SyncLock' keyword provide synchronization mechanisms.
 
B

boo73uk

Dear All,
Thanks for your replys so far.

I've had a look at SqlBulkCopy but and this early stage I can't see
that it can export data out to .bcp files. Can it do this or is it just
for inserting rows into databases?

Cheers,
Pete
 

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