User permission storage problems

Source: Internet
Author: User
The current design mode is to associate roles and menus with users and roles. Operation association means that a field in a role is a pile of numerical IDs. Because it is a large ERP system, there are a lot of menus and operations, so the number of fields stored in the role is very large. The current practice is to save the role id in session... the current design mode is
User and role Association
Associate roles with menus and operations
That is to say, a field in the role is a pile of numerical IDs.
Because it is a large ERP system, there are a lot of menus and operations
Therefore, fields in the role store a large number.

The current practice is to save the role id in the session. The database reads the role id every time it is used. Now I want to save the heap of numbers to the session. I have read about 16 kb, it is afraid that the server load will be too high when stored in the session.

Is there any good solution.

Reply content:

The current design mode is
User and role Association
Associate roles with menus and operations
That is to say, a field in the role is a pile of numerical IDs.
Because it is a large ERP system, there are a lot of menus and operations
Therefore, fields in the role store a large number.

The current practice is to save the role id in the session. The database reads the role id every time it is used. Now I want to save the heap of numbers to the session. I have read about 16 kb, it is afraid that the server load will be too high when stored in the session.

Is there any good solution.

I think this design has to be modified? If 16 K data is of the java long type, 2000 data can be stored. Is this slightly more?

If it cannot be changed for other reasons, if the function id corresponding to the role is relatively fixed, you can cache the data in the application server. In the session, only the user's role id is stored, each request comes over to get the corresponding function id list through the role id, and then perform the remaining judgment.

If I/O is too high on the server, consider memcached or redis to store the session.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.