trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1171161 - in /trafficserver/traffic/trunk: iocore/net/UnixNetProcessor.cc proxy/http/HttpSessionManager.cc proxy/http/HttpSessionManager.h
Date Thu, 15 Sep 2011 16:10:36 GMT
Author: zwoop
Date: Thu Sep 15 16:10:36 2011
New Revision: 1171161

URL: http://svn.apache.org/viewvc?rev=1171161&view=rev
Log:
TS-924 Move per-thread cache initialization to thread creation

Modified:
    trafficserver/traffic/trunk/iocore/net/UnixNetProcessor.cc
    trafficserver/traffic/trunk/proxy/http/HttpSessionManager.cc
    trafficserver/traffic/trunk/proxy/http/HttpSessionManager.h

Modified: trafficserver/traffic/trunk/iocore/net/UnixNetProcessor.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/UnixNetProcessor.cc?rev=1171161&r1=1171160&r2=1171161&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/UnixNetProcessor.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/UnixNetProcessor.cc Thu Sep 15 16:10:36 2011
@@ -420,14 +420,16 @@ UnixNetProcessor::start(int)
 
   n_netthreads = eventProcessor.n_threads_for_type[etype];
   netthreads = eventProcessor.eventthread[etype];
-  for (int i = 0; i < n_netthreads; i++) {
+  for (int i = 0; i < n_netthreads; ++i) {
     initialize_thread_for_net(netthreads[i], i);
+#ifndef STANDALONE_IOCORE
+    extern void initialize_thread_for_http_sessions(EThread *thread, int thread_index);
+    initialize_thread_for_http_sessions(netthreads[i], i);
+#endif
   }
 
-  if (
-    0 == (incoming_ip_to_bind = IOCORE_ConfigReadString("proxy.local.incoming_ip_to_bind"))
-    || 0 != ink_inet_pton(incoming_ip_to_bind, &incoming_ip_to_bind_saddr)
-  )
+  if (0 == (incoming_ip_to_bind = IOCORE_ConfigReadString("proxy.local.incoming_ip_to_bind"))
||
+      0 != ink_inet_pton(incoming_ip_to_bind, &incoming_ip_to_bind_saddr))
     memset(&incoming_ip_to_bind_saddr, 0, sizeof(incoming_ip_to_bind_saddr));
 
   RecData d;

Modified: trafficserver/traffic/trunk/proxy/http/HttpSessionManager.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpSessionManager.cc?rev=1171161&r1=1171160&r2=1171161&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpSessionManager.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpSessionManager.cc Thu Sep 15 16:10:36 2011
@@ -39,6 +39,18 @@
 #define FIRST_LEVEL_HASH(x)   x % HSM_LEVEL1_BUCKETS
 #define SECOND_LEVEL_HASH(x)  x % HSM_LEVEL2_BUCKETS
 
+// Initialize a thread to handle HTTP session management
+void
+initialize_thread_for_http_sessions(EThread *thread, int thread_index)
+{
+  NOWARN_UNUSED(thread_index);
+
+  thread->l1_hash = NEW(new SessionBucket[HSM_LEVEL1_BUCKETS]);
+  for (int i = 0; i < HSM_LEVEL1_BUCKETS; ++i)
+    thread->l1_hash[i].mutex = thread->mutex;
+}
+
+
 HttpSessionManager httpSessionManager;
 
 SessionBucket::SessionBucket()
@@ -253,13 +265,7 @@ HttpSessionManager::acquire_session(Cont
     ink_code_MMH((unsigned char *) hostname, strlen(hostname), (unsigned char *) &hostname_hash);
 
   if (2 == sm->t_state.txn_conf->share_server_sessions) {
-    // Initialize the per-THread buckets if necessary
-    if (NULL == ua_session->mutex->thread_holding->l1_hash) {
-      ethread->l1_hash = NEW(new SessionBucket[HSM_LEVEL1_BUCKETS]);
-      for (int i = 0; i < HSM_LEVEL1_BUCKETS; ++i)
-        ethread->l1_hash[i].mutex = ethread->mutex;
-    }
-
+    ink_assert(ethread->l1_hash);
     return _acquire_session(ethread->l1_hash + l1_index, ip, port, hostname_hash, sm);
   } else {
     SessionBucket *bucket = g_l1_hash + l1_index;

Modified: trafficserver/traffic/trunk/proxy/http/HttpSessionManager.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpSessionManager.h?rev=1171161&r1=1171160&r2=1171161&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpSessionManager.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpSessionManager.h Thu Sep 15 16:10:36 2011
@@ -40,6 +40,9 @@
 class HttpClientSession;
 class HttpSM;
 
+void
+initialize_thread_for_http_sessions(EThread *thread, int thread_index);
+
 #ifndef TS_MICRO
 #define  HSM_LEVEL1_BUCKETS   127
 #define  HSM_LEVEL2_BUCKETS   63
@@ -65,6 +68,7 @@ class HttpSessionManager
 public:
   HttpSessionManager()
     { }
+
   ~HttpSessionManager()
     { }
 



Mime
View raw message