You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Nguyen Anh Tu <ng...@gmail.com> on 2013/07/22 15:52:34 UTC

[Discuss] Apply rules on Virtual Router

Hi guys,

While working with L3 network services, I found a problem in the process of
applying iptables rules. It currently works not good in my opinion. When
you apply a new rule (eg. StaticNat or Egress rule), Virtual Router backups
old rules and re-apply all of non-revoked rules related to source IP on the
new rule, including this one. It causes a slow, especially when you have a
lot of running rules. When you delete a rule, the process happens in the
same. The deleting rule is marked as "revoked", so it doesn't appear in the
list. I think we should have a better approach.

Any idea?

-- 

N.g.U.y.e.N.A.n.H.t.U

Re: [Discuss] Apply rules on Virtual Router

Posted by Prasanna Santhanam <ts...@apache.org>.
On Mon, Jul 22, 2013 at 08:52:34PM +0700, Nguyen Anh Tu wrote:
> 
> While working with L3 network services, I found a problem in the process of
> applying iptables rules. It currently works not good in my opinion. When
> you apply a new rule (eg. StaticNat or Egress rule), Virtual Router backups
> old rules and re-apply all of non-revoked rules related to source IP on the
> new rule, including this one. It causes a slow, especially when you have a
> lot of running rules. When you delete a rule, the process happens in the
> same. The deleting rule is marked as "revoked", so it doesn't appear in the
> list. I think we should have a better approach.
> 

I'd like this: but know not how java can do this or what is involved:

Do you propose a diff based solution where we incrementally apply the
new set of rules? Also, do you think this can be done for any
configuration within the VR not just iptable rules?


-- 
Prasanna.,

------------------------
Powered by BigRock.com


Re: [Discuss] Apply rules on Virtual Router

Posted by Wei ZHOU <us...@gmail.com>.
+1
It is also much better if CS supports adding multiple rules in one request.



2013/7/23 Nguyen Anh Tu <ng...@gmail.com>

> Just still thinking about the incremental applying solution...
>
> +1 for writing rules to file.
>
>
> 2013/7/23 Alex Huang <Al...@citrix.com>
>
> > The file approach will definitely make it faster.
> >
> > Just thinking out loud, If we can write all of the rules on a file, why
> > not do an iptables-save, perform a diff and apply the difference?
> >
> > --Alex
> >
> > > -----Original Message-----
> > > From: Chiradeep Vittal [mailto:Chiradeep.Vittal@citrix.com]
> > > Sent: Tuesday, July 23, 2013 5:08 AM
> > > To: dev@cloudstack.apache.org
> > > Cc: Nguyen Anh Tu
> > > Subject: Re: [Discuss] Apply rules on Virtual Router
> > >
> > > It is quite hard to do a delta update correctly, so a complete rewrite
> > of the
> > > ruleset is the safest way to do it. Not sure why it is "slow", but I'd
> > compare it
> > > to the time taken to start a VM.
> > > One way to make it slightly faster is to write the ruleset to a file
> and
> > use
> > > iptables-restore from the file.
> > >
> > > On 7/23/13 5:22 PM, "Nguyen Anh Tu" <ng...@gmail.com> wrote:
> > >
> > > >Anyone?
> > > >
> > > >
> > > >2013/7/22 Nguyen Anh Tu <ng...@gmail.com>
> > > >
> > > >> Hi guys,
> > > >>
> > > >> While working with L3 network services, I found a problem in the
> > > >>process  of applying iptables rules. It currently works not good in
> my
> > > opinion.
> > > >>When
> > > >> you apply a new rule (eg. StaticNat or Egress rule), Virtual Router
> > > >>backups  old rules and re-apply all of non-revoked rules related to
> > > >>source IP on the  new rule, including this one. It causes a slow,
> > > >>especially when you have a  lot of running rules. When you delete a
> > > >>rule, the process happens in the  same. The deleting rule is marked
> as
> > > >>"revoked", so it doesn't appear in the  list. I think we should have
> a
> > > >>better approach.
> > > >>
> > > >> Any idea?
> > > >>
> > > >> --
> > > >>
> > > >> N.g.U.y.e.N.A.n.H.t.U
> > > >>
> > > >
> > > >
> > > >
> > > >--
> > > >
> > > >N.g.U.y.e.N.A.n.H.t.U
> >
> >
>
>
> --
>
> N.g.U.y.e.N.A.n.H.t.U
>

Re: [Discuss] Apply rules on Virtual Router

Posted by Nguyen Anh Tu <ng...@gmail.com>.
Just still thinking about the incremental applying solution...

+1 for writing rules to file.


2013/7/23 Alex Huang <Al...@citrix.com>

> The file approach will definitely make it faster.
>
> Just thinking out loud, If we can write all of the rules on a file, why
> not do an iptables-save, perform a diff and apply the difference?
>
> --Alex
>
> > -----Original Message-----
> > From: Chiradeep Vittal [mailto:Chiradeep.Vittal@citrix.com]
> > Sent: Tuesday, July 23, 2013 5:08 AM
> > To: dev@cloudstack.apache.org
> > Cc: Nguyen Anh Tu
> > Subject: Re: [Discuss] Apply rules on Virtual Router
> >
> > It is quite hard to do a delta update correctly, so a complete rewrite
> of the
> > ruleset is the safest way to do it. Not sure why it is "slow", but I'd
> compare it
> > to the time taken to start a VM.
> > One way to make it slightly faster is to write the ruleset to a file and
> use
> > iptables-restore from the file.
> >
> > On 7/23/13 5:22 PM, "Nguyen Anh Tu" <ng...@gmail.com> wrote:
> >
> > >Anyone?
> > >
> > >
> > >2013/7/22 Nguyen Anh Tu <ng...@gmail.com>
> > >
> > >> Hi guys,
> > >>
> > >> While working with L3 network services, I found a problem in the
> > >>process  of applying iptables rules. It currently works not good in my
> > opinion.
> > >>When
> > >> you apply a new rule (eg. StaticNat or Egress rule), Virtual Router
> > >>backups  old rules and re-apply all of non-revoked rules related to
> > >>source IP on the  new rule, including this one. It causes a slow,
> > >>especially when you have a  lot of running rules. When you delete a
> > >>rule, the process happens in the  same. The deleting rule is marked as
> > >>"revoked", so it doesn't appear in the  list. I think we should have a
> > >>better approach.
> > >>
> > >> Any idea?
> > >>
> > >> --
> > >>
> > >> N.g.U.y.e.N.A.n.H.t.U
> > >>
> > >
> > >
> > >
> > >--
> > >
> > >N.g.U.y.e.N.A.n.H.t.U
>
>


-- 

N.g.U.y.e.N.A.n.H.t.U

RE: [Discuss] Apply rules on Virtual Router

Posted by Alex Huang <Al...@citrix.com>.
The file approach will definitely make it faster.  

Just thinking out loud, If we can write all of the rules on a file, why not do an iptables-save, perform a diff and apply the difference?  

--Alex

> -----Original Message-----
> From: Chiradeep Vittal [mailto:Chiradeep.Vittal@citrix.com]
> Sent: Tuesday, July 23, 2013 5:08 AM
> To: dev@cloudstack.apache.org
> Cc: Nguyen Anh Tu
> Subject: Re: [Discuss] Apply rules on Virtual Router
> 
> It is quite hard to do a delta update correctly, so a complete rewrite of the
> ruleset is the safest way to do it. Not sure why it is "slow", but I'd compare it
> to the time taken to start a VM.
> One way to make it slightly faster is to write the ruleset to a file and use
> iptables-restore from the file.
> 
> On 7/23/13 5:22 PM, "Nguyen Anh Tu" <ng...@gmail.com> wrote:
> 
> >Anyone?
> >
> >
> >2013/7/22 Nguyen Anh Tu <ng...@gmail.com>
> >
> >> Hi guys,
> >>
> >> While working with L3 network services, I found a problem in the
> >>process  of applying iptables rules. It currently works not good in my
> opinion.
> >>When
> >> you apply a new rule (eg. StaticNat or Egress rule), Virtual Router
> >>backups  old rules and re-apply all of non-revoked rules related to
> >>source IP on the  new rule, including this one. It causes a slow,
> >>especially when you have a  lot of running rules. When you delete a
> >>rule, the process happens in the  same. The deleting rule is marked as
> >>"revoked", so it doesn't appear in the  list. I think we should have a
> >>better approach.
> >>
> >> Any idea?
> >>
> >> --
> >>
> >> N.g.U.y.e.N.A.n.H.t.U
> >>
> >
> >
> >
> >--
> >
> >N.g.U.y.e.N.A.n.H.t.U


Re: [Discuss] Apply rules on Virtual Router

Posted by Kelven Yang <ke...@citrix.com>.
slowness comes from that for very changed rule, we will have a round-trip
cost of sending/executing command from management server to resource.

+1 to write ruleset to a file, and if we do complete ruleset rewrite,
restarting VR could also be improved (we don't need to refresh rules one
by one, we may also be able to do a version check)

Kelven 

On 7/23/13 5:08 AM, "Chiradeep Vittal" <Ch...@citrix.com> wrote:

>It is quite hard to do a delta update correctly, so a complete rewrite of
>the ruleset is the safest way to do it. Not sure why it is "slow", but I'd
>compare it to the time taken to start a VM.
>One way to make it slightly faster is to write the ruleset to a file and
>use iptables-restore from the file.
>
>On 7/23/13 5:22 PM, "Nguyen Anh Tu" <ng...@gmail.com> wrote:
>
>>Anyone?
>>
>>
>>2013/7/22 Nguyen Anh Tu <ng...@gmail.com>
>>
>>> Hi guys,
>>>
>>> While working with L3 network services, I found a problem in the
>>>process
>>> of applying iptables rules. It currently works not good in my opinion.
>>>When
>>> you apply a new rule (eg. StaticNat or Egress rule), Virtual Router
>>>backups
>>> old rules and re-apply all of non-revoked rules related to source IP on
>>>the
>>> new rule, including this one. It causes a slow, especially when you
>>>have a
>>> lot of running rules. When you delete a rule, the process happens in
>>>the
>>> same. The deleting rule is marked as "revoked", so it doesn't appear in
>>>the
>>> list. I think we should have a better approach.
>>>
>>> Any idea?
>>>
>>> --
>>>
>>> N.g.U.y.e.N.A.n.H.t.U
>>>
>>
>>
>>
>>-- 
>>
>>N.g.U.y.e.N.A.n.H.t.U
>


Re: [Discuss] Apply rules on Virtual Router

Posted by Chiradeep Vittal <Ch...@citrix.com>.
It is quite hard to do a delta update correctly, so a complete rewrite of
the ruleset is the safest way to do it. Not sure why it is "slow", but I'd
compare it to the time taken to start a VM.
One way to make it slightly faster is to write the ruleset to a file and
use iptables-restore from the file.

On 7/23/13 5:22 PM, "Nguyen Anh Tu" <ng...@gmail.com> wrote:

>Anyone?
>
>
>2013/7/22 Nguyen Anh Tu <ng...@gmail.com>
>
>> Hi guys,
>>
>> While working with L3 network services, I found a problem in the process
>> of applying iptables rules. It currently works not good in my opinion.
>>When
>> you apply a new rule (eg. StaticNat or Egress rule), Virtual Router
>>backups
>> old rules and re-apply all of non-revoked rules related to source IP on
>>the
>> new rule, including this one. It causes a slow, especially when you
>>have a
>> lot of running rules. When you delete a rule, the process happens in the
>> same. The deleting rule is marked as "revoked", so it doesn't appear in
>>the
>> list. I think we should have a better approach.
>>
>> Any idea?
>>
>> --
>>
>> N.g.U.y.e.N.A.n.H.t.U
>>
>
>
>
>-- 
>
>N.g.U.y.e.N.A.n.H.t.U


Re: [Discuss] Apply rules on Virtual Router

Posted by Nguyen Anh Tu <ng...@gmail.com>.
Anyone?


2013/7/22 Nguyen Anh Tu <ng...@gmail.com>

> Hi guys,
>
> While working with L3 network services, I found a problem in the process
> of applying iptables rules. It currently works not good in my opinion. When
> you apply a new rule (eg. StaticNat or Egress rule), Virtual Router backups
> old rules and re-apply all of non-revoked rules related to source IP on the
> new rule, including this one. It causes a slow, especially when you have a
> lot of running rules. When you delete a rule, the process happens in the
> same. The deleting rule is marked as "revoked", so it doesn't appear in the
> list. I think we should have a better approach.
>
> Any idea?
>
> --
>
> N.g.U.y.e.N.A.n.H.t.U
>



-- 

N.g.U.y.e.N.A.n.H.t.U