Performance question about consumer #9659
Unanswered
gaoxingliang
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I wrote below java code to create about 100k consumers. and found:
package com.example.authcode;
import com.alibaba.fastjson2.*;
import kong.unirest.*;
import org.apache.commons.lang3.*;
import org.apache.http.*;
public class ApiSixTest {
public static void main(String[] args) {
int max = 100 * 1000;
for (int i = 68999; i < max; i++) {
JSONObject body = new JSONObject();
String index = String.format("%08d", i);
/**
* {
* "plugins": {}, # Bound plugin
* "username": "name", # Consumer name
* "desc": "hello world" # Consumer desc
* }
*/
body.put("username", "u" + index);
JSONObject plugins = new JSONObject();
JSONObject hmac = new JSONObject();
JSONObject meta = new JSONObject();
meta.put("disable" , false);
hmac.put("_meta", meta);
hmac.put("access_key",
StringUtils.repeat(index, 3));
hmac.put("algorithm", "hmac-sha256");
hmac.put("encode_uri_params", false);
hmac.put("secret_key",
StringUtils.repeat(index, 3));
JSONArray signHeaders = new JSONArray();
signHeaders.add("X-Provider-ID");
hmac.put("signed_headers", signHeaders);
hmac.put("validate_request_body", false);
plugins.put("hmac-auth", hmac);
body.put("plugins", plugins);
String response = Unirest.put("http://192.168.102.222:62951/apisix/admin/consumers")
.header(HttpHeaders.CONTENT_TYPE, "application/json")
.header("X-API-KEY", "edd1c9f034335f136f87ad84b625c8f1")
.body(body)
.asString().getBody();
System.out.println(response);
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team,
I want to use the apisix integrated with customers to do the hmac-auth.
Is it will be a performance issue if I have about 10K consumers?
Will this cause a problem for etcd or something else. I see a lrucache is used in consumer code.
Beta Was this translation helpful? Give feedback.
All reactions