Quota-based Limits

Discussion in 'Feature Requests' started by BobGeorge, Feb 20, 2019.

  1. BobGeorge

    BobGeorge Member HowtoForge Supporter

    We were reviewing how we do things and a suggestion for an interesting business model popped up.

    The idea is that the clients get, say, 500GB of disk space... and that's it.

    They can have as many websites, emails, databases, etc. as they can fit within that 500GB limit. So perhaps they just want to stuff as many websites as possible into that 500GB, or they're a business that uses 100GB for their website and then the other 400GB is divided up as email storage for all their employees, or whatever else they like.

    Leaving it entirely up to them how they want to make use of that 500GB - maybe it's all websites, maybe it's all emails, maybe it's all databases or any combination thereof.

    (And, of course, if the client fills up that 500GB and wants more then, paying a bit more, they can get that expanded to, say, 1TB.)

    The basis of this idea was to consider that our primary "per-user" cost is disk space. There are, of course, other costs like electricity, the server hardware (i.e. CPU / RAM cost) and such - but these are shared costs, amortised across all users. The thing we have to buy more of with new users is disks to increase disk space, so it was simply suggested that we charge on that basis.

    Because, to be honest, a lot of web designers do that thing of buying cheap web space and then stuffing as many websites onto it as they can - rather than trying to restrict that, go with it and offer them a package that exactly suits them at a reasonable price. And it suits us on the other side, because all we have to do is add enough disks with each new user or if a user pays to have a bigger space - what exactly they want to use that space for is up to them and entirely depends on what they need to do, so leave it to them - as long as it's legal, of course.

    This seemed like a good suggestion to me for a business model - at least for a "web designer" package, as we'd still also offer a "single website" package at a cheaper price too, of course - but I was scratching my head about how to make ISPConfig do this, when all the limits are more finely-grained and independent.

    You can limit a website quota or database quota or email quota to a certain size, but to make this idea work, what you'd rather need is just an overall per-user "total quota". This client has 500GB. They can create unlimited whatever they like, so long as, overall, it's not using up more than that "total user quota" (well, some things - like DNS records or FTP accounts - are more ephemeral and not measured in "disk space" terms, but I was thinking that - much like how my "unlimited texts" works on my phone - the limits are just set nice and high that no-one's likely to ever break them. With my texts, for example, I get 3000 a month. So, in practice, this is effectively "unlimited" because there's no way I'm ever going to be sending over 3000 texts in a month. But it is finite, to avoid some kind of "run away" process - like a text spam bot - from literally trying to send infinite spam texts. No-one who's using things in earnest is ever really going to hit the limit, but the limit is there to stop ouright abuse of the "unlimited" offer).

    So, yeah, this has ended up in the "Suggestions" forum, as I think that ISPConfig would need to be tweaked to make something like this work - it would, of course, still fully support the current limit model, but it could be good to further support other ways of doing it, like this "whatever you like... within your 500GB quota" model too.

    I'd think you'd add an extra "total quota" field for a user and then all other quotas can't add up to more than that (and to support the current model, if you leave "total quota" blank then this limit is not applied and it carries on as it always did).

    Currently, "-1" in any limit means "unlimited, up to the amount of remaining disk space" and this would be much the same, but it's up to the user's "total quota" (and if the "total quota" is "-1" then this extra "per-user" quota check just doesn't happen). So it's just like adding an extra limit check in between the individual limit and the "all remaining disk space", I'm initially thinking.

    Does that make sense? Would that be too difficult to implement?

    (I can code PHP,, so I don't mind possibly helping with the development. But the idea itself needs to pass a "sanity check" that it's even a good idea first, of course.)
     
    Last edited: Feb 20, 2019
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Have you examined setting your customer up as reseller? Does the disk quota work then the way you want?
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    What you describe is basically how it currently works in ISPConfig, just that quota is divided between web and disk and database due to the fact that ISPConfig is a multiserver system and in larger installs, you are separating services and also disk space has often a different cost for the different services as fast NVMNE disks as often used for the databases are far more expansive than normal SSD's as used for the webspace or normal hd's used for the mail system. A client can not set his site to -1 as you posted above when you have set a quota limit for him, he must stay inside his overall quota. So if you set a client to 500GB quota in the client limits and set number of websites to -1, then he can create as many sites as he wants but not use more than 500GB of disk space for all of them.
     
  4. sunghost

    sunghost Member

    Hi,
    i think this is unclear, since i must configure Webspace and Mailquota for a Client seperatly. If i understand Till correct, than i only have to Configure Webquota to e.g. 500MB and Mailquota to -1, to let the customer decide for what (Web, Mail) he want to use it, right?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    No, that#s not what I meant. mail and web quota have always to be defined separately as mail and web can be on different servers and emails are not stored under the web user for security reasons, so they can not share the same quota.
     
  6. sunghost

    sunghost Member

    Hi Till,
    ok thats what i understand how ISPConfig function so far, but BobGeorge talk about one quota and variable settings from web, mail and database by the customer. But you have answered it allready and it seems BobGearoge is happy with that. thx too
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    BobGeaorge talks about the approach of selling hosting not by website but by space used, and that's how ISPConfig handles it already. I explained to him that ISPConfig uses already this harddisk spaceamount approach for hosting that he describes. You can set the amount of hosting space in client limits in ISPConfig and the client can then decide by itself how many websites he want to have (if you have no limit set for the number of sites) and how he wants to use this overall quota for his sites. The only limitation is that the quota has to be split between web, database and mail and that's for technical reason and it also makes a lot of sense for the hoster as costs for storage technologies differ and mail, database and web have different needs in regard of disk speed.
     
  8. sunghost

    sunghost Member

    Hi till,
    thanks and i full understand this. But I have an idea as an extenteded option if hoster want this: In ISP is one optional Field for the Hoster to limit the Web and E-Mail Quota for Customer at all. ISP decides than which "internel" Quota will adjust for Web and Mail.
    Example:
    The Hoster decides to setup 50GB for Disk Space which is for Web and E-Mail for a Customer. The "internal" Quota for Mail and Web could set by ISPC to e.g. 25GB each at the start of hosting. Perhaps Hoster can initial decides the ratio for both (50/50 or 75/25), or by an smart algo :) ... When than the Customer installed a Website with at all 20GB Disk Space and the Mailspace which is used so far is at 10GB, then the Quota will changed by ISPC to e.g. 30GB for Web and 20GB for Mail. I think the Quota Check of Web and Mail has to run much more to adjust both values, but it should work. The Customer needs one Information about free Hosting Space. For him its not interesting if he has 10GB Mail Space left, but for Web over 30GB which he doesnt need. At this point the ratio for the Customer isnt interesting anymore and ISP manage the Quota internaly for Web and Mail.
    What do you think?
     
  9. nhybgtvfr

    nhybgtvfr Active Member

    seems that perhaps a simple way to describe it is as a total limit.
    eg total limit set to 100Gb. so initially, mail, db, and web all get set to a possible max 100Gb.
    as each area (web/db/mail) gets data added, when the quota check runs, it resets each max limit based on what's already consumed.
    mail = 100Gb - used web -used db.
    web = 100Gb -used mail -used db.
    db = 100Gb -used web -used mail.


    could get messy. and what if the customer then decides that eg, DB will be a fixed limit of 5Gb. even though the db's size is maybe only 50Mb, the used db value would need to be set to the fixed limit size to prevent over committing space.
    customers would need to be made aware fixing a limit overrides the floating limit. they can still run out of space in one area despite having Gb's of unused space in another area. could get rather confusing for them.
     
  10. sunghost

    sunghost Member

    Hi,
    ok first part is what i mean. Second part is no problem, because messages about exceeding Quota can send as usal. Also checks to setup a new Database when Quata will exceeded are running and the customer will informed about that. So you cant setup 30GB DB if you only have 20GB Disk left. The Customer has to clean up.
    And if the customer set a Database with fix Value, this Value is also susbtracted from global value instantly. I see no problems. Quota Checks have to run as usal, because Web an Mail are checked already. I think the only changes have to made in the logic behind to calculate exceeding of overall Quota and setting new Quota for Web, Mail and DB as they changed.
     
  11. BobGeorge

    BobGeorge Member HowtoForge Supporter

    Well, the implementation I imagined would be to add an extra "total quota" field added to the database for each client.

    If the "total quota" is set to unlimited (-1), then this effectively disables this new feature and ISPConfig carries on as before (so this should be totally "backwards compatible" and systems set up in the old way continue as they are - the new "total quota" field added to the DB is -1 (in other words, "turned off") by default and only comes into effect if it is set to something else in the limits panel).

    Then it's a case of some extra checks against "total quota". When the client creates a new website or new email inbox, then ISPConfig adds up all of their current quota amounts for everything and ensures that it's always less than "total quota".

    For example, I allocate 500GB as "total quota" for a user and this is placed into the database for them.

    This user then wants to create a website and in the "website quota" field, they can enter any value they like up to 500GB (but it must be < "total quota"). What ISPConfig does is run through all their quotas so far, adds them up and checks that it's less than "total quota".

    So, from that 500GB quota, the user assigns "100GB" to this website. Now they want to create a database for that website. So they're at the "database quota" field and valid values are any values they like, up to "total quota" - sum(all quotas) = 500GB - (100GB) = 400GB. The user chooses to allocate 100GB to this database, say.

    Then they want to create an email inbox. For the inbox quota, valid values are any value up to "total quota" - sum(all quotas) = 500GB - (100GB + 100GB) = 300GB.

    To make this summing up of quotas used so far more efficient - so you're not literally running through them all, each and every time - add two fields to the database for each user. "total_quota" and "free_quota". When the user is created "free_quota = total_quota". As they allocate quotas to websites, databases and emails, these are deducted from "free_quota", keeping track of how much they have left (and, of course, if a website, inbox or database is deleted, then the quota is recovered and added back onto "free_quota" again).

    Any action that would make "free_quota" < 0 would be a user trying to allocate beyond their quota and would be refused as invalid.

    Indeed, as we've got "free_quota" being tracked, then this can be placed next to any quota field ("max: [free_quota]"), so the user also knows how much of their quota they've got left too, as they're not allowed to allocate an individual quota larger than their remaining "free_quota".

    Equally, in the other direction, the user can't reduce their quota to less than is being used - obviously - and so if they want to reduce a quota, to free up their "free_quota" for something else, then they've got to start deleting files or emails or whatever to make room.

    This is an abstract level above how it currently works, to simply keep tallies of the overall "total quota" / "remaining quota" across all services, and then add extra checks / restrictions to what the user is allowed to do.

    And, as mentioned, because these are extra fields and extra checks on top of what's already there, then setting the "total_quota" to -1 ("unlimited") disables the extra checks, so it should be perfectly backwards compatible with how ISPConfig currently works, with the new "total_quota" field being "-1" by default.

    But when you create a new client and specify, say, "1TB" as their total quota, then we're just arithmetically checking that any individual quota they enter - for any websites, email or databases - doesn't ever result in "free_quota" < 0. Not allowed. That's exceeding your "total_quota" - please enter a new value that's less than "free_quota" (and as we're keeping track of "free_quota" anyway, to make this implementation efficient, then simply print "max: [free_quota]" next to any individual quota box, so the user knows what the maximum quota can be / how much of their total quota is remaining).

    When something is created - website, inbox, database - then subtract its individual quota from "free_quota" and if something is deleted, then you can add the quota it's now surrendered back to "free_quota". Quotas can, of course, be re-assigned by the user - but the "free_quota > 0" rule must be obeyed.
     

Share This Page