eclipse-uprotocol / eclipse-uprotocol/up-cpp

Evaluate using std::deque for RpcClient's pending request queue

Open
#219 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
29
Forks
33
PR merge metrics
No merged PRs in 30d

Description

The current implementation uses `std::vector` as the underlying container for the pending request priority queue. Since vectors don't automatically shrink as elements are removed, shrinking logic was added in RpcClient.cpp.

We should evaluate `std::deque` as an alternative. The downside is that deques have a minimum size of around 4kB (depending on a bunch of factors) because of their block allocation strategy. The upside is that they automatically shrink as elements are removed.

This tradeoff may be worth it since only one instance of this particular queue should exist for any given uE.

Before making the change, we should determine how much memory a typical vector of pending requests uses and characterize the impact of growing / shrinking the vector on performance under simulated loads. We could compare to the performance when the vector is swapped with a deque.

_Originally posted by @gregmedd in https://github.com/eclipse-uprotocol/up-cpp/pull/202#discussion_r1674710805_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.