Performance impace of spawning shell processes from Dovecot [was: quota_over_flag examples?]

Gedalya gedalya at gedalya.net
Fri Apr 17 03:53:02 UTC 2015


On 04/16/2015 09:09 PM, E.B. wrote:
>> Don't use bash, of course!
> Hmm well I didn't not know about this. On CentOS--
>
> lrwxrwxrwx. 1 root root 4 Apr  5 10:31 /bin/sh -> bash*
>
> Can you state the reasons you say do not use bash so I can google about
> them?

Some random links..

https://wiki.ubuntu.com/DashAsBinSh
https://lwn.net/Articles/343924/
http://www.cyberciti.biz/faq/debian-ubuntu-linux-binbash-vs-bindash-vs-binshshell/

My summary:

I use Debian.
dash is actually a Debian-specific creation. The problem with bash is 
that it's feature-rich and therefore slow to start and slow to execute. 
For non-interactive scripts, things like tab-completion or command 
history are not needed of course. Less-than-bash shells however also do 
not support more advanced bash syntax.

http://mywiki.wooledge.org/Bashism

/usr/bin/mysql is of course 3 times bigger than /bin/bash and for that 
matter is also guilty of being unnecessarily friendly to interactive 
users (via libreadline) ;-)

So I did a very crude test and putting a 'echo select 1 | mysql' in a 
#!/bin/bash script is only ~20% slower than using #!/bin/sh (which is 
dash in my case).
Oh and it looks like mysql -e blah is a bit faster under bash, but not 
under dash.

I guess the differences are more meaningful when we're talking about 
more than (hardly even) one line of shell code.



More information about the dovecot mailing list