Instead of using inefficient std::ostream, use our own 'bytes' iterator class.
Compute ahead of time the length of the byte buffer.
Afterwards serialize the objects into it.
Gives ~X5 boost over previus results (that sometimes don't even
finish in reasonable time)
[avi: add missing include]
Cassandra uses the DataOutput / DataInput interfaces and related classes
(DataOutputPlus, DataOutputStream, AbstractDataOutput, etc.) to serialize
primitive types - integers of various lengths, strings, etc, as part of
various inter-node messages, and so on.
This patch implements similar primitive type serialization/deserialization
in C++. The interface is quite different, but the functionality is the same
and so is the serialized format. The fact that the format is identical
(I verified this) is important, because we want a C++ node to be able to
communicate with a Java node.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
In the original Java code, MurmurHash was in the "utils" package, not
"util", so move it to a new "utils" directory (and namespace), not
"util".
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Port the Murmur hash functions from Java to C++. This is ironic,
because these functions actually originated in C code, which the
Cassandra guys converted to Java :-)
The Murmur hash is used in Cassandra for several things, including the
bloom filter (which is part of each sstable), and the default
data partitioner (Murmur3Partitioner).
I tested on some example string that all three methods (hash32, hash2_64
and hash3_x64_128) produce exactly the same output in the new C++ code as
they do in the original Java functions. This is important, because we want
the C++ node to be able to run alongside Java nodes, so they have to agree
on the same hash function.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
[avi: update configure.py]
DPDK initialization creates its own threads and assumes that application
uses them, otherwise things do not work correctly (rte_lcore_id()
returns incorrect value for instance). This patch uses DPDK threads to
run seastar main loop making DPDK APIs work as expected.