neels has posted comments on this change. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36540?usp=email )
Change subject: nft_kpi: retrieve counters in a separate thread
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3:
Quoting from the "Depends" libosmocore patch discussion:
For this one, my aim was to say that osmo-trx is doing
it that way, not that you > should do it that way.
oh, misunderstanding.
If you plan on keep the mutex locked while you gather
counters from nft
in this patch:
the stats lock is held while updating the rate_ctrs only, locking only *after* the nft
command has run and returned the complete response in a char buffer.
I expect running through that buffer to be very fast, so i lock stats reporting once all
around the buffer parsing. If it turns out wrong, we can unlock and re-lock the mutex
after every N items (or every N ms?), which would remove "all" blocking of
stats. (It is important to keep counters for each HNB in sync, but not important to keep
HNBs in sync with each other.)
I expect buffer parsing to already be imperceptibly fast; this is O(n) of pure pointer
arithmetic, no syscalls.
most probably blocking the main thread also for the
same amount of time.
(I've written this before in different places, but allow me to re-post, to make sure
it is mentioned here:)
Blocking of the main thread can happen with this patch, at the times when the main thread
wants to run a quick nft command.
This happens only at HNBAP HNB Register and Deregister, i.e. when a hNodeB shows up or
disappears; to set up / remove nft counter rules. Here the main thread may have to wait
for the second thread querying the counters from nftables. There is an ascii art of it in
this patch.
To circumvent this blocking, an inter-thread queue can be introduced to tell the second
thread to carry out the nft commands the main thread wants to run.
This is not implemented in this patch on purpose, because:
The HNB Register / Deregister are rare events, and reading counters doesn't really
take all that long, either. It may well turn out to be overkill to even have a thread for
nftables in the first place. It is slow for large numbers of items, but counters for under
1000 HNB from nft should be fast.
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36540?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I9dc54e6bc94c553f45adfa71ae8ad70be4afbc8f
Gerrit-Change-Number: 36540
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 12 Apr 2024 23:53:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment