FAQ
I‘m trying to figure out how cc choose a dea. When i learned the code, it
seems that there may be an error here.

I have list the relative codes below:

def process_dea_discover(message, reply)
       .....
       droplet_id = message_json['droplet'].to_s
       ......
       *calculate_help_taint(droplet_id)*
       ......
end

def calculate_help_taint(droplet_id)
       # Calculate taint based on droplet already running here, then memory
and cpu usage, etc.
       taint_ms = 0
      * already_running = @droplets[droplet_id]*
       taint_ms += (already_running.size * TAINT_MS_PER_APP) if
already_running
       mem_percent = @reserved_mem / @max_memory.to_f
       taint_ms += (mem_percent * TAINT_MS_FOR_MEM)
       # TODO, add in CPU as a component..
       taint_ms
end

already_running : I think the parameter means the number of droplets which
the dea already has.
but the code write here can't get that correctly. so i changed it, list the
new code below:

already_running = []
       @droplets.each_value do |instance|
         instance.each_value do |instances|
           already_running<<instances[:instance_id]
         end
       end
already_running_num = already_running.length

Search Discussions

  • James Bayer at May 29, 2013 at 7:10 am
    There was work done on this code Tuesday already that probably puts the
    sample you're using out of date. Basically the work is to better implement
    simple load balancing with anti-affinity for DEA's already running a
    particular app. Take a look in the next day or so and see if that doesn't
    address the points your brought up. I don't see it committed to master just
    quite yet.
    On Tuesday, May 28, 2013 6:57:06 PM UTC-7, mocc...@gmail.com wrote:

    I‘m trying to figure out how cc choose a dea. When i learned the code, it
    seems that there may be an error here.

    I have list the relative codes below:

    def process_dea_discover(message, reply)
    .....
    droplet_id = message_json['droplet'].to_s
    ......
    *calculate_help_taint(droplet_id)*
    ......
    end

    def calculate_help_taint(droplet_id)
    # Calculate taint based on droplet already running here, then memory
    and cpu usage, etc.
    taint_ms = 0
    * already_running = @droplets[droplet_id]*
    taint_ms += (already_running.size * TAINT_MS_PER_APP) if
    already_running
    mem_percent = @reserved_mem / @max_memory.to_f
    taint_ms += (mem_percent * TAINT_MS_FOR_MEM)
    # TODO, add in CPU as a component..
    taint_ms
    end

    already_running : I think the parameter means the number of droplets which
    the dea already has.
    but the code write here can't get that correctly. so i changed it, list
    the new code below:

    already_running = []
    @droplets.each_value do |instance|
    instance.each_value do |instances|
    already_running<<instances[:instance_id]
    end
    end
    already_running_num = already_running.length
  • Luke Bakken at May 29, 2013 at 2:23 pm
    Looking forward to trying this feature out soon. Thanks!
    On Wednesday, May 29, 2013 12:09:58 AM UTC-7, James Bayer wrote:

    There was work done on this code Tuesday already that probably puts the
    sample you're using out of date. Basically the work is to better implement
    simple load balancing with anti-affinity for DEA's already running a
    particular app. Take a look in the next day or so and see if that doesn't
    address the points your brought up. I don't see it committed to master just
    quite yet.
    On Tuesday, May 28, 2013 6:57:06 PM UTC-7, mocc...@gmail.com wrote:

    I‘m trying to figure out how cc choose a dea. When i learned the code, it
    seems that there may be an error here.

    I have list the relative codes below:

    def process_dea_discover(message, reply)
    .....
    droplet_id = message_json['droplet'].to_s
    ......
    *calculate_help_taint(droplet_id)*
    ......
    end

    def calculate_help_taint(droplet_id)
    # Calculate taint based on droplet already running here, then
    memory and cpu usage, etc.
    taint_ms = 0
    * already_running = @droplets[droplet_id]*
    taint_ms += (already_running.size * TAINT_MS_PER_APP) if
    already_running
    mem_percent = @reserved_mem / @max_memory.to_f
    taint_ms += (mem_percent * TAINT_MS_FOR_MEM)
    # TODO, add in CPU as a component..
    taint_ms
    end

    already_running : I think the parameter means the number of droplets
    which the dea already has.
    but the code write here can't get that correctly. so i changed it, list
    the new code below:

    already_running = []
    @droplets.each_value do |instance|
    instance.each_value do |instances|
    already_running<<instances[:instance_id]
    end
    end
    already_running_num = already_running.length
  • Mark Rushakoff at May 29, 2013 at 3:08 pm
    I think Luke is looking at v1 CC code and James is talking about v2 CC code.

    The relevant v2 CC code is
    [here](https://github.com/cloudfoundry/cloud_controller_ng/blob/master/lib/cloud_controller/dea/dea_pool.rb)
    and is much easier to understand, in my biased opinion.

    Mark
    On Wednesday, May 29, 2013 12:09:58 AM UTC-7, James Bayer wrote:

    There was work done on this code Tuesday already that probably puts the
    sample you're using out of date. Basically the work is to better implement
    simple load balancing with anti-affinity for DEA's already running a
    particular app. Take a look in the next day or so and see if that doesn't
    address the points your brought up. I don't see it committed to master just
    quite yet.
    On Tuesday, May 28, 2013 6:57:06 PM UTC-7, mocc...@gmail.com wrote:

    I‘m trying to figure out how cc choose a dea. When i learned the code, it
    seems that there may be an error here.

    I have list the relative codes below:

    def process_dea_discover(message, reply)
    .....
    droplet_id = message_json['droplet'].to_s
    ......
    *calculate_help_taint(droplet_id)*
    ......
    end

    def calculate_help_taint(droplet_id)
    # Calculate taint based on droplet already running here, then
    memory and cpu usage, etc.
    taint_ms = 0
    * already_running = @droplets[droplet_id]*
    taint_ms += (already_running.size * TAINT_MS_PER_APP) if
    already_running
    mem_percent = @reserved_mem / @max_memory.to_f
    taint_ms += (mem_percent * TAINT_MS_FOR_MEM)
    # TODO, add in CPU as a component..
    taint_ms
    end

    already_running : I think the parameter means the number of droplets
    which the dea already has.
    but the code write here can't get that correctly. so i changed it, list
    the new code below:

    already_running = []
    @droplets.each_value do |instance|
    instance.each_value do |instances|
    already_running<<instances[:instance_id]
    end
    end
    already_running_num = already_running.length
  • James Bayer at May 30, 2013 at 1:05 am
    Yes, this is the code I was referring to:
    https://github.com/cloudfoundry/cloud_controller_ng/blob/master/lib/cloud_controller/dea/dea_pool.rb#L41


    On Wed, May 29, 2013 at 8:08 AM, Mark Rushakoff
    wrote:
    I think Luke is looking at v1 CC code and James is talking about v2 CC
    code.

    The relevant v2 CC code is [here](
    https://github.com/cloudfoundry/cloud_controller_ng/blob/master/lib/cloud_controller/dea/dea_pool.rb)
    and is much easier to understand, in my biased opinion.

    Mark

    On Wednesday, May 29, 2013 12:09:58 AM UTC-7, James Bayer wrote:

    There was work done on this code Tuesday already that probably puts the
    sample you're using out of date. Basically the work is to better implement
    simple load balancing with anti-affinity for DEA's already running a
    particular app. Take a look in the next day or so and see if that doesn't
    address the points your brought up. I don't see it committed to master just
    quite yet.
    On Tuesday, May 28, 2013 6:57:06 PM UTC-7, mocc...@gmail.com wrote:

    I‘m trying to figure out how cc choose a dea. When i learned the code,
    it seems that there may be an error here.

    I have list the relative codes below:

    def process_dea_discover(message, reply)
    .....
    droplet_id = message_json['droplet'].to_s
    ......
    *calculate_help_taint(droplet_id)*
    ......
    end

    def calculate_help_taint(droplet_**id)
    # Calculate taint based on droplet already running here, then
    memory and cpu usage, etc.
    taint_ms = 0
    * already_running = @droplets[droplet_id]*
    taint_ms += (already_running.size * TAINT_MS_PER_APP) if
    already_running
    mem_percent = @reserved_mem / @max_memory.to_f
    taint_ms += (mem_percent * TAINT_MS_FOR_MEM)
    # TODO, add in CPU as a component..
    taint_ms
    end

    already_running : I think the parameter means the number of droplets
    which the dea already has.
    but the code write here can't get that correctly. so i changed it, list
    the new code below:

    already_running = []
    @droplets.each_value do |instance|
    instance.each_value do |instances|
    already_running<<ins**tances[:instance_id]
    end
    end
    already_running_num = already_running.length

    --
    Thank you,

    James Bayer
    650.646.1684
  • Mocc Bupt at Jun 3, 2013 at 3:28 am
    After some tests, this code has little problem.
    when the app :state is :CRASHED, it shouldn't be counted, but this code
    don't care the droplet's state. so i make a change like below:

    already_running_num = 0
           @droplets.each_value do |instance|
             instance.each_value do |instances|
               #already_running<<instances[:instance_id]
               if instances[:state] == :RUNNING
                 already_running_num += 1
               else
                 already_running_num
               end
             end
           end
  • James Bayer at Jun 3, 2013 at 8:17 am
    Thanks for raising this issue, we've had the team making changes in this
    area the last few days so I'll ask someone to review your points.

    On Sun, Jun 2, 2013 at 8:28 PM, wrote:

    After some tests, this code has little problem.
    when the app :state is :CRASHED, it shouldn't be counted, but this code
    don't care the droplet's state. so i make a change like below:

    already_running_num = 0
    @droplets.each_value do |instance|
    instance.each_value do |instances|
    #already_running<<**instances[:instance_id]
    if instances[:state] == :RUNNING
    already_running_**num += 1
    else
    already_running_**num
    end
    end
    end

    --
    Thank you,

    James Bayer
  • Mocc Bupt at May 31, 2013 at 1:20 am
    After some tests, this code has little problem.
    when the app :state is :CRASHED, it shouldn't be counted, but this code
    don't care the droplet's state. so i make a change like below:

           already_running_num = 0
           @droplets.each_value do |instance|
             instance.each_value do |instances|
               #already_running<<instances[:instance_id]
               if instances[:state] == :RUNNING
                 already_running_num += 1
               else
                 already_running_num
               end
             end
           end
  • Mocc Bupt at May 31, 2013 at 1:46 pm
    I‘m trying to figure out how cc choose a dea. When i learned the code, it
    seems that there may be an error here.

    I have list the relative codes below:

    def process_dea_discover(message, reply
           .....
           droplet_id = message_json['droplet'].to_s
           ......
           delay = calculate_help_taint(droplet_id)
           ......
    end
    def calculate_help_taint(droplet_id)

           # Calculate taint based on droplet already running here, then memory and cpu usage, etc.
           taint_ms = 0
           *already_running = @droplets[droplet_id]*
           taint_ms += (already_running_info * 10 ) if already_running

           taint_ms += (already_running * TAINT_MS_PER_APP) if already_running
           mem_percent = @reserved_mem / @max_memory.to_f
           taint_ms += (mem_percent * TAINT_MS_FOR_MEM)
           # TODO, add in CPU as a component..
           taint_ms
    end


    already_running : I think the parameter means the number of droplets which
    the dea already has.
    but the code write here can't get that correctly. so i changed it, list the
    new code below:

    already_running = []
           @droplets.each_value do |instance|
             instance.each_value do |instances|
               already_running<<instances[:instance_id]
             end
           end
    already_running_num = already_running.length

    taint_ms += (already_running_num * TAINT_MS_PER_APP) if already_running
  • Maria Shaldibina at Jun 3, 2013 at 5:24 pm
    Could you please provide a link to source code you referring to?

    Thanks,
    Maria
    On Tuesday, May 28, 2013 6:57:06 PM UTC-7, mocc...@gmail.com wrote:

    I‘m trying to figure out how cc choose a dea. When i learned the code, it
    seems that there may be an error here.

    I have list the relative codes below:

    def process_dea_discover(message, reply)
    .....
    droplet_id = message_json['droplet'].to_s
    ......
    *calculate_help_taint(droplet_id)*
    ......
    end

    def calculate_help_taint(droplet_id)
    # Calculate taint based on droplet already running here, then memory
    and cpu usage, etc.
    taint_ms = 0
    * already_running = @droplets[droplet_id]*
    taint_ms += (already_running.size * TAINT_MS_PER_APP) if
    already_running
    mem_percent = @reserved_mem / @max_memory.to_f
    taint_ms += (mem_percent * TAINT_MS_FOR_MEM)
    # TODO, add in CPU as a component..
    taint_ms
    end

    already_running : I think the parameter means the number of droplets which
    the dea already has.
    but the code write here can't get that correctly. so i changed it, list
    the new code below:

    already_running = []
    @droplets.each_value do |instance|
    instance.each_value do |instances|
    already_running<<instances[:instance_id]
    end
    end
    already_running_num = already_running.length

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupvcap-dev @
postedMay 29, '13 at 1:57a
activeJun 3, '13 at 5:24p
posts10
users5

People

Translate

site design / logo © 2021 Grokbase