You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/06/28 14:05:49 UTC

svn commit: r1750514 - in /tomcat/native/trunk: native/src/ssl.c xdocs/miscellaneous/changelog.xml

Author: markt
Date: Tue Jun 28 14:05:49 2016
New Revision: 1750514

URL: http://svn.apache.org/viewvc?rev=1750514&view=rev
Log:
Correct a potential performance problem identified by Nate Clark due to Tomcat Native providing OpenSSL with thread identifiers poorly suited to the hash function used by OpenSSL when selecting a bucket for the hash that holds the per thread error data.
Tomcat Native on Windows was not affected.
This fix applies to OSX and Linux.
Other platforms may still be affected.

Modified:
    tomcat/native/trunk/native/src/ssl.c
    tomcat/native/trunk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/native/trunk/native/src/ssl.c
URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/ssl.c?rev=1750514&r1=1750513&r2=1750514&view=diff
==============================================================================
--- tomcat/native/trunk/native/src/ssl.c (original)
+++ tomcat/native/trunk/native/src/ssl.c Tue Jun 28 14:05:49 2016
@@ -20,6 +20,10 @@
 #include "apr_atomic.h"
 #include "apr_poll.h"
 
+#ifdef __linux__
+#include <sys/syscall.h>
+#endif
+
 #ifdef HAVE_OPENSSL
 #include "ssl_private.h"
 
@@ -420,6 +424,12 @@ static unsigned long ssl_thread_id(void)
     return psaptr->PSATOLD;
 #elif defined(WIN32)
     return (unsigned long)GetCurrentThreadId();
+#elif defined(DARWIN)
+    uint64_t tid;
+    pthread_threadid_np(NULL, &tid);
+    return (unsigned long)tid;
+#elif defined(__linux__)
+    return (unsigned long)syscall(SYS_gettid);
 #else
     return (unsigned long)(apr_os_thread_current());
 #endif

Modified: tomcat/native/trunk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/native/trunk/xdocs/miscellaneous/changelog.xml?rev=1750514&r1=1750513&r2=1750514&view=diff
==============================================================================
--- tomcat/native/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/native/trunk/xdocs/miscellaneous/changelog.xml Tue Jun 28 14:05:49 2016
@@ -44,6 +44,14 @@
       Correctly handle OS level EAGAIN return codes during non-blocking TLS I/O.
       (markt)
     </fix>
+    <fix>
+      Correct a potential performance problem identified by Nate Clark due to
+      Tomcat Native providing OpenSSL with thread identifiers poorly suited to
+      the hash function used by OpenSSL when selecting a bucket for the hash
+      that holds the per thread error data. Tomcat Native on Windows was not
+      affected. A fix has been applied for OSX and Linux. Other platforms may
+      still be affected. (markt/rjung)
+    </fix>
   </changelog>
 </section>
 <section name="Changes in 1.2.7">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1750514 - in /tomcat/native/trunk: native/src/ssl.c xdocs/miscellaneous/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 28/06/2016 15:54, jean-frederic clere wrote:
> On 06/28/2016 04:05 PM, markt@apache.org wrote:
>> +      Correct a potential performance problem identified by Nate Clark due to
>> +      Tomcat Native providing OpenSSL with thread identifiers poorly suited to
>> +      the hash function used by OpenSSL when selecting a bucket for the hash
>> +      that holds the per thread error data.
> 
> I had issue with the comparing APR connector + openssl versus NIO +
> openssl can't be that related
> (http://www.slideshare.net/jfclere/tomcat-openssl slide 19) I first sent
> small file then big ones... APR +openssl doesn't look to go quite where
> I excepted it.

Give the concurrency and (assuming you weren't testing on Windows) those
results do look like you might have hit this problem.

I don't suppose you are in a position to do a quick test with tc-native
trunk to see if it is any better now?

Cheers,

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1750514 - in /tomcat/native/trunk: native/src/ssl.c xdocs/miscellaneous/changelog.xml

Posted by jean-frederic clere <jf...@gmail.com>.
On 06/28/2016 04:05 PM, markt@apache.org wrote:
> +      Correct a potential performance problem identified by Nate Clark due to
> +      Tomcat Native providing OpenSSL with thread identifiers poorly suited to
> +      the hash function used by OpenSSL when selecting a bucket for the hash
> +      that holds the per thread error data.

I had issue with the comparing APR connector + openssl versus NIO +
openssl can't be that related
(http://www.slideshare.net/jfclere/tomcat-openssl slide 19) I first sent
small file then big ones... APR +openssl doesn't look to go quite where
I excepted it.

Cheers

Jean-Frederic

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org