Archived
This forum has been archived. Please start a new discussion on GitHub.
C# ThreadPool question
Hi,
I'm trying to use ICE with C# on Windows
I'm writing a simple server application which receives messages from clients.
In my server application I create a single object exposing a single interface.
From the client I connect to this server through a proxy object and send a message to the server 30 times per second.
I configured my server to use ThreadPool.
When I start 300 clients sending messages to one server it looks like ThreadPool doesn't work. I have 2x4 Core CPU server and if I open TaskManager I see that only 2 cores are doing something while another 6 are idle.
Server looks like this:
public class ServerI : IServerDisp_
{
public overrive void Message ( string msg )
{
...
}
}
If I have a single object serving all incoming requests and if I configure
ICE to use ThreadPool does this mean that method void Message could be called simultaneously by many threads?
Looks like there is some point of serialization where all requests are queued and then processed subsequently?
I'm trying to use ICE with C# on Windows
I'm writing a simple server application which receives messages from clients.
In my server application I create a single object exposing a single interface.
From the client I connect to this server through a proxy object and send a message to the server 30 times per second.
I configured my server to use ThreadPool.
When I start 300 clients sending messages to one server it looks like ThreadPool doesn't work. I have 2x4 Core CPU server and if I open TaskManager I see that only 2 cores are doing something while another 6 are idle.
Server looks like this:
public class ServerI : IServerDisp_
{
public overrive void Message ( string msg )
{
...
}
}
If I have a single object serving all incoming requests and if I configure
ICE to use ThreadPool does this mean that method void Message could be called simultaneously by many threads?
Looks like there is some point of serialization where all requests are queued and then processed subsequently?
0
Comments
-
Unfortunately FAQ doesn't help

Here is more theoretical question:
1. I have single servant ServerI
2. I create many Object Adapters and add this single Servant to each
3. Many clients connect through different object adapters to the single servant and execute the same method void Foo()
Question is: will there be any point of sinchronization where all the calls to method Foo() will be queued? or there is a possibility to call the same method Foo() simultaneously in different threads?0 -
Unfortunately FAQ doesn't help

Why doesn't the FAQ help? If the methods are not being concurrently dispatched by the Ice run time there can only be two reasons:
- There are not multiple threads in the thread pool attached to the servants OA.
- The methods are not called concurrently on the server.
What can also easily occur is that methods are dispatched concurrently, but you misinterpret the results. For example, if your servant implementation does almost nothing then there is little chance for methods to be concurrently called. Another easy way to misinterpret results is caused by your servant implementation itself preventing concurrent execution due to some synchronization. This does not mean that the Ice run-time is not calling your servant methods concurrently, it means that your servant has some synchronization that prevents the methods executing concurrently.Here is more theoretical question:
1. I have single servant ServerI
2. I create many Object Adapters and add this single Servant to each
Why would you want to do that? Except in special circumstances this is not necessary. See http://www.zeroc.com/faq/multipleOA.html for details.3. Many clients connect through different object adapters to the single servant and execute the same method void Foo()
Question is: will there be any point of sinchronization where all the calls to method Foo() will be queued? or there is a possibility to call the same method Foo() simultaneously in different threads?
The Ice run-time will not queue requests. A request is dispatched them as soon as a thread from the OAs thread pool is available.0