Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization of the op-env RPC interface #189

Open
lurenpluto opened this issue Apr 10, 2023 · 0 comments
Open

Optimization of the op-env RPC interface #189

lurenpluto opened this issue Apr 10, 2023 · 0 comments
Labels
Any Idea Any problem/ideas/suggestions CYFS Stack This is CYFS Stack feature New feature User-friendliness To improve the usability of the interface & SDK

Comments

@lurenpluto
Copy link
Member

During the optimization process of the A link, it was discovered that many current uses of global-state and object-map involve a large number of single operations, and there is room for optimization.

Since global-state and object-map must be processed through the op-env proxy, a typical read operation is as follows (taking the service manager's related code in the A link as an example):

let op_env = self.root_state_stub.create_path_op_env().await?;
let path = format!("/app/{}/versions/{}", dec_id, ver_seg);
let ret = op_env.get_by_path(&path).await?;
let _ = op_env.abort().await;

let op_env = self.root_state_stub.create_path_op_env().await?;
let path = format!("/app/{}/local_status", dec_id.to_string());
let ret = op_env.get_by_path(&path).await?;
let _ = op_env.abort().await;

The above is a typical example code, reading the value under the path from the root-state. It's a typical single read operation, but in reality, it initiates three RPC calls:

1. create_path_op_env

First, create the corresponding operation proxy.

2. get_by_path

The actual read operation.

3. abort

Cancel the use of op_env (for read operations, if this step is omitted, the target end will use the GC mechanism to recycle this op-env, which may slightly impact performance).

So a single read operation requires three RPC calls. If it spans across cyfs-stack and device, it can impact performance and there is room for optimization.

We can consider merging these three operations and providing single-RPC interfaces and protocols for individual read/write operations maybe.

@lurenpluto lurenpluto added feature New feature Any Idea Any problem/ideas/suggestions CYFS Stack This is CYFS Stack labels Apr 10, 2023
@lurenpluto lurenpluto moved this to 💡Any Idea in CYFS-Stack & Services Apr 13, 2023
@lurenpluto lurenpluto added the User-friendliness To improve the usability of the interface & SDK label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Any Idea Any problem/ideas/suggestions CYFS Stack This is CYFS Stack feature New feature User-friendliness To improve the usability of the interface & SDK
Projects
Status: 💡Any Idea
Development

No branches or pull requests

1 participant