History log of /6.6.0/platform/include/platform/platform_socket.h (Results 1 - 4 of 4)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.5.1
# d74d705a 06-Nov-2019 Dave Rigby <daver@couchbase.com>

MB-36776: Replace inefficient impl of htonll/ntohll with folly::Endian

platform.so has an implementation of the 64bit byteswap functions
ntohll() and htonll(), for platforms which don't

MB-36776: Replace inefficient impl of htonll/ntohll with folly::Endian

platform.so has an implementation of the 64bit byteswap functions
ntohll() and htonll(), for platforms which don't have that symbol
natively.

Profiling of ep-engine Writer threads highlighed that a large amount
of time (~5%) was being spent in platform's ntohll() / htonll()
functions. This was surprising, as:

a) I had assumed that modern Linux (CentOS 7) provided the 64bit
byteswap functions, and

b) Even if the OS doesn't have those functions, I assumed our
implementation shouldn't be _that_ slow.

(For context the top 10 functions in the profile are below, ntohll is
the 3rd hottest):

Overhead Command Shared Object Symbol
4.82% mc:writer_2 libsnappy.so.1.2.0 [.] snappy::internal::CompressFragment
4.33% mc:writer_2 [kernel.kallsyms] [k] _raw_spin_lock_irq
4.30% mc:writer_2 libplatform_so.so.0.1.0 [.] ntohll
2.82% mc:writer_2 libc-2.17.so [.] __memcpy_ssse3
2.49% mc:writer_2 libsnappy.so.1.2.0 [.] snappy::RawUncompress
2.36% mc:writer_2 [kernel.kallsyms] [k] _raw_spin_lock
1.99% mc:writer_2 libjemalloc.so.2 [.] je_malloc_usable_size
1.74% mc:writer_2 [kernel.kallsyms] [k] __radix_tree_lookup
1.43% mc:writer_2 libjemalloc.so.2 [.] je_malloc

Both my assumptions are actually incorrect:

- CentOS 7 (and other recent distros including Ubuntu 18.04) *don't*
have ntohll / htonll symbols. They *do* have functionally
equivilent function htobe64() since glibc 2.9 (2008), but that's a
different, Linux-specific symbol.

- Our implemenation _is_ slow - it's doing old-style manual byteswap,
which is 10x slower on mancouch than the GCC compiler intrinsic
__builtin_bswap64:

Run on (24 X 2400 MHz CPU s)
2019-11-06 12:20:30
-----------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------
Swap64 57 ns 57 ns 12216131
BuiltinSwap64 5 ns 5 ns 141279127

Given we already have an optimized byteswap implementation available
from Folly, use that instead. Also inline the functions to reduce the
call overhead.

This results in the same performance as the GCC compiler intrinsic
(but is cross-platform):

Run on (24 X 2400 MHz CPU s)
2019-11-06 12:33:05
-----------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------
Swap64 57 ns 57 ns 12507068
FollySwap64 5 ns 5 ns 135655965
BuiltinSwap64 5 ns 5 ns 100000000

Change-Id: I472be7705622b800c9849bfc0615fb49a73ccce8
Reviewed-on: http://review.couchbase.org/117439
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@couchbase.com>
Reviewed-by: Richard de Mellow <richard.demellow@couchbase.com>
Reviewed-by: Paolo Cocchi <paolo.cocchi@couchbase.com>

show more ...


Revision tags: v6.0.3
# becffd3b 29-Mar-2019 Trond Norbye <trond.norbye@gmail.com>

Cleanup: Remove __sun and __FreeBSD__ code

We don't build on those platforms and we have no idea of
the current status.

Change-Id: Ifa752904f7c69c7d4fa188deb223e4aabed23fa9

Cleanup: Remove __sun and __FreeBSD__ code

We don't build on those platforms and we have no idea of
the current status.

Change-Id: Ifa752904f7c69c7d4fa188deb223e4aabed23fa9
Reviewed-on: http://review.couchbase.org/106994
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>

show more ...


Revision tags: v5.5.4
# cdc17db4 14-Mar-2019 Dave Rigby <daver@couchbase.com>

platform_socket.h: Add missing newline

platform/include/platform/platform_socket.h:78:7:
warning: no newline at end of file [-Wnewline-eof]

Change-Id: I451c8c7b0b51f195b

platform_socket.h: Add missing newline

platform/include/platform/platform_socket.h:78:7:
warning: no newline at end of file [-Wnewline-eof]

Change-Id: I451c8c7b0b51f195b08def07f895b3a0cd8ec510
Reviewed-on: http://review.couchbase.org/106182
Reviewed-by: Trond Norbye <trond.norbye@couchbase.com>
Tested-by: Trond Norbye <trond.norbye@couchbase.com>

show more ...


# efea6ba7 01-Mar-2019 Ben Huddleston <ben.huddleston@couchbase.com>

MB-30040: Introduce platform_socket.h

Pulling in folly is a massive PITA because of how much stuff is in
the platform.h header file. To make this easier, split platform.h
into a numb

MB-30040: Introduce platform_socket.h

Pulling in folly is a massive PITA because of how much stuff is in
the platform.h header file. To make this easier, split platform.h
into a number of logically grouped header files that can be included
instead.

Move the socket declarations into their own header file. Don't move
them to "socket.h" as that's a C++ header file and there are C
consumers of these declarations.

Change-Id: I65163833f0265a98b1baee6bcbba1f3c0be71eda
Reviewed-on: http://review.couchbase.org/105543
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>

show more ...