Skip to content

Conversation

@mohsinkazmi
Copy link
Contributor

Add support for RPC-service test.

func rpcTestAsync(conn api.Connection, cnt int) {
fmt.Printf("Running async RPC perf test with %d requests...\n", cnt)

ctxChan := make(chan memclnt.RPCService, cnt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. The memclnt.RPCService is a an interface of RPC service client that is needed to be created only once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore rpcTestAsync function. It should have been deleted. you can check this function has never been called.

go func() {

for i := 0; i < cnt; i++ {
ctxChan <- c.ControlPing(context.Background(), &memclnt.ControlPing{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't even compile. The ControlPing returns two values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please Ignore it....

time.Sleep(time.Second)
}

func rpcTest(conn api.Connection, cnt int) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function syncTest2 is optimized way to use stream. It does basically the same thing ControlPing RPC call does, but reused the same stream which makes it more performant.

Copy link
Member

@ondrej-fabry ondrej-fabry Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend reading Sending API messages from our GoVPP User Guide and RPC services and Stream API for more in-depth documentation of how it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using RPC services in our private application and can't change the whole code base to stream APIs. I have benchmarked them and got different results from stream APIs and RPC services API.
Thanks for the reading list. I have already read them.
The point here is to improve the overall performance of stream APIs and RPC service APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants