Throttle bandwidth based on plan

Discussion in 'Install/Configuration' started by Harrisburg, Feb 9, 2014.

  1. Harrisburg

    Harrisburg New Member

    I'm currently testing LWS, and I wanted to know if it's possible to set up bandwidth throttles based on what package the customer is on. If the customer chooses the "basic" plan, he gets 1 megabit per client. But if he chooses the "premium" plan, he gets 10 megabits per client.

    From searching the forum, it looks like the only way to do this is to manually edit the vhost. Is there any way to automate this process?
  2. NiteWave

    NiteWave Administrator

    it looks cloudlinux is able to do it -- http://www.cloudlinux.com/about/tech.php -- LVE limits
    "They can also set limits on per-package bases"
    but not mention bandwidth in this page. just CPU. IO. Memory etc.
    in http://docs.cloudlinux.com/index.html?io_limits.html, "The IO limits will only affect DISK IO, and will have no effect on network."

    --- so, cloulinux not able to throttle bandwidth per client yet per above simple search.

    how about cPanel ?
    http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/LimitBandwidth
    "Note: The system only checks bandwidth limits once per day, between midnight and 6 am. Therefore, the change may not take effect until that time."

    so it looks
    lsws web admin -> virtual host -> Basic ->
    Per Client Bandwidth: Out/sec
    Per Client Bandwidth: In/sec
    is unique feature.

    but it's for native virtual hosts, not for virtual host from apache's httpd.conf
  3. Harrisburg

    Harrisburg New Member

    Thanks, but CloudLinux does not perform bandwidth throttling. The disk I/O limits can be used to provide an extremely sloppy throttle on bandwidth, but that wouldn't be very effective for a variety of reasons.

    As you saw in your search, cPanel doesn't throttle port speed. It only suspends based on monthly transfers. There are ways to throttle port speeds for certain types or sizes of files, but not a simple throttling as in LWS.

    I understand all that, and that's exactly what my question refers to: is it possible to set those limits on a per-plan basis? Failing that, is it possible to set that on a per-vhost basis? That way, I can have:

    Plan #1: $5 / mo at 512Kb/s
    Plan #2: $10 / mo at 1Mb/s
    Plan #3: $20 / mo at 10Mb/s
  4. NiteWave

    NiteWave Administrator

    my understanding is that while it's possible in theory but not possible in practice at the time being.
    since no control panel(like cPanel / Plesk / DirectAdmin etc) support lsws native vhost,
    while it looks possible lsws can add this feature for vhost from apache's httpd.conf, control panel need add this option as well.

    if you have your own script to make use of lsws native vhosts, then it's possible, can automate this process by updating each vhost's configuration file (.xml)
  5. Harrisburg

    Harrisburg New Member

    Ah, I think I see what you're saying. In other words, I'd still need to manually set the limit in each new vhost because cPanel doesn't have the ability to pass that information through.

    If I understand correctly, LSWS will create a vhost for each new account that comes in through cPanel -- only my old existing Apache vhosts will be missing. Is this correct?
  6. NiteWave

    NiteWave Administrator

    Basically it is right.
    yes, there are 2 types vhosts: 1 type is from apache's httpd.conf(let's refer it as apache vhost), another is "native vhost" which is defined in
    lsws web admin->Configuration->Virtual Hosts
    which is stored in a .xml file (for example /usr/local/lsws/DEFAULT/conf/vhconf.xml)

    But
    for this feature: Per Client Bandwidth throttling,
    it only exists in native vhost
    not exist in apache vhost and no way to configure it.

    in theory native vhosts and apache vhosts can co-exist and work together without problem.
    but in real world, for mass number of vhosts or shared hosting, admin usually choose cPanel/Plesk to define and configure apache vhosts.

    to view all effective vhosts(apache + native)
    lsws web admin->Actions (right, click "Actions")

    to view native vhosts only:
    lsws web admin->Configuration->Virtual Hosts

Share This Page