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

Reply via email to