Home All Groups Group Topic Archive Search About

best use of vb.net and multithreading

Author
13 Apr 2006 8:37 AM
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

Author
13 Apr 2006 9:39 AM
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

<boo7***@yahoo.co.uk> schreef in bericht
Show quoteHide quote
news:1144917435.376804.207240@t31g2000cwb.googlegroups.com...
> 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
>
Author
13 Apr 2006 9:58 AM
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.

--
Patrice

<boo7***@yahoo.co.uk> a écrit dans le message de news:
1144917435.376804.207***@t31g2000cwb.googlegroups.com...
Show quoteHide quote
> 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
>
Author
13 Apr 2006 11:46 AM
Herfried K. Wagner [MVP]
<boo7***@yahoo.co.uk> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
13 Apr 2006 10:16 PM
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