summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2007-08-11 02:35:37 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2007-08-11 02:35:37 +0000
commit5699285c78b1eb6f910b12c4cc0fc609e3bb59e8 (patch)
tree31838b942c9dfe51af9c6be0dad1960ddb43c1c1 /TAO
parent850459d8cd293d363ce38fcf8af3e2301ebe9664 (diff)
downloadATCD-5699285c78b1eb6f910b12c4cc0fc609e3bb59e8.tar.gz
Sat Aug 11 02:34:18 UTC 2007 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog18
-rw-r--r--TAO/tao/Transport_Cache_Manager.cpp136
-rw-r--r--TAO/tao/Transport_Cache_Manager.h16
3 files changed, 111 insertions, 59 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index c4e27224ad7..750de8da115 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,11 +1,21 @@
+Sat Aug 11 02:34:18 UTC 2007 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * tao/Transport_Cache_Manager.h:
+ * tao/Transport_Cache_Manager.cpp:
+
+ Reverting Dale's change. This causes tests to sieze up, at least
+ on linux.
+
Fri Aug 10 21:59:23 UTC 2007 Dale Wilson <wilsond@ociweb.com>
* tao/Transport_Cache_Manager.h:
* tao/Transport_Cache_Manager.cpp:
- The cache manager uses an index to distinguish between duplicate cache entries.
- It makes some invalid assumptions about this index. This changes corrects
- one of those assumptions which led to poor performance and/or failure of
- multithreaded latency performance tests.
+
+ The cache manager uses an index to distinguish between duplicate
+ cache entries. It makes some invalid assumptions about this
+ index. This changes corrects one of those assumptions which led
+ to poor performance and/or failure of multithreaded latency
+ performance tests.
Fri Aug 10 15:33:54 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
diff --git a/TAO/tao/Transport_Cache_Manager.cpp b/TAO/tao/Transport_Cache_Manager.cpp
index 9c0ad989efe..922e0b184a4 100644
--- a/TAO/tao/Transport_Cache_Manager.cpp
+++ b/TAO/tao/Transport_Cache_Manager.cpp
@@ -19,11 +19,11 @@ ACE_RCSID (tao,
Transport_Cache_Manager,
"$Id$")
-// notes on debug level and LM_xxxx codes for transport cache
+// notes on debug level for transport cache
// TAO_debug_level > 0: recoverable error condition (LM_ERROR)
// TAO_debug_level > 4: normal transport cache operations (LM_INFO)
// TAO_debug_level > 6: detailed cache operations (LM_DEBUG)
-// TAO_debug_level > 8: for debugging the cache itself (LM_DEBUG)
+// TAO_debug_level > 8: for debugging the cache itself
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -88,69 +88,72 @@ namespace TAO
// Update the purging strategy information while we
// are holding our lock
this->purging_strategy_->update_item (int_id.transport ());
- int retval = 0;
- bool more_to_do = true;
- while (more_to_do)
+
+ int retval = this->cache_map_.bind (ext_id,
+ int_id,
+ entry);
+ if (retval == 0)
{
- retval = this->cache_map_.bind (ext_id, int_id, entry);
- if (retval == 0)
- {
- // The entry has been added to cache succesfully
- // Add the cache_map_entry to the transport
- int_id.transport ()->cache_map_entry (entry);
- more_to_do = false;
- }
- else if (retval == 1)
+ // The entry has been added to cache succesfully
+ // Add the cache_map_entry to the transport
+ int_id.transport ()->cache_map_entry (entry);
+ }
+ else if (retval == 1)
+ {
+ // if this is already in the cache, just ignore the request
+ // this happens because some protocols bind their transport early
+ // to avoid duplication simultaneous connection attempts
+ if (entry != 0 && entry->item ().transport () == int_id.transport ())
{
- if (entry->item ().transport () == int_id.transport ())
+ // rebind this entry to update cache status
+ retval = this->cache_map_.rebind (ext_id,
+ int_id,
+ entry);
+ if(retval == 1) // 1 from rebind means replaced
{
- // update the cache status
- this->set_entry_state (entry, int_id.recycle_state ());
retval = 0;
- more_to_do = false;
}
- else
- {
- ext_id.index (ext_id.index() + 1);
- if (TAO_debug_level > 8)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager::bind_i: ")
- ACE_TEXT ("Unable to bind Transport[%d] @ hash:index{%d:%d}. ")
- ACE_TEXT ("Trying with a new index \n"),
- int_id.transport ()->id (),
- ext_id.hash (),
- ext_id.index ()
- ));
- }
- }
}
else
- {
- if (TAO_debug_level > 0)
- {
- ACE_ERROR ((LM_ERROR,
- "TAO (%P|%t) - Transport_Cache_Manager::bind_i, "
- "ERROR: unable to bind transport\n"));
- }
- more_to_do = false;
- }
+ {
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager::bind_i: ")
+ ACE_TEXT ("Unable to bind in the first attempt. ")
+ ACE_TEXT ("Trying with a new index\n")
+ ));
+ }
+
+ // There was an entry like this before, so let us do some
+ // minor adjustments and rebind
+ retval = this->get_last_index_bind (ext_id,
+ int_id,
+ entry);
+ if (retval == 0)
+ {
+ int_id.transport ()->cache_map_entry (entry);
+ }
+ }
}
- if (retval == 0)
+
+ if (retval != 0)
{
- if (TAO_debug_level > 4)
+ if (TAO_debug_level > 0)
{
- ACE_DEBUG ((LM_INFO,
- ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager::bind_i: ")
- ACE_TEXT ("Success Transport[%d] @ hash:index{%d:%d}. ")
- ACE_TEXT ("Cache size is [%d]\n"),
- int_id.transport ()->id (),
- ext_id.hash (),
- ext_id.index (),
- this->current_size ()
- ));
+ ACE_ERROR ((LM_ERROR,
+ "TAO (%P|%t) - Transport_Cache_Manager::bind_i, "
+ "unable to bind\n"));
}
}
+ else if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_INFO,
+ ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager::bind_i: ")
+ ACE_TEXT ("Cache size is [%d]\n"),
+ this->current_size ()
+ ));
+ }
return retval;
}
@@ -446,6 +449,31 @@ namespace TAO
entry->item ().recycle_state (ENTRY_PURGABLE_BUT_NOT_IDLE);
}
+ int
+ Transport_Cache_Manager::get_last_index_bind (Cache_ExtId &key,
+ Cache_IntId &val,
+ HASH_MAP_ENTRY *&entry)
+ {
+ CORBA::ULong ctr = entry->ext_id_.index ();
+ int retval = 0;
+
+ while (retval == 0)
+ {
+ // Set the index
+ key.index (++ctr);
+
+ // Check to see if an element exists in the Map. If it exists we
+ // loop, else we drop out of the loop
+ retval = this->cache_map_.find (key);
+ }
+
+ // Now do a bind again with the new index
+ return this->cache_map_.bind (key,
+ val,
+ entry);
+ }
+
+
bool
Transport_Cache_Manager::is_entry_available (const HASH_MAP_ENTRY &entry)
{
@@ -659,7 +687,7 @@ namespace TAO
// Do we need to worry about cache purging?
if (cache_maximum >= 0)
{
- current_size = static_cast<int> (this->current_size ());
+ current_size = static_cast<int> (this->cache_map_.current_size ());
if (TAO_debug_level > 6)
{
diff --git a/TAO/tao/Transport_Cache_Manager.h b/TAO/tao/Transport_Cache_Manager.h
index e95edd40092..72c9b1fcf44 100644
--- a/TAO/tao/Transport_Cache_Manager.h
+++ b/TAO/tao/Transport_Cache_Manager.h
@@ -176,7 +176,9 @@ namespace TAO
* Non-Locking version and actual implementation of bind ()
* call. Calls bind on the Hash_Map_Manager that it holds. If the
* bind succeeds, it adds the Hash_Map_Entry in to the
- * Transport for its reference.
+ * Transport for its reference. If the bind fails because
+ * of an exiting entry, this method calls the get_last_index_bind
+ * ().
*/
int bind_i (Cache_ExtId &ext_id,
Cache_IntId &int_id);
@@ -204,6 +206,18 @@ namespace TAO
void mark_invalid_i (HASH_MAP_ENTRY *entry);
private:
+ /**
+ * This is called by the bind () call when a bind fails with a
+ * available entry. When a new connection is created in TAO with an
+ * already existing endpoint, in addition to an exisitng one, we
+ * mark the connections with an index. This method, finds out the
+ * last highest index and binds the entry with an index = (last
+ * highest index + 1).
+ */
+ int get_last_index_bind (Cache_ExtId &key,
+ Cache_IntId &val,
+ HASH_MAP_ENTRY *&entry);
+
/**
* Tries to find if the <int_id_> in entry is available for use.
*/