Keycloak load users
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I need to load all users from Keycloak and insert (cache) them into my system via keycloak-admin-client. While querying small number of users are pretty quick, the speed exponentially grows. Loading of 500 users takes 8 seconds, but 3000 users takes up to 4 minutes and I need to load 13k+. It seems like the methods search(search, first,max) and list(first,max) behaves same.
kc.realm(realmName).users().list(0, count)
I thought that doing the loading by chunks (list(0,1000) then (list(1001,2000))) would solve the problem but it take exactly same time to load 0,2000 than 1001,2000, which seems like Keycloak is querying all the users from beginning and then doing substring.
The question is: how to do the bulk (chunk, iterative) load of all users from Keycloak to another system? I would like to avoid touching Keycloak DB directly.
Thanks
java keycloak keycloak-services
add a comment |
I need to load all users from Keycloak and insert (cache) them into my system via keycloak-admin-client. While querying small number of users are pretty quick, the speed exponentially grows. Loading of 500 users takes 8 seconds, but 3000 users takes up to 4 minutes and I need to load 13k+. It seems like the methods search(search, first,max) and list(first,max) behaves same.
kc.realm(realmName).users().list(0, count)
I thought that doing the loading by chunks (list(0,1000) then (list(1001,2000))) would solve the problem but it take exactly same time to load 0,2000 than 1001,2000, which seems like Keycloak is querying all the users from beginning and then doing substring.
The question is: how to do the bulk (chunk, iterative) load of all users from Keycloak to another system? I would like to avoid touching Keycloak DB directly.
Thanks
java keycloak keycloak-services
add a comment |
I need to load all users from Keycloak and insert (cache) them into my system via keycloak-admin-client. While querying small number of users are pretty quick, the speed exponentially grows. Loading of 500 users takes 8 seconds, but 3000 users takes up to 4 minutes and I need to load 13k+. It seems like the methods search(search, first,max) and list(first,max) behaves same.
kc.realm(realmName).users().list(0, count)
I thought that doing the loading by chunks (list(0,1000) then (list(1001,2000))) would solve the problem but it take exactly same time to load 0,2000 than 1001,2000, which seems like Keycloak is querying all the users from beginning and then doing substring.
The question is: how to do the bulk (chunk, iterative) load of all users from Keycloak to another system? I would like to avoid touching Keycloak DB directly.
Thanks
java keycloak keycloak-services
I need to load all users from Keycloak and insert (cache) them into my system via keycloak-admin-client. While querying small number of users are pretty quick, the speed exponentially grows. Loading of 500 users takes 8 seconds, but 3000 users takes up to 4 minutes and I need to load 13k+. It seems like the methods search(search, first,max) and list(first,max) behaves same.
kc.realm(realmName).users().list(0, count)
I thought that doing the loading by chunks (list(0,1000) then (list(1001,2000))) would solve the problem but it take exactly same time to load 0,2000 than 1001,2000, which seems like Keycloak is querying all the users from beginning and then doing substring.
The question is: how to do the bulk (chunk, iterative) load of all users from Keycloak to another system? I would like to avoid touching Keycloak DB directly.
Thanks
java keycloak keycloak-services
java keycloak keycloak-services
edited Nov 23 '18 at 16:02
marc_s
585k13011261272
585k13011261272
asked Nov 22 '18 at 15:43
troger19troger19
335316
335316
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I just realized that the parameters are first and max, so in order to iterate over users I need to increase only the first number and let the second one remains same. So the request would looks like this with looping only parameter first by increasing it by 100
http://localhost:8180/auth/admin/realms/demorealm/users/?first=5500&max=100
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434349%2fkeycloak-load-users%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I just realized that the parameters are first and max, so in order to iterate over users I need to increase only the first number and let the second one remains same. So the request would looks like this with looping only parameter first by increasing it by 100
http://localhost:8180/auth/admin/realms/demorealm/users/?first=5500&max=100
add a comment |
I just realized that the parameters are first and max, so in order to iterate over users I need to increase only the first number and let the second one remains same. So the request would looks like this with looping only parameter first by increasing it by 100
http://localhost:8180/auth/admin/realms/demorealm/users/?first=5500&max=100
add a comment |
I just realized that the parameters are first and max, so in order to iterate over users I need to increase only the first number and let the second one remains same. So the request would looks like this with looping only parameter first by increasing it by 100
http://localhost:8180/auth/admin/realms/demorealm/users/?first=5500&max=100
I just realized that the parameters are first and max, so in order to iterate over users I need to increase only the first number and let the second one remains same. So the request would looks like this with looping only parameter first by increasing it by 100
http://localhost:8180/auth/admin/realms/demorealm/users/?first=5500&max=100
answered Nov 22 '18 at 20:19
troger19troger19
335316
335316
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434349%2fkeycloak-load-users%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown