Shard batch writes, use batch UDP syscalls

The idea is to drain the socket and do a single RocksDB WAL
write/fsync for all the write requests we have found.

The read requests are immediately executed. The reasoning here is
that currently write requests are _a lot_ slower than the read
requests because fsyncing takes ~500us on fsf1. In the future this
might change.

Since we're at it, we also use batch UDP syscalls in the CDC.

Fixes #119.
This commit is contained in:
Francesco Mazzoli
2023-11-18 20:03:28 +00:00
parent 9b3065ceb9
commit 53049d5779
17 changed files with 986 additions and 408 deletions

View File

@@ -6,14 +6,14 @@
#include <unistd.h>
#include <iomanip>
std::ostream& operator<<(std::ostream& out, struct sockaddr_in& addr) {
std::ostream& operator<<(std::ostream& out, const struct sockaddr_in& addr) {
char buf[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &addr.sin_addr, buf, sizeof(buf));
out << buf << ":" << ntohs(addr.sin_port);
return out;
}
std::ostream& operator<<(std::ostream& out, struct in_addr& addr) {
std::ostream& operator<<(std::ostream& out, const struct in_addr& addr) {
char buf[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &addr, buf, sizeof(buf));
out << buf;
@@ -40,7 +40,7 @@ std::ostream& operator<<(std::ostream& out, const GoLangBytesFmt& bytes) {
std::ostream& goLangQuotedStringFmt(std::ostream& out, const char* data, size_t len) {
out << "\"";
for (int i = 0; i < len; i++) {
uint8_t ch = data[i];
uint8_t ch = static_cast<uint8_t>(data[i]);
if (isprint(ch)) {
out << ch;
} else if (ch == 0) {