Hi everyone,
I have the following question after reading some posts and some previous knowledge:
What is the best scripting language for secure automation and speed on Linux and in general for DEV-OPS?(python, ruby, rust)
Thanks in advance to all the participants to this discussion
Top comments (14)
To me, maybe because my familiarity with, the best scripting language for automation is JavaScript/Node.
Initially working with exec/spawn can be a little challenging, but once you mastered them, it's very powerful.
Interesting point, but as I recall JavaScript is not multi-threaded. So I don't think it has speed compared to rust and python.
As @bittnkr said, you can spawn multiple processes easily with
child_process
, if you want to run parallel computations.In system automation I think the performance of the hosting language is negligible.
For example, if you need to zip a directory, the speed that really matters is tool you are calling (zip, gzip, 7zip, ...).
If you need to parallelize tasks, in Node you can just spawn another process or use worker threads.
Python doesn’t really have multithreading either. Well it technically does, but you can only use one at a time by default.
Python has huge performance, in my opinion it is like PHP and it hasn't an high level of security.
Ruby it is very secure and reactive but it hasn't high performance.
I don't have an opinion on Rust.
In my opinion, in this cases you need to keeping in mind advantages and disadvantages of each of them. For my experience i prefer Python.
Thanks, @marco for sharing your experience regarding Python.
After some digging and reading, I think that Python has some advantages because it has tutorials and all the knowledge you gain can be transferred to other languages.
Take a look at Nim. It can compile to C so speed should not be a problem.
Heard about
Nim
it's trying to be the successor of python right?Thanks for reminding me of it.
I wonder if
Elixir
can be used for this as well. (thinking mood)Found this looks interesting and promising thoughtbot.com/blog/is-elixir-a-sc...
The syntax does look a lot like python but they take ideas from other languages as well. The fact that is type-safe and can generate self-contained binaries is certainly an advantage they have over python.
Interesting, I will have to test it, I like what you are saying about it.
It seems that I will have to take into consideration node for my list of scripting languages.
Thanks @bittnkr @avalander @tobiassn
Searching my repositories, I found an example where I used node for automation. I think it can serve as a seed for you.
It uses 7zip to create a separated file for each sub-directory.
Useful for when you have one directory with logs for each day or month and want a single zip file per day.
It launches a process for each core of you processor as needed.
You need 7zip installed in your computer. (in linux,
sudo apt install p7zip-full
)Save it as zipsubs, mark it as executable
chmod +x zipsubs
zipsubs . .git node_modules
will zip all subdirs of current dir ignoring.git
andnode_modules
.It has no dependencies.
Thanks for sharing and explaining where you use it, really appreciate it.