Hi Gayan,

Thank you for your thoughts.

Okay. So if no HA Proxy to be used, my approach would be as follows.

Whenever topology change event is received this new load balancer extension
will do following things.

for each service
for each cluster of the service
if a target pool is not created for this cluster
then
create a target pool
add all members of the cluster to target pool
add ID of target pool to the map say 'clusterTargetPool'
else
get ID of the target pool using map 'clusterTargetPool'
add/remove instances from target pool as necessary to match with cluster
members

create a forwarding rule with an external IP and associate the above target
pool to this forwarding rule

for each hostname in this cluster
add DNS entry or /etc/hosts entry to use the exterrnal IP of forwarding
rule for this hostname
done

add this forwarding rule to a map say 'clusterForwardingRules'
done
done

Remove unnecessary target pools and forwarding rules.

Could you please provide feedback on this approach?

Thanks and Regards,
Swapnil

On Tue, Apr 21, 2015 at 4:02 PM, Gayan Gunarathne <[email protected]> wrote:

> Hi Swapnil,
>
> IMO also we don't need HAProxy to do the port switching. As we are using
> target pool for each cluster and you can assign the IP address to a
> forwarding rule which is associate with the thread pool. Whenever you
> access the service attach with the IP, it will forward the traffic into one
> of these instances.
> But you can refer the extension API of the HAProxy load balancer [1].That
> would help you to fetch the topology information in real time and update
> the configuration accordingly.
>
> As Imesh mention additionally we can map external IP address to a hostname
> by using the /etc/host or DNS entry.
>
> [1]
> https://github.com/apache/stratos/tree/master/extensions/load-balancer/haproxy-extension
>
> Thanks,
> Gayan
>
>
> On Tue, Apr 21, 2015 at 11:31 AM, Swapnil Patil <[email protected]>
> wrote:
>
>> Hi Imesh,
>>
>> Thank you for your input.
>>
>> Yes, I agree that we should create a target pool for each cluster. But as
>> far as I know, we can't assign IP address to a target pool. We can assign
>> IP address to a forwarding rule and a target pool will be associated with a
>> forwarding rule. Also forwarding rule can filter requests based on the port
>> number.
>>
>> Yes, we could map external IP of forwarding rule to a hostname by using
>> DNS entry or by using /etc/hosts.
>>
>> But I have one doubt, each service has a port and proxy port. Now I
>> assume that 'proxy port' is used while contacting a load balancer and load
>> balancer will send the request on port value 'port' of an instance. Please
>> correct me if I am wrong here.
>>
>> If this port-proxy port scenario I have assumed is correct, then I am not
>> sure which component will do this switching of port value of requests if we
>> don't use HA Proxy.
>>
>> Could you please let me know if I have misinterpreted anything or this
>> port switching can be done even if we don't use HA Proxy?
>>
>> Thanks and Regards,
>> Swapnil Patil
>> IIIT Hyderabad
>>
>> On Mon, Apr 20, 2015 at 11:05 PM, Imesh Gunaratne <[email protected]>
>> wrote:
>>
>>> Hi Swapnil,
>>>
>>> Thanks for your response on this. IMO we could achieve this
>>> functionality without having to use a haproxy instance.
>>>
>>> The concept we have here is to group all the members of a cluster and
>>> use a hostname to load balance incoming requests among them. With GCE what
>>> we can do is to create a target pool for each cluster and either have a
>>> dedicated external IP address for each target pool or use different ports
>>> on the same external IP address to access them.
>>>
>>> As an additional step we could map the external IP address to a hostname
>>> by using a DNS entry or by using /etc/hosts.
>>>
>>> Thanks
>>>
>>> On Mon, Apr 20, 2015 at 9:57 PM, Swapnil Patil <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have proposed a solution for the project on $subject where I am using
>>>> an HA Proxy between incoming request and Google Compute Engine (GCE) load
>>>> balancing components.
>>>>
>>>> I have been advised to provide more description regarding why I am
>>>> using HA Proxy in my proposed solution.
>>>>
>>>> Please find below the reason for the same.
>>>>
>>>> Stratos needs to route traffic based on the hostname field of the
>>>> incoming request. I have proposed to use Network Load Balancing of Google
>>>> Compute Engine (GCE) which does not provide any central component that
>>>> makes routing decisions based on the hostname field of the request.
>>>>
>>>> GCE network load balancing has following concepts
>>>> 1. Target pool - a set of instances. In Stratos, a cluster can be
>>>> treated as target pool.
>>>> 2. Forwarding rule - A forwarding rule has an external IP, a port
>>>> range, a target pool. Whenever a request is made to this external IP with
>>>> port numbers specified in the port range, the request is routed to the
>>>> specified target pool.
>>>>
>>>> As GCE network load balancing does not have any mechanism to route
>>>> traffic based on hostname, I proposed to use HA Proxy between incoming
>>>> requests and GCE load balancing components.
>>>>
>>>> If we use HA Proxy, we can add a rule saying which forwarding rule
>>>> should be used for a particular combination of hostname, protocol and port.
>>>> So forwarding rules of GCE load balancing will act as backend instances of
>>>> HA Proxy.
>>>>
>>>> So overall flow would be as follows
>>>> 1. HA Proxy decides which backend (forwarding rule) to use based on the
>>>> incoming request.
>>>> 2. Request is delegated to the GCE forwarding rule associated with that
>>>> backend.
>>>> 3. Forwarding rule of GCE routes the incoming request to the target
>>>> pool which is specified in the rule.
>>>> 4. Target pool routes the incoming request to a particular instance in
>>>> the pool i.e. an instance in the cluster.
>>>>
>>>> This is what I thought would be an appropriate solution. I would
>>>> appreciate if anybody has any thoughts on this.
>>>>
>>>> Thanks and Regards,
>>>> Swapnil Patil
>>>> IIIT Hyderabad
>>>>
>>>
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>
>
> --
>
> Gayan Gunarathne
> Technical Lead
> WSO2 Inc. (http://wso2.com)
> email  : [email protected]  | mobile : +94 766819985
>
>

Reply via email to