Using Session vs. SQL Query Function

0

I am developing a system and today I have a 10 Modules, I currently store the permission of each module in a separate Boolean session.

The value of each session is given the name of the module followed by its permission on initialization in the Default and leaves it stored.

Would it have a lot of performance impact if I changed this permissioning system by session using a direct query in the bank at the moment of checking the module checking its permissions?

Thank you.

    
asked by anonymous 04.04.2017 / 14:51

1 answer

1

Depends, where is this session saved? In memory?

How often do you do this check in a Request? If you do this more than once, you will experience loss of performance, since now you will have to go to the bank to run the query, the bank will process and respond. Even though the bank and application are on the same machine, there is a cost of communication, meanwhile, if the session is in memory it is much faster to read.

You should also consider whether the system will grow. For example, if in the future you need to put the application running in a Farm, the best option would be a central cache and not multiple machines with the same thing in memory. In this scenario it is a good idea to think of something like Redis, since it is much faster than a relational database.

    
05.04.2017 / 13:11