<div dir="ltr">Hello!<div><br></div><div>Just adding my opinion. I think that the current interface to RAs with environment variables is very good. It's similar to CGI which was hugely successful due to it's flexibility. </div><div><br></div><div>As an RA implementation language, however, most classic shells and Bash in particular certainly has its drawbacks. Lack of complex data structures, difficulties performing more advanced arithmetics and handling errors robustly are some of the problems which spring to mind. </div><div><br></div><div>I do understand Bash being the default choice, since it is a common denominator for many POSIX-like systems. That said, I think it could be useful to add some wrappers and examples for more traditional languages, just like how CGI does it. Python springs to mind as a suitable language for medium-sized RA:s: it's very popular, integrates well with it's environment and has extensive tooling for testing. </div><div><br></div><div>I don't think performance really is an issue with RA:s. The scripts are called very infrequently and aren't generally doing any heavy lifting. Startup latency is the only thing which I can envision being a problem with certain language choices.</div><div><br></div><div>Best regards,</div><div><br></div><div>Alexander</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 11, 2015 at 8:30 AM, Ulrich Windl <span dir="ltr"><<a href="mailto:Ulrich.Windl@rz.uni-regensburg.de" target="_blank">Ulrich.Windl@rz.uni-regensburg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">>>> "Fabio M. Di Nitto" <<a href="mailto:fabbione@fabbione.net">fabbione@fabbione.net</a>> schrieb am 11.08.2015 um 06:42<br>
in<br>
Nachricht <<a href="mailto:55C97D3D.5040601@fabbione.net">55C97D3D.5040601@fabbione.net</a>>:<br>
<br>
[...]<br>
<span class="">> first of all, our end user is not necessarily a developer. Most of them<br>
> are in fact sysadmins and one common that sysadmins have is that they<br>
> know bash/shell.<br>
<br>
</span>But actually you can make much more errors in a shell script than in a Perl<br>
(just  one language example) script. With "errors" I mean errors that aren't<br>
discovered until the script runs, and errors that are discovered during run (by<br>
the interpreter, not by the programmer).<br>
<span class=""><br>
><br>
> If needs arise to debug a RA, shell is pretty much the only common<br>
> denominator with our user base.<br>
<br>
</span>Why? Debugging Perl is much easier than debugging a shell script. Or do you<br>
talk about "-x" to trace the commands?<br>
<br>
One of the biggest problems in shell is the "text substitution model" when<br>
using variables. Things depend very much what is in a variable (like<br>
backslashes quotes, spaces, etc.).<br>
<span class=""><br>
><br>
> The other problem i see in using other languages is how they operate<br>
> under extreme conditions (memory pressure, disk I/O etc).<br>
<br>
</span>I agree that the old Bourne shell was quite robust under extreme conditions,<br>
but the shell is only the basic part. Every command invoked by the shell has to<br>
be robust also. And most important: The programmer has to take care about<br>
exceptional conditions. In my experience especially that is hardly ever done in<br>
shell scripts.<br>
<span class=""><br>
><br>
> Just for the fun of it, I did some basic profiling of "hello world" in<br>
> bash and perl. Please dońt take this as an attempt to start a<br>
> "language" flame war here. I just want to explain differences on why<br>
> shell vs others.<br>
><br>
> Perl is at least 3 times slower than bash<br>
> Perl uses at least 4/5 times more memory to execute the same command<br>
<br>
</span>Did you also comapre it with "echo 'hello world'"? ;-) I mean which RA<br>
consists of exaclty one line? If you read a directory with 500 entries,<br>
detecting all that are files, I guess Perl should be already faster than the<br>
comparable shell script, because Perl does not need to run external processes<br>
for most of the commands being used.<br>
<span class=""><br>
<br>
><br>
> Granted, it́s an incredibly small test et all, but all I am trying to<br>
> say is that Cluster is supposed to be as reliable as possible under<br>
> extreme conditions.<br>
<br>
</span>So program RAs in C or anoter language that has almost no runtime that could<br>
be unreliable? Oh well, unreliable... I'd better stop here...<br>
<span class=""><br>
><br>
> In most systems, all commands required to execute a RA in shell are<br>
> already cached in ram and requirements to re-run them are minimal (and<br>
> could save a system).<br>
<br>
</span>But still with shared libraries there is overhead to get the started as a<br>
process. (Having statically linked binaries would be different). Oh well, for<br>
your Perl example: Did you run it more than once?<br>
<br>
You'll also have to compare loading time vs. execution time. While simple<br>
scripts seem faster in shell, you'll have real trouble implementing any complex<br>
algorithm in a shell script.<br>
<span class=""><br>
><br>
> with Perl, there was no caching that I could see (even executing the<br>
> command several times), with lots of I/O to load modules from disks.<br>
<br>
</span>That's not fair: You say the files for external commands and the shell is<br>
cached, but the files for Perl are not? Why should that be?<br>
<br>
I did a test myself (SLES11SP3 x86_64 in a Xen-PVM) (you did not post your<br>
test):<br>
---<br>
v04:/tmp> echo "echo 'hello world'" >hi.sh<br>
v04:/tmp> chmod +x hi.sh<br>
v04:/tmp> echo 'print "hello world\n";' ><a href="http://hi.pl" rel="noreferrer" target="_blank">hi.pl</a><br>
v04:/tmp> chmod +x <a href="http://hi.pl" rel="noreferrer" target="_blank">hi.pl</a><br>
v04:/tmp> time sh hi.sh<br>
hello world<br>
<br>
real    0m0.011s<br>
user    0m0.000s<br>
sys     0m0.004s<br>
v04:/tmp> time perl <a href="http://hi.pl" rel="noreferrer" target="_blank">hi.pl</a><br>
hello world<br>
<br>
real    0m0.009s<br>
user    0m0.004s<br>
sys     0m0.004s<br>
v04:/tmp> #again<br>
v04:/tmp> time sh hi.sh<br>
hello world<br>
<br>
real    0m0.007s<br>
user    0m0.000s<br>
sys     0m0.004s<br>
v04:/tmp> time perl <a href="http://hi.pl" rel="noreferrer" target="_blank">hi.pl</a><br>
hello world<br>
<br>
real    0m0.007s<br>
user    0m0.004s<br>
sys     0m0.000s<br>
---<br>
So Perl is NOT any slower than Shell in this simple case!<br>
<span class=""><br>
><br>
> So given that, is it worth rewriting the RA in another language (and<br>
> what defines a "simple" vs "complex" ras from above)? or wouldńt it<br>
> better to just fix the current ones for stuff like escapes and handling<br>
> of spaces in the options?<br>
<br>
</span>I could not verify most of your arguments, sorry!<br>
<br>
><br>
> Just 2c<br>
> Fabio<br>
[...]<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
Users mailing list: <a href="mailto:Users@clusterlabs.org">Users@clusterlabs.org</a><br>
<a href="http://clusterlabs.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://clusterlabs.org/mailman/listinfo/users</a><br>
<br>
Project Home: <a href="http://www.clusterlabs.org" rel="noreferrer" target="_blank">http://www.clusterlabs.org</a><br>
Getting started: <a href="http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf" rel="noreferrer" target="_blank">http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf</a><br>
Bugs: <a href="http://bugs.clusterlabs.org" rel="noreferrer" target="_blank">http://bugs.clusterlabs.org</a><br>
</div></div></blockquote></div><br></div>