Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8494053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:11:40+00:00 2026-06-10T23:11:40+00:00

My website has a very granular permissions system for every client, making it fairly

  • 0

My website has a very granular permissions system for every client, making it fairly large in size.

To keep a cap on database queries I have been loading bitmasks from a mysql database at the start of a users sessions and then saving it as session data, so it looked something like this. This has allowed me to one make one (albeit it complex JOIN query) query per user session without creating a huge session file.

"permissions" => array(
    "type 1" => 'bitfield'
    "type 2" => 'bitfield'
     "type 3" => array(
         entity id = 'bitfield'
         entity id = 'bitfield')
     "type 4" => array(
         entity id = 'bitfield'
         entity id = 'bitfield')
)

Permissions are entirely group based, so every person in a given group would have this replicated in their session data.

However bitmasks are starting to be a pain to use and I’m looking to move to using an acl. The reason I didn’t use an acl in the first place however was to minimise database usage..

So.. now I am going to have an entirely database/cache driven acl without any bitmasks. However storing huge arrays of permissions in user session data doesn’t seem ideal. (do you agree?)

I think the way to go is to use a flat file cache to store groups permissions. Would the easiest way to do this be a file per group? Would this change when there are 4,000 + groups each with 4 permission types (2 permission types are global with combined 40 or so permissions, 2 types are local permissions with combined 40 or so permissions per entity (each type has maybe 3 or 4 lots of 20 permission!). Edit: for clarity this means 160 – 200 permission entries per group

This seems like it would be a fairly huge cache! Would it be best to just have huge database usage on every page load? This kind of data size made bitmasks far easier but they are just simply not flexible enough anymore.

This is made harder by the fact files are served by 2 different servers (session stickied so saving bitfields to session data wasn’t a problem), so any cache would have to be synced between the servers. The db is on a seperate server connected by private network with supposedly 1gig connection.

Can any solutions be suggested? I think quick access cache such as memcached with this much data will just blow my memory usage out of the water? I am tempted to just user lots of database queries but I think that may put too heavy a strain on the db server.

Fairly large question, I hope its clear. If any of it needs clarification let me know. Any solutions will be greatly appreciated!

Chris

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:11:41+00:00Added an answer on June 10, 2026 at 11:11 pm

    I don’t think that a data structure with ~40 entries in it stored in session is particularly huge. So really, what this might come down to design-wise is how to best get this information into the application with best performance.

    If you are beginning to run up against performance problems and your infrastructure budget would allow for it, I would think your might look at migrating this solution to more of a service oriented architecture that could be shared across any number of servers. I am personally a huge believer in this sort of architecture as it can really help you in dealing with problems of scale.

    You could expose “permissions” as a service that could be consumed by this application (or perhaps other applications you may need to develop in the future). It might look something like this:

    • In-memory caching layer (memcached or similar) which is where application makes its initial call to look for permission information based on group. If the data does not exist here the next layer services the request
    • RESTful API. You make a simple GET request for the permissions on your group after first having a cache miss. This will need to call to the database layer to get information. It would also do things like populating the cache on a cache miss, invalidating and repopulating the cache in cases where a client POSTs some new permissions data or PUTs update to an existing set of permissions.
      • DB layer this is accessed only by RESTful service. Perhaps MySQL perhaps a NoSQL technology if you have more complex non-relational data structures.

    For your service you could probably have a very smal database server (because the database itself should be queried infrequently once the cache is populated). A memory caching server that has sufficient memory to meet your storage needs (or possibly a small cluster of servers if redundancy is needed), and a relatively small server to handle REST API (this should be infrequently accessed as well once cache is developed. The good thing is that they are several memcached or similar service out there that you can use relatively cheaply (like Amazon Elasticache). Really the in-memory cache would be taking the brunt of the traffic from the application servers so you would not need to scale up the REST server of DB server much at all as your traffic grows.

    Hope this helps in your thought process a little.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a small website that has a fairly large amount of pictures
So I am making this personal website that has very litte content, and if
My website has a sponsorship system that allows users to invite friends by email
My website has a very precise area shape definition. It's pixel perfect. Here's my
My website has a search procedure that runs very slowly. One thing that slows
My website has the typical container that is centered in the middle (very similar
I have a very simple one page website that has a input field in
I am trying to develop a database for a website. This website has registered
I am helping my daughter build an asp.net website that has an Access database.
Well, I guess this day had to come. My client's website has been compromised

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.