View Single Post
  #1 (permalink)  
Old 08-16-2003
rhochmuth rhochmuth is offline
Registered User
 
Name: Roland Hochmuth
Organization: HP
Project: RGS
 
Join Date: Aug 2003
Posts: 86
Overhead of Ice mutexes.

I have a method

void SenderImpl::consume(Widget w)
{
iceMutex.lock();

// Computationally expensive operation in critical secition.

iceMutex.unlock();
}

When invoking consume from a client application a single time with a large Widget, cpu utilization is around 25% (dual procesor system) on both the client and server, which is what I would expect in this case. I have a producer-consumer system that is computationally symmetric and serialized. It takes as long for the client to produce the Widget as it takes for the server to consume it. I would expect on a single processor system that cpu utiliazation would be around 50%. Here is a code snippet.

void ClientImpl:roduce()
{
// Computationally expnsive operation to produce Widget.
Widget *w = new Widget();

senderProxy->consume(w);
}
}

I tried subdividing the producing of the Widget into several smaller widgets (around thirty), and invoke consume() for each smaller widget as it is produced. This was an attempt to remove some of the serialization. Unfortunately, the cpu utilization triples on the server, and performance stays around the same. Here is a code snippet.

void ClientImpl:roduce()
{
for(i = 0; i<numWidgets; i++)
{
// Computationally expnsive operation to produce Widget.
Widget *w = new Widget(size);

senderProxy->consume(w);
}
}


What I'm trying to do is get as much of the producing and consuming operating in parallel. I was expecting performance and cpu utilization to almost double.

I haven't spent a whole lot of time looking into this yet, so I'm wondering what the overhead of Ice::Mutex is when waiting. In this case I have potentially thirty consume() disaptch threads waiting on a single mutex.

I've done this in a bigger system, so the example listed above has been simplified. I hope I didn't miss anything so I'll probably write an easy demo program later. OS is Windows
Reply With Quote