mdavidsaver / pvxs

PVA protocol client/server library and utilities.
https://mdavidsaver.github.io/pvxs/
Other
19 stars 25 forks source link

How to improve PVA put concurrency performance #42

Closed mdavidsaver closed 6 months ago

mdavidsaver commented 1 year ago

Copied from https://github.com/epics-base/pvAccessCPP/issues/188

I need to put lots of PV at the same time, which function I used is chan.put.set().exec(), but no matter how I use std::jthread or std::thread to achieve, it looks like always sequential execution at the bottom level. Is there a way to put the value without for waiting timeout?

mdavidsaver commented 1 year ago

@zhouyunbin One simple way to issue two concurrent PUT operations.

using namespace pvxs;

client::Context ctxt(...);

auto op1(ctxt.put("pv1").set("value", 5).exec());
auto op2(ctxt.put("pv2").set("value", 6).exec());

op1->wait(5.0);
op2->wait(5.0);

This can be scaled by keeping a

https://github.com/mdavidsaver/pvxs/blob/dd2f076b4aa6dc63fb91980eda711eabee910696/tools/get.cpp#L104

The pvxget CLI also uses callbacks instead of multiple wait() calls. This is done to allow the CLI to be interrupted cleanly by SIGINT.