Skip to content

Tags: apple/swift-cassandra-client

Tags

0.4.0

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Define `HAVE_TIMERFD` on Linux system, for efficient MicroTimer. (#33)

Compile the C++ driver with `-DHAVE_TIMERFD`.

### Motivation:

Performance profiling of a service using `swift-cassandra-client` showed
that large amount of time was spent in managing timer list (maintained
as a heap) deep in the Cassandra DataStax C++ driver. Some investigation
later showed that the key blob of code responsible
[here](https://github.com/datastax/cpp-driver/blob/90df2c9ca1aa184a746445698533c71f7f34a2e1/src/micro_timer.cpp#L139-L149):

```
void MicroTimer::on_timeout(Timer* timer) {
  uint64_t now = uv_hrtime();
  if (now >= timeout_ns_) {
    // The goal timeout was reached, trigger the callback.
    callback_(this);
  } else {
    // There's still a sub-millisecond part to wait for so spin the loop until
    // the timeout is reached.
    timer_.start(timer_.loop(), 0, bind_callback(&MicroTimer::on_timeout, this));
  }
}
```

This effectively degrades to a spin-loop, in case we fall through to the
`else` part of the `if`. And we see that in profiling traces. I saw a
case where that was responsible for ~50% of CPU (might be particularly
bad case).

Fortunately, there is an alternative timing implementation. One that is
guarded by `define HAVE_TIMERFD`.

### Modifications:

* define `HAVE_TIMERFD` when built on linux

### Result:

* CPU usage reduces significantly once `HAVE_TIMERFD` is applied

0.3.0

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Expose the paging token API from the C/C++ driver (#22)

Co-authored-by: Erich Menge <emenge@apple.com>

0.2.0

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Update README (#12)

Add async/await examples

0.1.1

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
allow setting per-statement request timeout (#9)

Co-authored-by: Rick Newton-Rogers <rnewtonrogers@apple.com>

0.1.0

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Provide way to set cluster consistency (#8)

* Provide way to set cluster consistency

rdar://102086631

* Run swiftformat

* Change swiftformat rule to put access control keyword on declaration rather than extension

* Clean up configuration init

* Document default consistency levels