tencent cloud

Performance Testing Service

Use the Protocol File

PDF
Focus Mode
Font Size
Last updated: 2025-03-10 17:35:06

Use Protocol Files In GRPC Scenarios

Protocols such as gRPC require users to upload protocol files, and the performance testing engine depends on protocol files to complete request serialization. Users can upload files or directories. File names need to be unique. Files with the same name will be overwritten by newly uploaded files.
If the user uploads a zip file, PTS will decompress the file and display the decompressed file structure.
If the directory or zip package contains non-Protocol Files, PTS will ignore these files.



If the main .proto file depends on other .proto files, they also need to be uploaded together (the standard .proto files provided by Google, namely, google/protobuf/*.proto, do not need to be uploaded separately because PTS will load them automatically).
The user only needs to load the primary pb. Other pb files that the primary pb depends on will be automatically loaded recursively according to the import path in the primary pb file.
import grpc from 'pts/grpc';

const client = new grpc.Client();
client.load([],'addsvc/addsvc.proto');

export default () => {
client.connect('grpcb.in:9000', {insecure: true});

const rsp = client.invoke('addsvc.Add/Sum', {
a: 1,
b: 2,
});
console.log(JSON.stringify(rsp));
console.log(rsp.data.v); // 3

client.close();
};


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback