GRPC load testing with K6

I am a beginner user of k6. I want to do performance testing with grpc and getting some errors like this:

ERRO[0060] GoError: context deadline exceeded: connection error: desc = “transport: authentication handshake failed: tls: first record does not look like a TLS handshake”

Here is the screenshot of my code:

Hi @suvajitall

Welcome to the community forum :wave:

The error you are seeing suggests that there could be an issue with the TLS handshake between the client and server. Here are some possible reasons why this error could be happening:

  1. Incorrect server address: Make sure that you are using the correct server address and port number in your k6 script.
  2. Invalid TLS certificate: If the server is using a self-signed certificate, or if the certificate has expired or is invalid, the client will not be able to establish a secure connection. Make sure that the server’s certificate is valid and trusted by the client.
  3. Incorrect TLS configuration: Verify that the client is configured to use the correct TLS version and cipher suite that the server is expecting.
  4. Firewall or network issues: Check if there are any firewall rules or network issues that could be blocking the connection between the client and server.

To debug this issue, you could try enabling verbose logging in k6 using the --http-debug flag and look for any additional error messages or details.

You could also try connecting to the server using a different client tool, such as grpc_curl, to see if the issue is specific to k6 or if it’s a server-side issue. E.g. when using the example in the k6 docs, if it failed, we could run a grpcurl -d '{"greeting": "Bert"}' grpcb.in:9001 hello.HelloService/SayHello to double-check the response of that server. In this case it works for me:

grpcurl -d '{"greeting": "Bert"}' grpcb.in:9001 hello.HelloService/SayHello
{
  "reply": "hello Bert"
}

Additionally, it may be helpful to consult the grpc documentation or seek help from the grpc community to diagnose and resolve the issue.

I hope this helps you get started with the troubleshooting.

Cheers!

1 Like