Problem with authentication and load test

Hi, I’m trying to make REST requests to Nakama server through a tool that you use to test the API.
Unfortunately when I try to send authentication requests I am told “Server key invalid”.
For example, if I try this request (as indicated in the documentation) I get the error I just wrote:

POST /v2/account/authenticate/email?create=true&username=mycustomusername
Host: 127.0.0.1:7350
Accept: application/json
Content-Type: application/json
Authorization: Basic base64(ServerKey:)

{
“email”: “email@example.com”,
“password”: “3bc8f72e95a9”
}

As a server key I would like to use “defaultkey” but if I indicate it in the “Authorization” field I still get the error “Server key invalid”. I tried with “Authorization: Basic base64(ServerKey:defaultkey)” and other combinations but it still doesn’t work.
Could someone tell me the correct format?
While I’m at it, I wanted to ask: if I wanted to do load tests on my server (with Nakama installed), how do you suggest I proceed?
Thanks in advance.

The server key should be in the username component of the basic auth header, so the header should look like this pseudo-code: Authorization: Basic base64(defaultkey:). Actual header text should therefore look something like this: Authorization: Basic ZGVmYXVsdGtleTo=.

Load testing is a very complex topic. You need to ensure you’re running a production-scale and appropriately configured environment, look into reliable load testing tools (perhaps tsung) and set that up to run in a test environment that can generate enough load, and set up appropriate analysis of results so they’re useful in updating config or infrastructure if needed. Generally we recommend creating a workload that closely matches your game’s actual usage pattern to get the most relevant results.

You might also consider getting in touch with us about using our Managed Cloud to run servers for you, where we can take care of monitoring and scaling your infrastructure.

Hi everyone!

is there a way to get example load test project described here - Nakama: Benchmarks -  Heroic Labs Documentation? We want to adopt this for own project without starting from scratch

Hi @formatCvt, the benchmarking harness code is not public, and we are not currently planning to open-source it.

We generally recommend creating a load test suite specifically designed for your exact usage pattern: number of connections/requests, features in use, hardware you intend to run, and so on.

Yeah that would be really useful to have the benchmark. Just so we can do sanity checks that our infrastructure isn’t going to instantly fall over when we turn on a bunch of users

1 Like