[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
send_ldap_ber mutex overhead
The attached patch avoids grabbing conn->c_mutex unnecessarily. Testing on my
laptop with test008 and SLAPD_DEBUG=0 shows a 33% speedup. Before moving ahead
with this patch, I'd like to verify that ITS#5835 doesn't reappear. Anyone
able to test and report back?
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--- result.c 2013-01-07 05:33:58.000000000 -0800
+++ result.c.N 2013-01-07 05:33:48.000000000 -0800
@@ -320,6 +320,7 @@
while( 1 ) {
int err;
+#if 0
/* lock the connection */
if ( ldap_pvt_thread_mutex_trylock( &conn->c_mutex )) {
if ( !connection_valid(conn)) {
@@ -334,9 +335,12 @@
}
continue;
}
+#endif
if ( ber_flush2( conn->c_sb, ber, LBER_FLUSH_FREE_NEVER ) == 0 ) {
+#if 0
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+#endif
ret = bytes;
break;
}
@@ -356,6 +360,7 @@
conn->c_writers--;
conn->c_writing = 0;
ldap_pvt_thread_mutex_unlock( &conn->c_write1_mutex );
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
connection_closing( conn, "connection lost on write" );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
@@ -368,7 +373,9 @@
slapd_set_write( conn->c_sd, 2 );
ldap_pvt_thread_mutex_unlock( &conn->c_write1_mutex );
+#if 0
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+#endif
ldap_pvt_thread_pool_idle( &connection_pool );
ldap_pvt_thread_cond_wait( &conn->c_write2_cv, &conn->c_write2_mutex );
conn->c_writewaiter = 0;