Re: [OpenWrt-Devel] hotplug / micro-optimization

2014-06-09 Thread Bastian Bittorf
* Felix Fietkau n...@openwrt.org [09.06.2014 21:23]:

[...]

 For this trigger we can add a time delay, which will aggregate events.
 Once that is implemented correctly, 400 ifup events in rapid succession
 will lead to only one series of init script calls instead of 400.
 With that approach, such micro-optimizations become unnecessary.

thanks for the explanation - sound good! bye, bastian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] hotplug / micro-optimization

2014-06-06 Thread Weedy
On 5 Jun 2014 04:19, Bastian Bittorf bitt...@bluebottle.com wrote:

 i have a router here with 400 vlan-interfaces.
 i'am still not happy, that an hotplug-event triggers a lot of unneccesary
action.

I wasn't paying attention but what services are you complaining about?

On my router things like dnsmasq, the firewall, miniupnpd, and QoS run
/etc/init.d/whatever enabled as the first line of code.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] hotplug / micro-optimization

2014-06-06 Thread Felix Fietkau
On 2014-06-05 10:31, Bastian Bittorf wrote:
 i have a router here with 400 vlan-interfaces.
 i'am still not happy, that an hotplug-event triggers a lot of unneccesary 
 action.
 
 i see at least 3 possibilities reduce the load:
 (beside the upcoming procd-interface job)
 
 1)
 each script implements something like:
 
 #!/bin/sh
 /etc/init.d/$daemon enabled || exit 0
 
 case $ACTION in
   ifup)
   ...
   ;;
 esac
 
 the part '/etc/init.d/$daemon enabled' is expensive, so we can instead call:
 . /etc/rc.common /etc/init.d/$daemon enabled || return 0
 
 this saves _some_ cycles (2 seconds here for 400 hotplug-scripts, not much)
 
 2)
 simply dont call a script when the corresponding daemon is not enabled.
 i'am not sure, if each hotplug-script has a coressponding
 /etc/init.d/$daemon script, if so - so would be fine (and easy to do)
 
 3)
 during bootup or '/etc/init.d/$daemon enable' we build a directory for
 enabled scripts. while we are at it, we can e.g. call 'ifup'/$ACTION if the
 daemon supports/implements it, otherwise ignore
 
 what will be the best approach? bye, bastian
The best approach will be: none of the above. We're going to use the
procd 'trigger' support (added in r41008) to avoid having to throw in
hotplug scripts for every service.
When a service is started from the init script, it adds a network event
trigger, meaning it will be called by procd when netifd sends an
interface event.
For this trigger we can add a time delay, which will aggregate events.
Once that is implemented correctly, 400 ifup events in rapid succession
will lead to only one series of init script calls instead of 400.
With that approach, such micro-optimizations become unnecessary.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] hotplug / micro-optimization

2014-06-05 Thread Bastian Bittorf
i have a router here with 400 vlan-interfaces.
i'am still not happy, that an hotplug-event triggers a lot of unneccesary 
action.

i see at least 3 possibilities reduce the load:
(beside the upcoming procd-interface job)

1)
each script implements something like:

#!/bin/sh
/etc/init.d/$daemon enabled || exit 0

case $ACTION in
ifup)
...
;;
esac

the part '/etc/init.d/$daemon enabled' is expensive, so we can instead call:
. /etc/rc.common /etc/init.d/$daemon enabled || return 0

this saves _some_ cycles (2 seconds here for 400 hotplug-scripts, not much)

2)
simply dont call a script when the corresponding daemon is not enabled.
i'am not sure, if each hotplug-script has a coressponding
/etc/init.d/$daemon script, if so - so would be fine (and easy to do)

3)
during bootup or '/etc/init.d/$daemon enable' we build a directory for
enabled scripts. while we are at it, we can e.g. call 'ifup'/$ACTION if the
daemon supports/implements it, otherwise ignore

what will be the best approach? bye, bastian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] hotplug / micro-optimization

2014-06-05 Thread Weedy
On 5 Jun 2014 04:19, Bastian Bittorf bitt...@bluebottle.com wrote:
 3)
 during bootup or '/etc/init.d/$daemon enable' we build a directory for
 enabled scripts. while we are at it, we can e.g. call 'ifup'/$ACTION if
the
 daemon supports/implements it, otherwise ignore

You mean the symlinks in /etc/rcS/?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel