How to take the advantage of a high end box with 4 cpus running win2k3 server with C# programming

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi,
I'm programming an application with .net C#. The application will talk to
SQL Server on same box. The box has 4 P4 CPUs running Win2k3 server. I have
a question here, what kind of technique I should use to take the most
advantage of the box besides multi-threading?

Thanks in advance!
Mark
 
Hi,

What the application does ?

Multi thread is good for lenghtly processing, especially when you have more
than one processor, if the application is a web app for example you don't
have to spawn new threads as multiples request should execute concurrently
on different processors.

Cheers,
 
Hi,
It's a windows application and will query data multiple times from SQL
Server, does some calculation and update the table with the results.
I did some test for that with threading. I initialed 30 threads and started
them. Only some were executed and others looked like never started. What did
it happen? I missed something?

Thanks,
Mark
 
Mark said:
It's a windows application and will query data multiple times from SQL
Server, does some calculation and update the table with the results.
I did some test for that with threading. I initialed 30 threads and started
them. Only some were executed and others looked like never started. What did
it happen? I missed something?

Without seeing your code, it's impossible to tell. The connection pool
may be throttling the number of concurrent connections to your server
though. Also if you're updating your UI from the worker threads, that
would cause problems.
 
Jon,
Probably too many classes and lines to post them. But you reminded me.
Originally my single thread program use one sql connect pool with default
its properties which has 100 connections inside. All jobs done by one
object, the object at least talks to SQL Server 5 times. Then I changed the
program by manually start 30 worker threads and each thread runs with one
object (each object has different target to avoid dead lock issue). Then the
worst case, some threads cannot get the sql connection. The UI is only
updated by main thread.

I will increase the connection number in the sql connection pool and try
again.

Thanks,
Mark
 
Back
Top