We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The text was updated successfully, but these errors were encountered:
Create a targets.txt file with the RPC request payloads:
POST https://localhost:50051/mypackage.MyService/MyMethod {"field1": "value1", "field2": "value2"} POST https://localhost:50051/mypackage.MyService/AnotherMethod {"field1": "value3", "field2": "value4"}
Run Vegeta with the custom targets file:
vegeta attack -targets=targets.txt -duration=30s -rate=50/1s | vegeta report
gRPC: Use ghz for gRPC load testing.
Thrift: Use thrift-tools.
Custom RPC: Write a custom load testing script in your preferred language.
Step 1: Create a gRPC-to-HTTP Proxy
package main import ( "context" "log" "net/http" "google.golang.org/grpc" pb "path/to/your/grpc/proto" ) func handler(w http.ResponseWriter, r *http.Request) { conn, err := grpc.Dial("localhost:50051", grpc.WithInsecure()) if err != nil { log.Fatalf("did not connect: %v", err) } defer conn.Close() client := pb.NewMyServiceClient(conn) response, err := client.MyMethod(context.Background(), &pb.MyRequest{Field1: "value1", Field2: "value2"}) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Write([]byte(response.GetResult())) } func main() { http.HandleFunc("/rpc", handler) log.Fatal(http.ListenAndServe(":8080", nil)) }
Step 2: Use Vegeta to Test the Proxy
echo "POST http://localhost:8080/rpc" | vegeta attack \ -body='{"field1": "value1", "field2": "value2"}' \ -header="Content-Type: application/json" \ -duration=30s \ -rate=50/1s | vegeta report
Sorry, something went wrong.
No branches or pull requests
Question
The text was updated successfully, but these errors were encountered: