-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
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
[FEATURE REQUEST](session)UpdateExpiration on more than three million keys with radix lib #1610
Comments
Hello @1819997197, This looks like a Redis Go Driver issue and less than an Iris one. I think it's better to open that issue on mediocregopher/radix repository instead. Let me link an issue there, as its author is active and helped on an issue a neffos user had in the past as well. Please join us to the chat, it looks like I should know about you, 3 million keys with the same prefix (session info) is a lot. |
hello @kataras. Yes, this looks like a Redis Go Driver problem. However, there is one point that I have never wanted to understand. There are multiple string keys with the same prefix in the login state of a user, why not store it as a hash map? |
Hello @1819997197, We used to save them as hash map but it was slower and someone, like you, asked to revert back to simple keys (with prefix). However, if you can push a PR (now that you have the stack to compare the performance better than myself) we can have an option for redis database which will save the data using Hash Map or Multiple Keys Prefixed :) |
hello @kataras. Okay, let me verify the performance first. |
That sounds great, don't hesitate to open a PR anyways, we can discuss it as you are writing it too, we do not need to hurry here. |
Okay, thank you |
hello @kataras. I did a performance test today, 2 million hash keys:
Test Results:
|
Looks good, can you test the current implementation too?(it should be trivial now) |
Yes, but it will take some time. |
hello @kataras. Performance tests currently implemented. 2 million hash keys:
Test Results:
Almost all operations require more than 1s. |
@1819997197 I don't see performance boost to hash vs current implementation, or am I not reading them correctly? |
hello @kataras. Four million redis-keys, two million each for string-key and hash-key. hash-keys(average time is 3ms):
string-keys(average time is 1s):
// Different machine configurations may have a little error |
Oh yes I see now, I could see above too! The difference is huge. Would you like to do it through PR? You should get the credits for that one. Just don't forget to add a |
Okay, my own code implements the Database interface(github.com/kataras/iris/[email protected]/sessions/database.go:24) through extensions. Submit a PR, I may also need to consider the compatibility of the existing string-keys version to see how to integrate more perfectly. |
Hello Makis!
In a production environment, the redis cluster has more than three million keys. When the program operates the session (update the session expiration time), the redis cluster cpu soars to 50%, which takes several seconds.
While debugging I found place where freezes, it`s here:
Session storage mechanism, a user login state will have multiple string keys. As the number of users increases, redis key will gradually become very large. I extended a new version, the session storage in redis was changed to hash, and it also supports redis stand-alone mode and cluster mode. Hope to provide convenience for the vast number of development compatriots.
The text was updated successfully, but these errors were encountered: