ghz icon indicating copy to clipboard operation
ghz copied to clipboard

request data with long text failed

Open hscspring opened this issue 5 years ago • 0 comments

Proto file(s) List protocol buffer definitions

service Extracting {
    rpc ExtractKeyWord (ExtractRequest) returns (ExtractKeyWordResponse) {}
}


message ExtractRequest {
    string text = 1;
    int32 topk = 2;
}

message KeyWord {
    string word = 1;
    float weight = 2;
}

message ExtractKeyWordResponse {
    repeated KeyWord keywords = 1;
}

Command line arguments / config List all command line arguments or config properties

{
    "insecure": true,
    "proto": "../proto/extract.proto",
    "call": "extract.Extracting.ExtractKeyWord",
    "duration": "1m",
    "timeout": "10s",
    "format": "summary"
}

Describe the bug A clear and concise description of what the bug is. Request long text did not execute.

To Reproduce Steps to reproduce the behavior:

import os
import argparse
import json


def get_text(test_file: str, length: int) -> str:
    with open(test_file, "r") as f:
        text = f.read()
    return text[:length]


def main():
    """
    Example:  python run.py -f ../../../bench_text.txt -l 3000 -c 1 -s 127.0.0.1:12343
    """
    parser = argparse.ArgumentParser(
        description='Bench test.')
    parser.add_argument(
        '-f', dest='filepath', type=str, help='File dirname.')
    parser.add_argument(
        '-l', dest='length', type=int, help='Text length.')
    parser.add_argument(
        '-c', dest='concurrency', type=int, help='Request concurrency.')
    parser.add_argument(
        '-s', dest='server', type=str, help='GRPC server.')
    args = parser.parse_args()

    test_file = args.filepath
    length = args.length
    concurrency = args.concurrency
    server = args.server

    data = {"text": get_text(test_file, length), "topk": 7}
    test_data = json.dumps(data, ensure_ascii=False)

    outfile = "-".join(["Extract",
                        "Length", str(length),
                        "Concurrency", str(concurrency)])
    title = "########## " + outfile + " ##########"

    os.system("echo '{}' >> {}".format(title, "extract.txt"))
    cmd = "ghz --config ./config.json -d '{}' -c {} {} >> {}".format(
        test_data, concurrency, server, "extract.txt")
    os.system(cmd)


if __name__ == '__main__':
    main()

when i run python run.py -f ../../../bench_text.txt -l 90000 -c 1 -s 127.0.0.1:12342, i have returned to bash quickly. when length is 80000, it's ok.

Expected behavior A clear and concise description of what you expected to happen.

Environment

  • OS: macOS 10.14.6, Darwin MacBook-Pro-5.local 18.7.0 Darwin Kernel Version 18.7.0
  • ghz: 0.49.0

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

hscspring avatar Mar 11 '20 09:03 hscspring